Commit Graph

86 Commits

Author SHA1 Message Date
Adeeb Shihadeh a1d699b87d
SOM boot recovery (#1712)
* reset

* simpler

* only once per panda boot

* cleanup

* also check serial
2023-11-09 18:01:46 -08:00
Adeeb Shihadeh d2ea9ad293
refactor bootkick (#1690)
* bootkick refactor + reset

* simplify

* revert reset stuff

* cleanup

---------

Co-authored-by: Bruce Wayne <batman@comma.ai>
2023-11-08 22:54:55 -08:00
Igor Biletskyy 83c000e1a4
panda: disable transceivers while doing CAN multiplexing (#1556)
init
2023-08-07 12:24:16 -07:00
Adeeb Shihadeh c66b98b2a6
finish esp/gps removal (#1559) 2023-08-06 12:29:54 -07:00
Adeeb Shihadeh 6b9b448259
log device boot time (#1503)
* log device boot time

* misra

* only log real boots

* set gpio

* true

* initial

* log bootkick

* fix RPv2

---------

Co-authored-by: Comma Device <device@comma.ai>
Co-authored-by: Igor Biletksyy <bs@privacy.im>
2023-07-12 20:34:46 -07:00
Robbe Derks 2c937656cf
Continuous harness detection (#1402)
* read in mV and make threshold board-dependent

* refactor and add SBU voltages to health

* refactor relay driving

* more refactoring and readout lock

* avoid race condition

* fix misra

* continuous detection

* 1Hz is fine

* another race condition

* use harness detection to trigger bootkick

* update orientation detection test

* more in-depth harness tests

* fix ignition

* fix

* raise threshold
2023-05-08 13:30:23 +02:00
Robbe Derks fea1feb598
ADC cleanup (#1401)
* cleanup function names

* cleanup voltage reading

* define constant

* fix misra

* remove comments
2023-05-04 13:22:01 +02:00
Robbe Derks 237ffedcb3
Dos fan fix (#1335)
* hitl fan test

* enable cooldown on dos as well

* small cleanup

* get expected RPM from panda class

* fix

* overshoot test

* fix max RPM getting

* fix percentage

* revert cooldown fix

* add cooldown for dos fan as well

* remove feedforward from the fan controller to eliminate overshoot

* update clip

* cleanup

* add that back

---------

Co-authored-by: Comma Device <device@comma.ai>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2023-04-18 14:15:06 -07:00
Adeeb Shihadeh d70fa4e120
tres: fix fan spin on startup (#1297)
* tres: fix fan spin on startup

* new init
2023-03-21 11:19:12 -07:00
Robbe Derks c0aea3273a
Tres: fan cooldown + no stall recovery (#1287)
* add fan cooldown

* refactor to be inside the fan driver

* fix rebase

---------

Co-authored-by: Comma Device <device@comma.ai>
2023-03-16 14:15:43 +01:00
Igor Biletskyy 75792fb255
Fix different ADC scales (#1288)
* different ADC scales

* add HITL

* we had it, remove
2023-03-14 14:49:39 -07:00
Adeeb Shihadeh 2de7140117
SPI support in bootstub (#1227)
* always build spi

* no dos for now

* spi gpio init

* detect bootstub

* cleanup

* revert that

* move fx stuff

* fix linter

* set erase timeout

* fix types

* cleanup

---------

Co-authored-by: Comma Device <device@comma.ai>
2023-03-07 14:55:15 -08:00
Robbe Derks d2c2d5f926
Fix short pulse of relay drive after reset (#1244)
fix order of gpio init

Co-authored-by: Comma Device <device@comma.ai>
2023-02-20 13:47:35 +01:00
Robbe Derks 796d771912
Enable control over the fan on C3 while still in the bootloader (#720)
* GPIO control over the fan from ABL

* fixes

* leave this todo

---------

Co-authored-by: Comma Device <device@comma.ai>
2023-02-08 16:01:14 +01:00
Robbe Derks 33e576214d
Tres: enable IR power irregardless of fan state (#1225)
* enable IR power irregardless of fan

* fix misra

Co-authored-by: Comma Device <device@comma.ai>
2023-01-26 18:06:02 +01:00
Igor Biletksyy 9b23622e91 RP: pull USB_EN up 2023-01-23 17:23:33 -08:00
Igor Biletskyy 4750449f3c
RP: obsolete USB load switch (#1219) 2023-01-19 17:07:50 -08:00
Adeeb Shihadeh 3743b2de51
chiplet: move OBD_SBU_RELAY2 to PA3 (#1217)
Co-authored-by: Igor Biletksyy <bs@privacy.im>
2023-01-18 16:31:51 -08:00
Adeeb Shihadeh 60cf9e9d22 Revert "chiplet: move OBD_SBU_RELAY2 to PA3"
This reverts commit a0bd6bb21a.
2023-01-18 14:32:25 -08:00
Igor Biletksyy a0bd6bb21a chiplet: move OBD_SBU_RELAY2 to PA3 2023-01-17 16:27:00 -08:00
Robbe Derks 6ba9afc33e
H7 clock source (#1194)
it's literally the same everything

Co-authored-by: Comma Device <device@comma.ai>
2022-12-14 16:12:09 +01:00
Robbe Derks 1d732d4747
F4: Cleanup clock src, second try (#1193)
* F4: cleanup clock source

* little more

* void

* restore the timer setup

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
Co-authored-by: Comma Device <device@comma.ai>
2022-12-14 15:30:04 +01:00
Robbe Derks d1d1f8a22d
Fake siren (#1192)
* DAC POC

* change freq

* some cleanup

* wip: cleaning up and trying to use DMA

* no clue why this doesn't work

* this works

* wip multi-master i2c for fake siren

* cleanup and some more i2c stuff

* seems more stable

* retry disabling and cleanup force siren

* fix misra violations

* not needed

* messed up rebase

Co-authored-by: Comma Device <device@comma.ai>
2022-12-14 11:25:54 +01:00
Adeeb Shihadeh 616450c525
tres bootkick (#1183)
* tres: bootkick

* replace usb enum

Co-authored-by: Comma Device <device@comma.ai>
2022-12-01 20:04:30 -08:00
Adeeb Shihadeh e6f62a62aa
rename puts to avoid conflict with stdio.h (#1174)
* rename puts to avoid conflict with stdio.h

* better name
2022-11-29 22:55:10 -08:00
Adeeb Shihadeh c075050d5d Revert "F4: cleanup clock source (#1160)"
This reverts commit f0f67ccf85.
2022-11-21 20:31:01 -08:00
Adeeb Shihadeh 15a945d303
tres: IR LEDs (#1163) 2022-11-17 21:23:35 -08:00
Adeeb Shihadeh ae66bbcaa8
tres fan (#1162)
* fan on

* little cleanup

* move to main
2022-11-17 21:02:37 -08:00
Robbe Derks 5aa5f855e4
setup UART for SOM debugging (#1151)
* cleanup external debug serial

* wip: bring up uart7

* more wip

* this does something

* this works

* increase fifo size

* fix misra

* cleanup

* fix misra again

* add SOM debug enum

* reduce SOM buffer on F4

Co-authored-by: Comma Device <device@comma.ai>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-11-17 17:59:11 +01:00
Adeeb Shihadeh f0f67ccf85
F4: cleanup clock source (#1160)
* F4: cleanup clock source

* little more

* void
2022-11-17 07:49:26 -08:00
Adeeb Shihadeh e7131fcee0
H7 SPI comms (#1158)
* getting health packets

* start cleanup

* pull state machine out

* cleanup
2022-11-14 13:52:52 -08:00
Adeeb Shihadeh c75c276301
add has_spi board property (#1153)
* always spi for h7

* disable for now
2022-11-13 19:57:20 -08:00
Igor Biletskyy a9e0357883
H7: enable USB LDO and fix RGB LED gpios (#1148)
* enable USB LDO

* open drain for RGB LED gpios

* naming

* comment
2022-11-10 19:29:44 -08:00
Robbe Derks d574f4aebc
STM32F4: SPI communications (#998)
* cleanup is_enumerated, rename comms and init spi

* big comms refactor, building now

* misra fixes

* more fixes

* misra try 3

* cleanup

* this belongs in a separate PR

* remove unneccesary file

* revert llspi changes

* llspi misra fix

* enable SPI on F4 and setup gpio

* duh

* wip: spi comms

* more spi wip

* dynamic sector erasing

* Revert "dynamic sector erasing"

This reverts commit fce1215a2e.

* more sectors to be erased

* debugging

* woah, this works

* cleanup on the panda side

* add sync and checksum checks, and fix recovery on errors

* this seems relatively stable

* add retrying

* this is stabler

* some endianness and endpoint fixes

* builds

* revert that

* add that back

* checksum start

* start splitting up driver

* spi behind flag

* cleanup test

* bump up timeout

Co-authored-by: Comma Device <device@comma.ai>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-11-09 18:46:20 -08:00
Adeeb Shihadeh 49e2034098
tres (#1130)
* tres

* pull out chiplet

* add to python lib
2022-11-03 16:34:18 -07:00
Igor Biletskyy fd226de0a4
board struct: add has_canfd (#1072)
* add

* gate this

* and this

* forgot white
2022-09-16 21:56:48 -07:00
Igor Biletskyy ac21dbe551
H7: add chiplet panda support (RPv2) (#1049)
* temporarily disable Jenkins

* firmware

* python lib

* tests

* ..

* usb load switch to high

* it is still red

* usb power mode remove

* Revert "temporarily disable Jenkins"

This reverts commit a911cfad8d.

* forgot this

* common periph

* change name

* board tick

* add V2 to CI

* update known bootstub
2022-09-09 20:13:06 -07:00
Comma Device c4c9744f2a fix dos siren 2022-09-07 21:43:52 -07:00
Adeeb Shihadeh 13d64d4cc3
USB power mode + bootkick cleanup (#1051)
* remove tick

* remove more

* delete more

* board tick

* update health

* dos bootkicking

* cleanup
2022-08-31 20:46:07 -07:00
Robbe Derks ba8772123f
Simple integrating fan controller (#1022)
* fast rpm measurement

* fix indentation

* this seems stable

* clip fan integral

* fix misra

* add fan power to health

* board-specific max rpm

* refactor fan enable

* cleanup

* stall detection and reset

Co-authored-by: Comma Device <device@comma.ai>
2022-08-17 20:43:49 -07:00
Robbe Derks ad4f69cd18
Dos: PWM based camera signals (#912)
* switch over to PWM based camera signals

* update comment

Co-authored-by: Comma Device <device@comma.ai>
Co-authored-by: Willem Melching <willem.melching@gmail.com>
2022-04-06 17:19:42 -07:00
Igor Biletskyy 14d7310784
Enable RTC for all pandas (#849)
* rename has_rtc and add rtc_init for panda boards

* change rtc_init
2022-02-09 15:36:37 -08:00
Robbe Derks 6d43135f36
BP: fix gps enable pin (#831) 2022-01-20 16:07:05 -08:00
Igor Biletskyy 04d2fbbe64
Cleanup unused functions in boards configs (#701)
Move unused functions to separate file unused_funcs.h to make board setup files cleaner
2021-08-03 10:55:10 -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 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 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
Adeeb Shihadeh 78c24982a9
Remove non-EON panda build (#671)
* Remove non-EON panda build

* missed that

* fixup readme

* more readme

* simplify ci

* add USB command to disable heartbeat checks in debug mode

* clean that up too

* more cleanup

* fix path

* disable heartbeat in set_safety_mode

* more red

* remove one more EON ref
2021-06-21 13:54:09 -07:00
Robbe Derks 54b12251dc fix typo 2021-05-03 16:17:26 +02:00
robbederks 0ae2be95a1
fix dos usb power mode (#628) 2021-02-22 16:12:48 +01:00