Commit Graph

348 Commits

Author SHA1 Message Date
Adeeb Shihadeh 2e5de6e99c
Mazda: CAN ignition (#758) 2021-10-30 15:32:27 -07:00
Adeeb Shihadeh 1b0295a3ef
remove USB command for bus forwarding (#749) 2021-10-28 23:40:11 -07:00
Greg Hogan 80260c6bcc
expose TX messages blocked by safety hook (#742)
* expose tx messages blocked by safety hook

* update unit tests

* preserve bus of original message

* update tests
2021-10-18 12:26:24 -07:00
Igor Biletskyy 87f81b96a5
Move CAN buffers rx_q and txgmlan_q to RAM D1 on STM32H7 (#734)
* Add RAM D1 to linker script

* Check idea with bigger buffers

* Move rx_q and txgmlan to RAM D1 on H7
2021-10-07 11:07:19 -07:00
Greg Hogan 7e99d5245f
expose DEBUG flag and improve debug console output (#728)
* expose debug flags and improve debug console output

* puth4

* other flags need to be set more locally

* fix misra violations

* fix misra violation

* fix misra violation
2021-09-25 21:46:19 -07:00
Willem Melching fb8f452d68
Try resuming outep3 on can buffer clear (#716)
* try resuming outep3 on can buffer clear

* simplify

* more cleanup

Co-authored-by: Greg Hogan <gregjhogan@gmail.com>
2021-09-08 10:59:00 -07:00
Igor Biletskyy db4a43f8ce
set bcdDevice to hardware type (#705) 2021-08-04 14:58:27 -07:00
Igor Biletskyy ad90646001
Support for STM32H7 and Red Panda (#694)
* H7 drivers

* Include H7 into the code

* fix flash write for H7

* get serial from flasher.h from F4 and H7

* flash.sh and recover.sh for gen3

* add set_data_speed for BRS CAN FD

* build all fws

* gen3 to panda lib

* gen3 name in scons project

* disable fd can and brs

* gen3 to CI tests

* jenkins fix for new tests and build_all

* fix pedal test

* pedal in panda tests again...

* cleanup llfdcan.h

* cleanup clock.h

* Add LDORDY bit check instead of delay

* missing define in stm32h735xx.h lib

* board_id helper

* enable debug detection again

* clean gpio inits

* fix board_id helper, make cleaner

* comment MCUs in stm lib for faster misra

* target MCU

* misra-5.5

* improve headers and misra speed

* cleanup CI tests

* change naming from gen3 to h7

* readable if statement

* cleanup llusb.h

* only cycle one transceifer in bus-off

* move unused funcs to common header

* bus_off_err reset

* misra 10.4 fdcan

* extern to can_data_speed variable

* limit can_data_speed array size to 3

* reinit fd can on data speed change

* Improve test with ELM327 and extaddr check

* bugfix for fdcan

* panda python config naming

* abstracted init request in llfdcan

* misra fdcan

* Improve llusb.h for H7
2021-08-02 20:26:15 -07:00
Igor 863993dab9
refactor CAN (#695) 2021-07-16 12:22:28 -07:00
Igor 7157175bd4
uart.h refactor: move uart_send_break to lluart.h (#693) 2021-07-14 15:45:10 -07:00
Igor 9f781e9e7e
Abstract MICROSECOND_TIMER (#690) 2021-07-14 10:59:28 -07:00
Igor 11b6d90cd4
Move dac.h to HAL (#691) 2021-07-14 10:31:11 -07:00
Igor 1c498c9e05
Deprecate variable bcdDevice in usb.h (#689) 2021-07-14 10:30:02 -07:00
Igor b98e3deb76
remove can_set_obd (#687)
Remove can_set_obd() from can.h . It was replaced by local to boards set_can_mode()
2021-07-14 10:13:13 -07:00
Igor eab9c9ee4c
HAL refactoring part 2 (#682)
* Move harness threshold

* Move interrupt handlers

* timers.h refactor

* rtc.h refactor

* pwm.h and fan.h refactor

* clock_source is hw specific

* refactor uart.h

* macro naming

* minor fixes

* redo rtc
2021-07-13 14:12:07 -07:00
robbederks 3815bf8f41
also pulse sensor sync (#683) 2021-07-12 15:58:14 +02:00
Igor 7d93e5a202
Refactor HAL (#656)
* Let refactoring begin!

* Fix pedal build

* Fix pedal safety tests

* Forgot few TIM2 instances

* Try this way with misra

* More misras...

* More misras...

* Still fighting with misra blindfolded

* Almost got it!

* Last misra error..

* Last misra error..

* Misra works locally..

* Maybe this?

* Looks like it was cppcheck bug, revert changes

* Suggested changes and reverts

* File structure change

* revert includes

* remove spaces

* remove timer delay

* endings

* more typing

* rename early to early_initialization

* Remove delay_us

* Revert RTC default values

* Revert initialization sequence

* Fix quotes

* Revert

* Return TIM6EN

* Alias slow timer to TICK_TIMER

* Refactor files structure

* Remove definition of PANDA

* Abstract timers

* Fix include

* tick_timer_init

* Split usb driver

* Move LL stuff: adc

* Move LL stuff: usb

* Fix include again...

* Will check pedal builds also locally..

* Move LL stuff: CAN

* Move LL stuff: clock

* Rename common to peripherals and move

* Move board HAL

* Change include, not needed for pedal

* llgpio to gpio and new lines fix

* remove board_has_relay, not used

* Remove board_functions.h and add to board struct

* Move include

* Fk MISRA...

* has_onboard_gmlan to has_hw_gmlan

* Typos

* Move board_declarations include

* Shuffle

* More abstraction

* fix paths, fix cppcheck test

* Fix for pedal build with USB
2021-07-02 18:25:35 -07:00
Igor b2d28a7123
Fix MISRA 8.2 violations (#675)
* Fix violation 8.2

* Update cppcheck

* Remove inline suppressions

* Change source to upstream
2021-06-30 17:47:41 -07:00
Igor 4c57ebd928
Fix possible null ptr dereference (#670) 2021-06-18 20:10:44 -07:00
Igor eccafa3712
Fix MISRA 20.x violations (#668)
* Fix 20.x

* missed one
2021-06-18 17:31:35 -07:00
Igor 736ff9699f
Fix MISRA 12.x violations (#667)
* Fix misra 12.x

* typo
2021-06-18 16:42:49 -07:00
Igor 1fdc3c98db
Fix MIRSA 7.X violations (#665) 2021-06-18 15:11:09 -07:00
Igor ddc25b0611
Update cppcheck and misra, suppress for now (#663)
* Update cppcheck and misra, suppress for now

* Add FIXME to suppression tags

* Missed one spot
2021-06-18 14:24:15 -07:00
Igor d7a82efbf5
Fix bug in GET_FLAG macro (#660)
* Quick bug fix in llcan.h

* Update board/drivers/llcan.h

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2021-06-14 15:41:54 -07:00
robbederks f2446c35d6
Move gmlan_alt to TIM12 to fix concurrency issue with IR PWM (#627)
* Moved gmlan_alt to TIM12

* forgot some stuff
2021-02-01 15:53:04 +01:00
Adeeb Shihadeh 8b41ed3b81
Deprecate ESP (#592)
* remove unused wifi tests

* remove that one too

* no bootmode from ESP

* clean that up

* remove two more wifi tests

* remove boardesp and esptool

* esp_gps -> gps

* missed those

* remove esptool refs

* remove esp certs

* no more wifi

* that was old

* cleanup jenkins dockerfile

* fix linter

* remove more wifi refs

* clone panda jungle from github

* no copy

* always default esp to off
2020-08-26 15:37:50 -07:00
robbederks c3b02f3a74
Clock source driver (#580)
* Initial clock source implementation

* fix misra?

* Working now. Still need to fix board detection though

* Always stop pulse

* revert board detection bodge

Co-authored-by: Tici <robbe@comma.ai>
2020-08-17 13:02:41 +02:00
Greg Hogan 390b8bce81
k-line 5 baud init (#565)
* k-line slow init

* k-line slow init LED bit blink

* fix misra violations

* better names for k-line methods

* debug prints match names

* switch to timer

* use TIM4 until I figure out TIM5

* tickle faster

* fix bit bug and add stop bit

* TIM5 working

* USB return after addr sent

* fix l-line reset

* fix misra violations

* blink for the ones instead of the zeros

* k-line 5 baud fault type

* lin check

* use TIM5 or wakeup

* better names
2020-07-10 14:18:24 -07:00
robbederks 387fd681dd
USB enumeration detection fix (#566)
* testing

* Looks fixed now

* Cleanup
2020-07-02 00:23:12 +02:00
Greg Hogan 31f8a0d862
K line fix (#559)
* enable UART RX interrupts

* update debug prints for python3

* improve kline functions and fix checksum

* k-line wake-up conforming to KWP2000 fast init

* fix timing

* toggle k and l line together by default

* k-line wakeup using timer

* k and l were flipped

* fix misra compliance
2020-06-18 11:17:00 -07:00
Adeeb Shihadeh 1e6854eb8f
Fix GM ignition logic (#561) 2020-06-18 11:12:20 -07:00
robbederks d6668fe4ef
Turn on fan if panda is enumerated but not receiving heartbeat (#553)
* fix linter

* Turn on fan if panda is enumerated but not receiving heartbeat

* Upped to 50%
2020-06-11 18:14:41 -07:00
Adeeb 20eb68b179
Add pre-commit hooks (#551)
* add more pre-commit hooks

* revert misra coverage table

* fix coverage table exclusion
2020-06-03 15:08:57 -07:00
Greg Hogan c31b899a58 honda bosch longitudinal safety 2020-05-14 15:44:38 -07:00
robbederks 273e3882fd
When initializing all the CAN busses, make sure the are also cleared (#527)
Thanks to 4vanetten <4vanetten@gmail.com>
2020-05-06 11:39:44 -07:00
robbederks c3336180b6
Fix the CAN init fix (#513) 2020-04-20 17:07:47 -07:00
robbederks ccf13b7afd
No more infinite while loops in CAN init (#499) 2020-04-13 20:32:53 -07:00
Adeeb 8cc3a35700
remove cadillac (#496) 2020-04-13 14:43:46 -07:00
Adeeb bc90b60f97
toyota: use universal gas pressed bit (#488)
* toyota: use universal gas pressed bit

* fix tests
2020-04-09 12:09:34 -07:00
robbederks 74d10ccd38
Fixed possible race condition (#487) 2020-04-07 14:59:19 -07:00
Greg Hogan da8e00f115
TX message guaranteed delivery (#421)
* wait for tx slots before clearing nak

* fix bootstub

* Fixed misra

* Cleanup

* Added bulk write test to test USB NAK on bulk CAN messages

* Added automated bulk tx test

* Fixed linter

* Fixed latency test influence

* Added timeout to python API

* Disabled can write timeout in bulk write test

Co-authored-by: Robbe <robbe.derks@gmail.com>
2020-04-06 16:49:42 -07:00
rbiasini 4368748851
WIP: Toyota brake check. (#459)
* Toyota brake check with safety tests
2020-03-05 00:16:03 -08:00
hivoltag3 769ade0511
Harness orientation designation fixes (#435)
* Fix orientation designations in harness.h

* Fix orientation designations in black.h

* Fix orientation designations in uno.h

* Fix typo
2020-02-17 14:26:52 -08:00
robbederks 186d9dcb3d
Fixed GMLAN interrupts when used in Tesla safety (#428) 2020-01-22 15:34:06 -08:00
rbiasini d301a59d64
WIP: Checksum checks (#403)
* add lag message check for all supported cars
* add checksum and counter checks for toyota and honda
* add rx hook regression tests
2019-12-21 10:25:54 +01:00
Riccardo 268ab9acf3 send can_rx_errs in health 2019-12-19 18:17:09 -08:00
Riccardo df4159c846 Revert "Revert "Register readback on most modules. Still need to convert the other ones (#396)""
This reverts commit 56ec215024.
2019-12-05 14:19:29 -08:00
Riccardo 56ec215024 Revert "Register readback on most modules. Still need to convert the other ones (#396)"
This reverts commit 893e486194.
2019-12-05 13:55:20 -08:00
robbederks 893e486194
Register readback on most modules. Still need to convert the other ones (#396)
* Added an initial working implementation of the register readback and applied it to the LLCAN registers. Also fixed an init bug in CAN.

* Locally disable pylint import error

* Reverted change to CAN-obj->FA1R setting

* Fixed misra compliance

* Changed hash function name

* Fixed CAN filter setting

* Added voltage health test

* Converted ADC to register functions

* Converted clock to use register setters

* Added check to see if fault status is zero after running test

* Converted DAC to use register setters

* Converted fan to use register setters

* Converted gmlan bitbanging to use register setters

* Changed over interrupt driver to use register setters. Also moved some includes and definition places for critical sections

* Fixed build

* Converted LLGPIO to use register setters

* Converted pwm to use register setters

* Fixed cold boot

* Fixed health fault check in automated tests

* Added comment for the future (issue #367)

* Converted RTC driver to use register setters

* Converted SPI to use register setters

* Converted timer driver to use register setters

* Fixed register fault on white pandas and disabled showing of fault for release

* Bump version
2019-12-04 20:42:57 -08:00
Riccardo 1bcc351f29 ignition_can: set it to False after 2s of not seeing CAN msgs 2019-12-03 16:44:55 -08:00
Riccardo 96137f1a8a VW can based ignition not needed. it has ignition line at camera as well. 2019-12-03 16:27:34 -08:00
robbederks 656f99b080
Interrupt refactor (NVIC_SM_1: #334) and Fault handling (#377) (PR #373) 2019-11-27 18:11:21 -08:00
Jason Young 7f9b4a59b6 Fix USB device enumeration on Windows 8.1 and Windows 10 (#393)
* Remove USB 2.0 Extension from BOS descriptor.

* Declutter usb.h of unused code.

Now that I'm more confident the USB 2.0 Extensions are only required
for USB 3.0 devices, and there's less mystery around why the change
worked for us, garbage-collect the commented-out descriptor.
2019-11-27 11:03:37 -08:00
Riccardo 16624811c4 enable CAN transcievers outside the set_safety_mode function, which is not related 2019-11-21 13:42:36 -08:00
rbiasini 1192d934a0
Power saving refactor (#389)
* Exit power saving also for CAN based ingition detection and replace interrup with simple state machine. a bit of delay it's fine

* bug fixes and also CDP set on start

* sorry misra

* move comment

* typo

* remove ignition interrupts

* Power saving state machine should be done by boardd, which also sets safety modes and usb power modes

* typo

* Added usb command for power save state setting

* Added power save enabled packet

* Added power_save_enabled to python lib too
2019-11-21 12:53:00 -08:00
rbiasini 4d1edc068b
skip tx_hook if a message is forwarded (#379) 2019-11-13 23:50:42 -08:00
Robbe b143a1cf9e Fixed Misra complaint 2019-10-31 11:58:36 -07:00
Robbe 606f1d9131 Fixed RTC on non-uno boards, second try. Cannot work when there is no xtal. 2019-10-30 18:30:00 -07:00
rbiasini a12a148d5f Uno (#274)
* Added uno

* Added usb switch support

* Added PWM and IR power functions

* Implemented bootkick

* Added uno as a new hw type

* Bumped version

* Added fan control and tach readout

* WIP: RTC support

* Working RTC

* Fixed python

* Misra compliance

* Added USB control messages for fan/IR power

* Added USB commands + tests for fan & IR control. Fixed bootstub and pedal compilation

* Added IR and fan to power saving mode

* Changed defaults

* Fix safety considering uno

* passing safety now

* Minor UNO tweaks

* Fixed version

* More minor temporary tweaks

* Removed usb load switch from uno

* Added power control for shutting down the fan completely

* Disable IR LEDs by default

* Fixed linter issue

* Linter fix #2
2019-10-25 16:22:42 -07:00
Riccardo 101238c7f6 turned on VW ignition based CAN logic 2019-10-22 17:27:35 -07:00
rbiasini 1102e69652
make ignition logic common for all cars (#303)
* make ignition logic common for all cars

* ignition_can is not a safety thing. move it to can drivers

* bump version

* gm safety passive is deprecated

* move tx 1 on logic into board specific headers.
2019-10-22 15:10:43 -07:00
rbiasini 4b3358c921
patch to be able to switch from EON to PC with a Panda that has EON b… (#290)
* fix switching from EON to PC with a Panda that has EON build and not 12V supply
2019-10-04 14:51:26 -07:00
robbederks 9486836886
UART instability fix with high interrupt load (#283)
* Fixed UART overrun error

* Added stability test scripts

* Refactored UART code. ESP/GPS now uses DMA in circular mode to directly write into the ring buffer, saving a bunch of interrupts and potential race conditions.

* Changed stability test to use amount of bytes instead of amount of non-zero messages, since the ring buffer pointer is only updated on half or full DMA transfer or on line idle (e.g. no more 1 char messages from the gps)

* Increase data limit. It's too low sometimes in normal operation

* Forgot to set write pointer in ring buffer

* Increased test limit even more
2019-10-04 13:28:56 -07:00
rbiasini fac0277169
Misra update (#280)
* Updated cppcheck ref. New rules to be fixed

* changed 2 MACRO names that had more than 31 characters in common

* Fix newly popped 10.4: same type on arithmetic ops

* Fix 18.4: operators should not be applied to an expression

* ensure a NULL pointer isn't dereferenced
2019-09-27 17:18:02 -07:00
robbederks d68508c79a Gpio race condition fix (#263)
* Fixed pedal not initializing

* Interrupt changes

* More changes
2019-08-28 12:53:51 -07:00
rbiasini 59f5813173
Black (#254)
* late usb

* Added type support for black panda

* Added harness presence and orientation detection

* harness relay driving code

* Added intercept support in black panda code. Switched around can0 and can2

* Disable ADCs after orientation detection. Ignition interrupts via harness

* WIP: Hardware abstraction layer + black panda bringup

* Fixed bootstub build

* Fixed bootstub for pedal

* Fixed infinite loops

* Got CAN buses working on white again

* Fixed pedal build and black can interfaces

* Got CAN buses working on black panda

* Finished loopback test for black panda

* Erase all flash sectors on the panda. Increased binary limit. Added extra python functions.

* Fixed python

* Made new code MISRA compliant

* Cleaned up ignition. Fixed build

* Fixed health packet

* Fixed CAN mode on black bug. Changed OBD to switch on ELM mode

* Fixes from Github review

* Fixed MISRA issue for pedal

* Fixed failing gmlan tests

* ELM327 safety: allow diagnostic on all buses

* Cleaned up EON relay code

* delete only 3 sectors instead of 11 to allow a new build to be flashed. Much faster to flash

* Removed CAN only can0 output mode. Does not make sense on black panda due to reversibility issues.

* Added heartbeat logic for EON code on panda. Go to NOOUTPUT if EON does not send a heartbeat for 5 seconds.

* Remove all CAN buses live on EON startup. Shouldn't be necessary to have this separate case

* Formatting

* Added file I forgot to push

* Added heartbeat to testing code to make sure EON tests don't fail. Should probably find a better way to do this though. Heartbeat thread didn't work, concurrent USB connection issues...

* Safety: support black panda for Honda Bosch

* Disable OBD2 if setting to NOOUTPUT mode

* Run safety tests for all hw_types

* Fail test if subtest fails

* fix safety tests
2019-07-23 15:07:06 -07:00
rbiasini 01072bec0b
Misra 11.x: pointer usage. (#250)
* RDLR, RDHR gone from safety

* back at not failing misra safety

* fix safety tests

* did not mean this

* Use get-bytes in pedal too

* Ignore Misra 11.5 and Fix 11.8 violaitons

* Fix 11.3 violations

* Neglect Misra 11.4, fix pointer issue in bootstub and rutn on Werror for pedal builds

* Fix Misra 11.6: can't assign number to void pointer

* Fix test after changing honda_moving name

* for loop is better

* Fix bugs from fbck
2019-07-10 20:56:03 -07:00
rbiasini fd68c26aba
Propagate can_push errors (#249)
* Misra 17.7: counting can_push errors
2019-07-10 17:27:26 -07:00
George Hotz fcb1208e15 fix weird code in USB_ReadPacket 2019-07-09 15:08:25 -07:00
Riccardo f45dd04c67 cppcheck: ignore redundantAssignment and selfAssignment for registers in llcan.h 2019-07-08 17:16:15 -07:00
Riccardo 9ce6311558 Misra 12.1 (operator order) and 10.4 (incompatible essential types) fixes, arised after properly checking UID_BASE config 2019-07-08 15:51:20 -07:00
Riccardo c97d60be64 Removed bad language 2019-07-08 12:05:08 -07:00
rbiasini 85fa3c02ae
Misra 5.5: Identifiers shall be distinct from macro names (#246)
* Misra 5.5: Identifiers shall be distinct from macro names
2019-07-07 22:19:02 -07:00
Riccardo 190d604a0b Pedal: 2 minor fixes to Misra 15.7 (else needed) and 17.7 (non-void output must be used) 2019-07-07 22:07:14 -07:00
rbiasini 1f40d1e6a6
Misra pedal (#245)
* Fix misra on pedal
2019-07-07 16:59:31 -07:00
rbiasini f7bd2c2f38
Misra 10.4: fix last 2 violations (#242) 2019-07-04 02:27:21 -07:00
rbiasini 9be5fdead9
finished misra 17.8 (#241) 2019-07-04 01:37:26 -07:00
rbiasini 3c3aba3dbc
Misra 10.4: Both operands of an operator in which the usual arithmetic conversions are performed shall have the same essential type category (#240)
* Almost done with 10.4, a couple of non-obvious violations remaining
2019-07-04 01:04:58 -07:00
rbiasini 812ace5386
Misra 15_7: if … else if constructs should be terminated with an else clause (#230)
* Fixed all Misra 15_7 violations
2019-07-03 20:48:02 -07:00
rbiasini 1bd9284372
Misra 17.7: the value returned by a function having non-void return shall be used (#237)
* Fixed Misra 17.7 violations except for can_push
2019-07-03 16:01:01 -07:00
Riccardo 7cd80de23a typo 2019-07-03 02:07:02 -07:00
Riccardo 385e33b32c 12.1 regression 2019-07-03 02:04:25 -07:00
Riccardo 955842bae6 WIP 2019-07-03 01:59:27 -07:00
rbiasini ea908cbb75
10_1 violations: Operands shall not be of an inappropriate essential type (#233)
* 10_1 violations
2019-07-02 23:43:06 -07:00
Riccardo ecb9b6c01f Revert "Misra 10 1: Operands shall not be of an inappropriate essential type (#232)"
This reverts commit 8732e4faf0.
2019-06-30 13:43:21 -07:00
rbiasini 8732e4faf0
Misra 10 1: Operands shall not be of an inappropriate essential type (#232)
Fixe Misra 10.1 violations
2019-06-30 15:07:04 -05:00
rbiasini abd841e9be
Fix all 16_4 violations (#229) 2019-06-27 15:50:00 -07:00
Riccardo ec3d0386c2 refactor set_power_save_state 2019-06-26 18:24:21 -07:00
Riccardo c27e7848f3 fix conflicts 2019-06-26 16:17:30 -07:00
rbiasini 4886b6b984
Misra 12.1: The precedence of operators within expressions should be made explicit (#227)
* Fixed all misra 12.1 violations
2019-06-26 16:16:35 -07:00
Riccardo 3fd6b337f9 ops, bug 2019-06-26 15:59:32 -07:00
Riccardo e3c5e7da8c Fix Misra 15_5 violations 2019-06-26 15:52:34 -07:00
Riccardo 52838e1c2a WIP 2019-06-26 14:47:06 -07:00
rbiasini 73ae4f6acf
Misra 14.4: The controlling expression of an if statement and the controlling expression of an iteration‑statement shall have essentially Boolean type (#225)
* Fixed 14.4 Misra violations
2019-06-26 13:13:16 -07:00
Riccardo 8a45958dfe Misra 17.7: puts function should have void output 2019-06-26 13:05:31 -07:00
Riccardo 97a11115bb hardwired input param is now a boolean 2019-06-26 12:18:06 -07:00
George Hotz 0e67890ac7
Merge pull request #224 from commaai/misra_13_3
Fixed Misra 13.3: A full expression containing an increment (++) or d…
2019-06-26 11:51:50 -07:00
Riccardo e41b5a4c4f Fixed Misra 13.3: A full expression containing an increment (++) or decrement (--) operator should have no other potential side effects other than that caused by the increment or decrement operator 2019-06-24 19:23:53 -07:00
Riccardo 541f8beee3 Fix bad bug 2019-06-24 19:16:53 -07:00
Riccardo 6a9ae3b7c3 The comma operator should not be used 2019-06-24 18:12:23 -07:00
Riccardo 5e3458df72 Fix Misra 20.7: Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses 2019-06-24 17:57:18 -07:00
Riccardo f03c3a9fb6 Fix Misra 8.11: When an array with external linkage is declared, its size should be explicitly specified 2019-06-24 17:10:14 -07:00
Riccardo 83eccb0b5c Fix obvious 10.1 Misra violations: Operands shall not be of an inappropriate essential type 2019-06-24 16:43:11 -07:00
rbiasini e2d781380a
Strict compiler (#222)
have no Wall warnings from the strict compiler and enforcing it in the regression test.
2019-06-24 10:25:30 -07:00
rbiasini a3f65d66e9
capitalize MIN and MAX macros (#220) 2019-06-17 13:48:14 -07:00
George Hotz 00ebc16936 track can overflows 2019-06-14 13:33:30 -07:00
George Hotz 96dcfb18d4 pull in uart changes from harness branch 2019-06-14 13:26:01 -07:00
George Hotz 59eaec5dd6 add volatiles to the ring buffer pointers 2019-06-14 13:22:33 -07:00
George Hotz b35285ba7d can push failed only with debug 2019-06-14 13:19:30 -07:00
George Hotz f9d2e8876b can does not sleep 2019-06-14 12:14:21 -07:00
George Hotz dfce5f6e36 minor fixes, and no more autobaud 2019-05-23 12:39:54 -07:00
George Hotz a74f001ba7 refactor power savings to depend on car started bit 2019-05-23 12:39:54 -07:00
George Hotz 386d5dfdf2 can wake from sleep is removed, didn't work in the first place 2019-05-23 12:39:54 -07:00
George Hotz 0a9f8eb581 remove many ifdef PANDA 2019-05-23 12:39:54 -07:00
George Hotz 506900576b remove nested includes and include guards 2019-05-23 12:39:54 -07:00
George Hotz 3810452a02 WTF WHY WAS THIS SHIT PUT EVERYWHERE 2019-05-23 12:39:54 -07:00
George Hotz 3cf8db9351 can.h always has CAN3 2019-05-23 12:39:22 -07:00
George Hotz 6255097a10 new style power savings 2019-05-23 12:39:22 -07:00
George Hotz 2c1e5f6325 the refactor continues 2019-05-23 12:39:22 -07:00
George Hotz 605bb27bce fix bootstub build 2019-05-23 12:39:22 -07:00
George Hotz f32f0395fd factor out clear_send 2019-05-23 12:39:22 -07:00
George Hotz 8221927215 this is probably broken. refactor out llcan and clock 2019-05-23 12:39:22 -07:00
rbiasini 1aa00c95ee
Misra c2012 (#192)
* Started making panda misra compliant: this fixes some of 12.1 warnings

* Also added a regression test for strict compiler warning
2019-05-20 22:13:45 -07:00
George Hotz 047bd725e0 fix tests and remove rev b support 2019-05-19 09:12:26 -07:00
Nigel Armstrong f8ab74a1cc L-line relay (#166)
* Initial version of L-Line Relay

* lline relay fix build, add to health

* Add lline relay to safety

* Lline relay fix build

* Fix tests

* Add lline safety init. Dont fwd with relay closed

* Turn on relay with CAN

* relay hook

* More reliable lline relay

* Longer LLine timeout

* Only turn on wifi if not eon

* Dont disable ESP in early

* Allow CAN to be turned off

 - CAN is turned off via USB.
 - CAN is turned on when either try to transmit or can is received
 - If only transmit is asleep, all messages should send okay
 - If receive is alseep, will miss first message while waking up
 - Sometimes will report error on second message while CAN perif wakes up
 - Saves 130mW!

* Power Saver Mode

 - Gray Panda power consumption 650mw -> 325mW
 - Turns off CAN, GMLAN, LIN, GPS when no activity for 10s
 - No acitvity is no CAN send, CAN Recv, Write to GPS

* Fix power_saving to better turn off can

 - On some cars when the can is turned off, it triggers a wakeup.
 Delaying the automatic wakeup seems to fix this

* Don't save power in pedal

* Fix relay clicking on startup

* Fix duplicate include

* consistent relay setting

* relay_status can be added when needed, as it's started_alt was consumed in other places

* need to skip forwarding only if relay control is claimed

* unneded change

* make lline_relay.h not depending on can.h

* less spaghetti I guess

* less lines

* reset pedal changes

* no unused input

* update version
2019-04-11 21:03:15 -07:00
Riccardo f383eee968 Power saving: wake on RX and don't print durint IRQ 2019-04-08 19:21:37 -07:00
Nigel Armstrong 4276c380e6
Additional Power saving (#170)
* Only turn on wifi if not eon

* Dont disable ESP in early

* Allow CAN to be turned off

 - CAN is turned off via timeout
 - CAN is turned on when either try to transmit or can is received
 - If only transmit is asleep, all messages should send okay
 - If receive is alseep, will miss first message while waking up
 - Sometimes will report error on second message while CAN perif wakes up
 - Saves 130mW!

* Power Saver Mode

 - Gray Panda power consumption 650mw -> 325mW
 - Turns off CAN, GMLAN, LIN, GPS when no activity for 10s
 - No acitvity is no CAN send, CAN Recv, Write to GPS

* Fix power_saving to better turn off can

 - On some cars when the can is turned off, it triggers a wakeup.
 Delaying the automatic wakeup seems to fix this

* Don't save power in pedal

* Cleanup power saving
2019-04-01 22:45:00 -07:00
Riccardo 7927cabcc5 compiling the use of bitbang_gmlan only for panda 2018-08-20 19:28:05 -07:00
Adam Urban aafbe05815 GMLAN GPIO Rebase 2018-08-02 12:39:53 -04:00
George Hotz 37df290a13 rename to gmlan_alt 2018-08-02 08:58:07 -07:00
George Hotz 8efa389745 detect ack 2018-06-15 16:54:01 -07:00
George Hotz f5fab4b42a nicer err 2018-06-15 16:46:10 -07:00
George Hotz ad4d4231d2 add gmlan fail count 2018-06-15 16:37:04 -07:00
George Hotz 998f7c0103 oops, set recessive 2018-06-15 16:23:22 -07:00
George Hotz 80051bea09 autoretry on chime 2018-06-15 16:21:53 -07:00
George Hotz e21447765e use timer for can bitbanging 2018-06-11 10:06:10 -07:00
George Hotz cb927337da minor bitbang refactor 2018-06-11 09:06:15 -07:00
George Hotz ed2920cf8a support extended addressing in canbitbang 2018-06-11 09:02:11 -07:00
George Hotz 36df0996c5 move speed 2018-06-10 23:54:06 -07:00
George Hotz 7edc88e54b put that back 2018-06-10 23:50:50 -07:00
George Hotz fa66e4b785 Revert "handle rollover"
This reverts commit 2ce3a26ab9.
2018-06-10 23:50:32 -07:00
George Hotz 2ce3a26ab9 handle rollover 2018-06-10 23:47:44 -07:00
George Hotz 223a1fb68f cleanin it up 2018-06-10 23:40:58 -07:00
George Hotz d917386bf8 bitbanging works 2018-06-10 23:29:20 -07:00
George Hotz 74af4417db can crc 2018-06-10 23:11:29 -07:00
George Hotz 932d727867 bit stuffing support 2018-06-10 22:52:53 -07:00
George Hotz be22522714 bros ok match bros 2018-06-10 16:48:53 -07:00
George Hotz a577583530 working on gmbitbang 2018-06-10 16:23:54 -07:00
George Hotz 63ca46bc24 modify before we forward 2018-06-06 13:46:12 -07:00
George Hotz 988fbf5e32 disable autobaud by default 2018-04-26 09:38:52 -07:00
George Hotz fec975889d gate that with debug 2018-04-11 21:55:47 -07:00
George Hotz 5516ebf3ce one more ifdef 2018-04-11 21:14:37 -07:00
Chris Vickery 711fd112b7 Enable compiler optimizations, fix things it breaks 2018-04-11 16:15:38 -07:00
Greg Hogan 95919b932d Bounty: panda high quality CAN autobaud (#96)
* CAN auto-baud

* Disable autobaud when exiting silent mode
2018-04-11 14:31:48 -07:00
Chris Vickery 6dbd8c972b
Implement WebUSB and upgrade WinUSB to 2.0 (#107)
* Implement webusb and winusb 2.0 specs

* Add missing constants

* Refactor string system, add support for USB2.1

* Uncapitalize the panda

* Add USB 2.0 extension descriptor and device qualifier getter

* Sleep during reconnect process to be more reliable

* Disable compiler optimizations because they break SPI coms
2018-04-11 10:08:56 -07:00
gregjhogan 5c7ef9ee43 added bosch safety hooks and forwarding 2018-03-05 18:17:30 -06:00
George Hotz bd09883eee comma pedal is building 2018-02-27 20:06:47 -08:00
George Hotz eece37d7ac only the panda has gmlan 2018-02-25 14:51:24 -08:00
Greg Hogan 85807735f2 fix sending WinUSB Extended Properties Feature Descriptor 2018-02-24 20:33:52 -06:00
gregjhogan 0d3806000c auto-install WinUSB device driver 2018-02-10 23:09:02 -06:00
George Hotz fd68f86cad smallr 2018-01-29 02:03:46 -08:00
George Hotz be99ffca78 ok that doesn't hurt i think 2018-01-29 01:42:56 -08:00
George Hotz a9f6bf0595 this 2018-01-29 01:32:37 -08:00
George Hotz 8b7e8495db working now 2018-01-29 00:59:48 -08:00
George Hotz 7fa4808cf8 froze up, maybe thats the fix 2018-01-28 11:20:28 -08:00
George Hotz 1465aa478f ok, it's fixed 2018-01-28 04:56:33 -08:00
George Hotz 915cd84f33 ugh, ok, need that 2018-01-28 04:32:06 -08:00
George Hotz 37c52630a0 big fifo 2018-01-28 03:54:47 -08:00
George Hotz 497f069e49 dma is all critical, no interrupts 2018-01-28 03:20:19 -08:00
George Hotz 7c34afe533 minor change 2018-01-28 03:18:07 -08:00
George Hotz 743d244513 high baud rate works 2018-01-28 02:10:52 -08:00
George Hotz fc81fc1118 uart dma in progress 2018-01-25 23:51:52 -08:00
George Hotz aa0cfadb6b fix UART hang 2018-01-08 14:53:38 -08:00
George Hotz b290a06cc7 fix regression in can_silent 2017-09-04 23:51:42 -07:00
Firmware Batman 8b6c441d1d update tests and gpio usage 2017-08-29 10:46:08 -07:00
George Hotz 72a92f5610 spi flasher can power the panda 2017-08-25 11:52:27 -07:00
George Hotz 6886be926d add ABOM, fix bug in tests 2017-08-24 17:52:54 -07:00
George Hotz 5db091d7d2 clean up LEDs 2017-08-23 12:36:03 -07:00
Firmware Batman ea4e92944c blue led is used for can receiving now 2017-08-22 13:36:20 -07:00
Firmware Batman 1ea061a713 test 5 doesn't fail anymore 2017-08-21 16:40:38 -07:00
Firmware Batman ddbcd570bc fixup can silent on elm327 mode 2017-08-21 14:28:33 -07:00
Jessy Diamond Exum 5ca692e8d3 ELM327: incoming messages cleared before commands to prevent congestion. 2017-08-19 00:31:11 -07:00
Firmware Batman 37b3327c28 test 5 still SPI receive failed sometimes 2017-08-13 12:31:03 +01:00
Firmware Batman f832f34413 fix GMLAN bad toggle issue 2017-08-13 01:28:23 +01:00
Firmware Batman 798f942346 fix legacy build issue, add build test, fix warnings 2017-08-01 03:00:53 +02:00
Firmware Batman 1066c2d1b0 fixed SPI, so much subtlety 2017-07-29 19:19:43 -07:00
Firmware Batman 0d11b01cce debugging SPI 2017-07-29 19:04:58 -07:00
Firmware Batman 6b9ba40089 remove some dumb prints 2017-07-29 18:16:08 -07:00
Firmware Batman 0ee6e4741c move llgpio to drivers 2017-07-29 17:53:39 -07:00
Firmware Batman 9ed4516318 move dac to drivers, add sleep 2017-07-29 17:49:53 -07:00
Firmware Batman d5e3805671 add uart to spi flasher 2017-07-27 15:54:55 -07:00
Firmware Batman 9a1c1b692f write soft flasher 2017-07-24 15:16:22 -07:00
Firmware Batman 0a5a8ab5ec refactor SPI and make flasher reliable 2017-07-24 12:31:47 -07:00
Firmware Batman d9fc3b372c refactoring 2017-07-21 11:48:03 -07:00
Firmware Batman 9783a2ab13 refactor drivers into drivers.h 2017-07-21 11:30:07 -07:00
Firmware Batman 6b722c43e6 fix debugging print corruption 2017-07-21 00:07:34 -07:00
Firmware Batman 07dac7e75d move out the uart ring process 2017-07-20 23:54:45 -07:00
Firmware Batman 2dd6c3f90c big refactor to drivers 2017-07-20 23:45:48 -07:00