Commit Graph

242 Commits (22556b1ddfc0e4b5c71406ce78668f99ebed4c67)

Author SHA1 Message Date
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
robbederks 933c757705
Fix RTC on non-uno boards (#311)
* Fan and IR at 0 when in power savings mode

* Initialise RTC for all boards, not only uno. Fixes hang while getting time from non-initialized RTCs
2019-10-30 18:11:30 -07:00
robbederks 6cccf969ab
Fan and IR at 0 when in power savings mode (#309) 2019-10-29 12:36:47 -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 e2e2be92c9 add safety mode to health packet 2019-10-24 15:33:27 -07:00
Riccardo a0d8d5dae7 fix misra 5.3: check_ignition is intended as check_started and can't be used twice 2019-10-22 16:12:18 -07:00
Riccardo ea636de615 made check_ignition function to both look at ignition_line and ignition_can 2019-10-22 15:27:55 -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
robbederks 0812362b52 GPS UART fix until boardd is refactored (#294)
* Temporary GPS fix

* spaces
2019-10-08 19:41:10 -07:00
robbederks 0894b28f1e Fixed USB power mode on black (#291)
* Fixed USB power mode on black

* bump version
2019-10-05 20:34:19 -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 a95c44a717
Made setting of NOOUTPUT on no heartbeat more efficient (#287)
* Made setting of NOOUTPUT on no heartbeat more efficient

* Stupid mistake

* Fixed hardcoded safety mode
2019-10-04 13:30:00 -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 78ef4a6ebc
Stop charge (#284)
* CDP by default in EON build on white panda

* Cleaned up power mode setting

* send usb power mode in health

* cleaner CDP setting on ignition

* bump panda
2019-10-02 11:48:40 -07:00
Riccardo f4787ec5a2 Revert "turn on CDP when ignition switches on (#281)"
This reverts commit 8c1df559f7.
2019-10-01 17:01:14 -07:00
rbiasini 8c1df559f7
turn on CDP when ignition switches on (#281) 2019-09-30 21:48:30 -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
George Hotz 3397b1527e only allow bootloader entry on debug builds 2019-09-04 16:05:50 -07:00
robbederks 6f532c6d51 Black panda Jenkins (#256)
* Jenkins test refactor and black panda addition

* Added HW types needed by previous commit

* Fixed ignition interrupts when not on EON build

* Added functions for load switches

* More test scripts for black panda

* Added NONE power mode to the code

* Fixed race condition when setting GPIO pins was interrupted.

* Added relay test script

* Fixed flashing with critical sections and GPS load switch

* Fixing critical depth after reboot

* Made the loopback test asserting

* Made critical depth a local variable to avoid race conditions

* Added GPS to power savings mode

* Fixed DFU mode on white panda and bumped version

* Fixed PEDAL_USB compilation error

* Fixed misra compliance of new critical depth code

* Cleaned up heartbeat logic in the testing code. Re-added ALL_CAN_BUT_MAIN_SILENT. Bumped version. Improved critical section code.

* Fixed DFU flashing (once again)

* Fixed VERSION

* Added relay endurance test

* Changed to alloutput on ELM mode for fingerprinting.

* Fixed minor remarks
2019-08-28 12:57:42 -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
Robbe 519e39e494 Changed heartbeat timeout to be 2 seconds on no ignition 2019-07-24 14:36:01 -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
Riccardo 0b19206360 Misra 17.7: The value returned by a function having non-void return type shall be used. We should hang on initial failed safety_set_mode 2019-07-08 20:08:53 -07:00
rbiasini 23e3684d70
Cppcheck unused functions (#247)
* Skip cppcheck on unused functions that are consumed in large headers we can't pass to cppcheck
2019-07-08 15:13:52 -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
Riccardo f2a3a177b3 Misra 15_7: fix what seems to be a false positive of cppcheck 2019-07-03 20:53:00 -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
rbiasini fa33038055
Fix Misra 5.3: An identifier declared in an inner scope shall not hide an identifier declared in an outer scope (#236)
* Fix Misra 5.3
2019-07-02 22:39:00 -07:00
rbiasini ae816c104a
Fix 15_6 violations (#231) 2019-06-28 13:46:57 -07: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 e3c5e7da8c Fix Misra 15_5 violations 2019-06-26 15:52:34 -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 97a11115bb hardwired input param is now a boolean 2019-06-26 12:18:06 -07:00
George Hotz fd96c02215 disable SPI on the EON variant 2019-06-26 12:01:57 -07:00
Riccardo d1e6bd86b1 Fix Misra 16.6 and 16.7 by using a different COMPILE_TIME_ASSERT 2019-06-24 17:50:01 -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 d33bb4117c oops, have to call that now 2019-06-14 13:28:15 -07:00
rbiasini 380b7c75c5
Long allowed (#202)
* added long_controls_allowed to cars safety code. long_controls_allowed init to 1 for now, so safety tests pass
2019-06-05 14:00:07 -07:00
George Hotz a06af9f2aa always LIVE on EON 2019-05-23 12:39:54 -07:00
George Hotz dc5979f66a LIVE on EON 2019-05-23 12:39:54 -07:00
George Hotz 0b26645b12 no EON by default 2019-05-23 12:39:54 -07:00
George Hotz 1906a4b769 panda now draws below 100mw in power save mode 2019-05-23 12:39:54 -07:00
George Hotz e70b44aa57 move that to main.c 2019-05-23 12:39:54 -07:00
George Hotz dfce5f6e36 minor fixes, and no more autobaud 2019-05-23 12:39:54 -07:00
George Hotz 96a7e3196f a soothing blue in power save mode 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 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 58ec63b31f oops, backward 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 1d2467756e refactor #ifdef EON 2019-05-23 12:39:22 -07:00
George Hotz 4af036e93a fixup puts 2019-05-23 12:39:22 -07:00
George Hotz 2c1e5f6325 the refactor continues 2019-05-23 12:39:22 -07:00
George Hotz 7517f2c174 remove ifdef PANDA from main 2019-05-23 12:39:22 -07:00
George Hotz aec40ae91c remove fan, as it was only for NEO board 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
Riccardo Biasini 3b351b7018 Minor fix to current type 2019-04-23 13:53:43 -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
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
Nigel Armstrong 20c76ad592 Power Saving (#169)
* Only turn on wifi if not eon

* Make sure esp is disabled on eon

* Dont disable ESP in early
2019-03-13 20:58:00 -07:00
rbiasini a6193a8285
Dcp remove (#168)
* No DCP charge mode when building from EON
2019-03-11 23:41:40 -07:00
rbiasini 1218d09edb
Cadillac ascm proxy (#155)
* added safety_ascm

* better using one funciton

* GM_ASCM safety mode by default

* fixced ign bug and passing everything for now

* blocking 0x152-0x154 and reforwarding 0x153

* gotta fwd 152 as well on CH bus

* adding braking message block

* blocking gas cmd as well

* allow cadillac supercruise to pass through

* no more hardcoded ascm safety mode
2019-02-05 18:37:02 -08:00
George Hotz 49ed9bc1ec Update CLICKS for longer bootup time of EONS and avoid unwanted fast charge mode
updated panda version
2018-12-16 18:23:39 -07:00
Adam Urban f9a46e3646 Match safety order from master
This will cause a merge conflict with the tesla branch.
2018-08-02 14:13:57 -04:00
Adam Urban aafbe05815 GMLAN GPIO Rebase 2018-08-02 12:39:53 -04:00
George Hotz 2253dd3c48 fix volt ign detect 2018-04-13 20:11:01 +00:00
George Hotz af9af6d13e
Merge pull request #110 from Jamezz/volt
Add safety hook for ignition state for car platforms that don't support GPIO pin
2018-04-12 12:00:26 -07:00
George Hotz 938d474723 fpu enable 2018-04-11 19:52:42 -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
Jamezz a0cc51af15 Undo safety mode override
We don't need to force safety to GM for testing, fingerprinting should work.
2018-04-11 12:54:16 -07:00
Thomas Helms 4fc83a5f5c Add safety hook for ignition and have GM use gear selector to determine ignition 2018-04-10 17:55:55 -07:00
George Hotz b42db6dc08
Merge pull request #82 from commaai/uart_dma
Uart dma
2018-01-29 13:31:49 -08:00
George Hotz fd053760d9 comment out debug 2018-01-28 03:58:57 -08:00
George Hotz 743d244513 high baud rate works 2018-01-28 02:10:52 -08:00
George Hotz 4410a59d92 add safety param support 2018-01-25 23:57:04 -08:00
George Hotz fc81fc1118 uart dma in progress 2018-01-25 23:51:52 -08:00
George Hotz 65fb2b26cb grey panda query, 1.0.5 2018-01-23 20:10:23 -08:00
George Hotz f415c9a303 grey panda detection 2018-01-23 20:04:41 -08:00
George Hotz 3fc38f4831 set bootmode with power 2018-01-20 11:23:55 -08:00
George Hotz e1dd404c9b add microsecond timer support 2017-10-26 18:44:25 -07:00
Firmware Batman e7fbea7e54 support setting DCP mode 2017-10-15 17:10:04 -07:00
George Hotz 92a1c773e7 blink 4x faster when in DCP mode 2017-09-28 21:57:54 -07:00
Jessy Diamond Exum 1bc069d9be board: standardized how health voltage is reported between revisions. 2017-09-16 18:28:20 -07:00
George Hotz b290a06cc7 fix regression in can_silent 2017-09-04 23:51:42 -07:00
George Hotz 1e48d086f5 switch panda to use not gmlan for started detection 2017-08-28 13:15:47 -07:00
George Hotz 5db091d7d2 clean up LEDs 2017-08-23 12:36:03 -07:00
George Hotz 0b7f10abe5 add release flasher 2017-08-23 10:43:40 -07:00
George Hotz bb4ec716b1 0xe6 command is only for rev c 2017-08-23 10:01:02 -07:00
Vehicle Researcher 63d34bc120 add support for setting usb power 2017-08-23 09:28:52 -07:00