Commit Graph

41 Commits

Author SHA1 Message Date
Adeeb Shihadeh a727cecdb8
remove unused deepsleep stuff (#1914) 2024-03-22 14:48:49 -07:00
Adeeb Shihadeh 895a7001c9
Rename stm32fx/ -> stm32f4/ (#1898)
* Rename stm32fx/ -> stm32f4/

* jungle too
2024-03-11 16:18:56 -07:00
Adeeb Shihadeh c076a9f2f6
remove pedal fw (#1872)
* remove pedal fw

* little more

* one more

* and tests

* rest of it

* little more

* fix linter

* more fix
2024-02-16 22:58:01 -08:00
Robbe Derks 3cd0023bc1
cuatro power readout (#1869)
* refactor voltage / current reading

* fix bug and add readout to cuatro

* fix misra?

* just suppress then

---------

Co-authored-by: Comma Device <device@comma.ai>
2024-02-15 13:49:06 -08:00
Adeeb Shihadeh d7120be904
panda jungle (#1547)
* mv jungle

* match pedal style

* fix linter

* fix fw path

* fix paths

* safety!
2023-08-03 23:55:13 -07:00
Adeeb Shihadeh 52f96bac68
spi: nack on can tx endpoint if buffer is full (#1426)
* spi: nack on can tx endpoint if buffer is full

* handle in python lib

* fix timeout

* fix timeout

* fix linter

* cleanup

* fix

---------

Co-authored-by: Comma Device <device@comma.ai>
2023-05-19 22:43:34 -07: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
Adeeb Shihadeh 0e2eb9c0f5
fan debugging script (#1354)
* fan debugging script

* merge those

* disable

* better print

---------

Co-authored-by: Comma Device <device@comma.ai>
2023-04-20 13:00:40 -07:00
Robbe Derks 11d90f9e78
No more magic for the can chunks (#1191)
* no more magic

* bump version

* no need for this

* comment cleanup

* add comms_can_reset tests

* we can't ensure this for compatibility reasons

* add CANPacket_t checksum
2023-01-13 10:59:58 -08:00
Adeeb Shihadeh 27504639f0
cleanup + prep for more tests! (#1172)
* panda for pc!

* little more

* fake panda

* move some more stuff

* increase timeout

* move that

* print helpers

* cleanup

* just move it for now

* revert jenkins changes
2022-11-30 14:15:09 -08:00
Adeeb Shihadeh 966f7e0539
SPI: fixes + fake bulk transfers (#1150)
* check spi checkusm

* ugh, fix control handler

* fake bulk xfer

* cleanup

* one more

* unused

* fix linter

* some typing

Co-authored-by: Comma Device <device@comma.ai>
2022-11-10 21:34:43 -08:00
Igor Biletskyy de7e1e7579
Deep sleep(stop) mode for pandas (#832)
* Add RTC with LSI for BP, GP, WP

* disable jenkins temporarily, REVERT!

* experiments

* cleanup is still needed

* cppcheck unused suppress

* raise deepsleep limit timeout to 120sec

* more experiments on usb_enumerated

* continue

* soft_disconnect

* almost done

* not enough

* no ignition

* still don't like it..

* rename to has_rtc_battery

* clock_source on the way!?

* delay 3 sec

* works on C3, needs test on C2

* And this is for C2

* disable bootkick

* misra 10.4

* ..

* ..

* set power state the right way

* change that

* seems don't need that? check on C2/C3

* partially works on RP...

* comments (will work after rebase)

* change fault name

* switch to manual activation mode

* Revert "disable jenkins temporarily, REVERT!"

This reverts commit 578d425fa7.

* my dear pedal!
2022-03-07 14:24:04 -08:00
Igor Biletskyy 8d0d148681
Move shared definitions into separate file (#808)
* refactor definitions includes

* fix include

* revert dlc_to_len

* ...

* change name
2021-12-16 14:38:22 -08:00
Igor Biletskyy ae26b75d7b
CAN_FIFOMailBox to CANPacket struct + USB dynamic packet size (#739)
* Squashed commits, no cleanup

* Few fixes

* No init = garbage

* Only receive with new canpacket

* Add send with canpacket

* Revert "Add send with canpacket"

This reverts commit 7d06686ddd6d447c714b5289d31af24403d36931.

* Packet must be aligned to word, or bad performance

* Cleaner

* Fix tests

* Tests...

* MISRA 10.4

* More MISRA

* libpandasafety_py

* cffi

* even more tests...

* typo

* ...

* ...

* ...

* Slight cleanup

* MISRA 6.1

* MISRA 17.7

* Bug in bxcan + even style

* MISRA 10.1

* Revert "MISRA 10.1"

This reverts commit 404ae7fcc39556f80f528de9015702e69f4ea0a5.

* ...

* MISRA 10.1 and 10.4 suppress until next PR

* MISRA 20.1

* ...

* test_honda

* ...

* ...

* test_toyota

* test_volkswagen_mqb

* test_volkswagen_pq

* Sketchy thing...

* Revert "Sketchy thing..."

This reverts commit 3b2e5715bdc1954f7b7b3b7469ba3d0eaa06bdf9.

* remove comment

* bxcan extended address bug

* Concept, experimental dynamic usb packet size

* increase each buffer to 10240 bytes

* raise python bulk read/write limits

* ...

* Move packet size to start

* Experimental send, stream-like

* New receive test, stream-like

* cleanup

* cleanup + rebase fixes

* MISRA

* Extra receive method, stream-like, commented out

* type change

* Revert back to buffer for send, stream commented

* forgot ZLP

* lower buffer, add rx failsafe

* ... remove ZLP

* return ZLP back

* Add tx checks to panda fw

* TX stream with counter

* fix counter overflow

* 13 free slots should be enough

* limit tx usb packet

* ...

* Revert max_bulk_msg doubling

* python lib improve speed

* Stream with counter for RX, dirty, needs cleanup

* Increase chunk length to 4096 bytes

* cleanup fdcan.h

* cleanup __init__.py

* MISRA 12.1

* MISRA 10.8

* remove non-streaming usb functions

* more main.c cleanup

* MISRA 15.6

* MISRA 15.5

* MISRA 18.4 and suppress objectIndex

* handling usb pakcets > 63bytes, naming and cleanup

* Cleanup old from tests and update CANPacket_t struct

* Switch to 4 bit DLC instead of 6 bit length

* ops)

* ...

* pylint

* receive python buffer increase

* USB increase receive packet len

* tweak buffers

* No need for so high limits

* MISRA 20.1 workaround

* performance tweaks

* cleanup, dlc to data_len_code naming

* main.c naming

* comments and cleanup for main.c usb

* clean py lib

* pylint

* do not discard good rx messages on stream fail

* cleanups

* naming

* remove bitstruct lib and lower tx limit

* bitstruct lefovers

* fix bug in VW test

* remove adjusting data size and assert on wrong len

* ...

* test new memcpy before merging

* Revert "test new memcpy before merging"

This reverts commit 399465a264835061adabdd785718c4b6fc18c267.

* macros for to/fromuint8_t array

* MISRA hates me!

* tests.c include macros instead

* move CANPacket to can_definitions.h

* vw_pq python test fix

* new memcpy test, REMOVE

* check without alignment

* revert macros for uint8 arrays

* Revert "revert macros for uint8 arrays"

This reverts commit 581a9db735a42d0d68200bd270d87a8fd34e43fe.

* check assert

* Revert "check assert"

This reverts commit 9e970d029a50597a1718b2bb0260196c050fd77f.

* one more variation

* Revert "one more variation"

This reverts commit f6c0528b7ac7e125750dc0d9445c7ce97f6954b5.

* what about read performance

* Revert "what about read performance"

This reverts commit d2610f90958a816fe7f1822157a84f85e97d9249.

* check struct alignment to word

* check for aligned memcpy again

* cleanup

* add CANPacket structure diagram

* update CANPacket and add USB packet struct

* bugfix + refactoring of EP1

* move dlc_to_len to header

* missed include

* typo...

* MISRA

* fk

* lower MAX_CAN_MSGS_PER_BULK_TRANSFER

* bump CAN_PACKET_VERSION to 2

* bump python lib CAN_PACKET_VERSION to 2

* rename parse_can_buffer to unpack_can_buffer

* CANPacket_t const fields

* Revert "CANPacket_t const fields"

This reverts commit cf91c035b7706a14e317550c5f0501ae3fce7c70.

* test.c relative path

* cleanup

* move macros to safety_declarations

* Refactor pack/unpack funcs and add unittest

* usb_protocol.h

* oops

* Update .github/workflows/test.yaml

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

* remove print from unittest

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2021-11-12 16:36:34 -08:00
Igor Biletskyy b4b14593a0
Check panda library and firmware for compatibility (#770)
* check panda lib and firmware compatibility

* skip comp check for pedal

* ...

* guard affected funcs and print to stderr

* ...

* ...

* ..

* decorators

* test workaround

* linter

* ...

* ...

* ...

* change request address

* split

* remove compatible variable

* ...

* remove compatibility_check

* get packets versions on connect

* fix linter

* use RuntimeError

Co-authored-by: Willem Melching <willem.melching@gmail.com>
2021-11-11 14:30:52 +01: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 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
rbiasini 0696730c14
Toyota: add missing offset from speed signal (#469)
* Toyota: add missing offset from speed signal

* Let's also define ABS value in macro
2020-03-11 17:30:30 -07:00
robbederks 656f99b080
Interrupt refactor (NVIC_SM_1: #334) and Fault handling (#377) (PR #373) 2019-11-27 18:11:21 -08: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
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 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 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 d1e6bd86b1 Fix Misra 16.6 and 16.7 by using a different COMPILE_TIME_ASSERT 2019-06-24 17:50:01 -07:00
Riccardo 578ef22d52 Misra 12.1 violation in MIN/MAX macros 2019-06-17 18:39:17 -07:00
rbiasini a3f65d66e9
capitalize MIN and MAX macros (#220) 2019-06-17 13:48:14 -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 9b0b54f4a1 refactor continues 2017-07-20 23:42:19 -07:00
Jessy Diamond Exum 3a415ab870 Can loopback now runtime configurable.
Useful for board tests, customer troubleshooting, and linux driver loopback support.
2017-07-14 20:32:48 -07:00
George Hotz 7733b09288 Revert commits that broke USB for openpilot.
Revert "fix openpilot board flashing"

This reverts commit 8ff93ad5da.

Revert "Fixed output_enabled led not turning off when mode changed to no output."

This reverts commit 27a8af1107.

Revert "Fixed loopback test for new GMLAN 'can4' behavior."

This reverts commit 59592f599a.

Revert "GMLAN is now always mapped through CAN4 (index 3)"

This reverts commit 329c091024.

Revert "Removed compile time config for CAN loopback, implemented as usb message."

This reverts commit e1a4c32985.

Revert "Change all output safety mode identifier to prevent user mistakes."

This reverts commit 6b363e2e92.

Revert "untabify"

This reverts commit 191f67b083.

Revert "Refactor of safety to support more modular additions of safety policies."

This reverts commit e5b524eddc.

Revert "Split up some more header files into compilation units."

This reverts commit e2a78912f5.

Revert "Enabled emulated control writes over USB."

This reverts commit 133cfe9703.

Revert "Moved CAN and USART code out of main.c and into more appropriate files."

This reverts commit daad2dc062.

Revert "Large Panda CAN cleanup. Restrict GMLAN to valid baud rates."

This reverts commit a0616a2bc2.

Revert "Panda library now correctly sends USB direction bit."

This reverts commit 1712c901d4.

Revert "Board makefile now automatically calculates header file dependencies."

This reverts commit 4a8d4e597b.

Revert "Loopback test works over wifi. (Disable trying to send over wifi)"

This reverts commit dae636968a.

Revert "Fix legacy board build"

This reverts commit 62bf4e5756.

Revert "Style cop"

This reverts commit c439f43726.

Revert "Untabify"

This reverts commit 41e5eec621.

Revert "Fixed disabling gmlan."

This reverts commit 5e1e45a4af.

Revert "Removed dead code, standardized canid in more commands, better erroring behavior."

This reverts commit b59aeb6d87.

Revert "loopback test works with new CAN bus ids."

This reverts commit 75970861cf.

Revert "Large reorganization of code and early integration of can bitrate setting."

This reverts commit a1ed7b62ee.
2017-07-12 11:27:16 -07:00
Jessy Diamond Exum e1a4c32985 Removed compile time config for CAN loopback, implemented as usb message. 2017-07-11 16:55:36 -07:00
Jessy Diamond Exum a0616a2bc2 Large Panda CAN cleanup. Restrict GMLAN to valid baud rates.
Work towards removing/centralizing ifdefs for CAN3 and PANDA
2017-07-11 16:55:36 -07:00
Jessy Diamond Exum b59aeb6d87 Removed dead code, standardized canid in more commands, better erroring behavior. 2017-07-11 16:55:36 -07:00
Jessy Diamond Exum 75970861cf loopback test works with new CAN bus ids. 2017-07-11 16:55:36 -07:00
Jessy Diamond Exum a1ed7b62ee Large reorganization of code and early integration of can bitrate setting. 2017-07-11 16:55:36 -07:00
Jessy Diamond Exum 431080403d Panda firmware auto detects REV C hardware. 2017-06-27 19:27:24 -07:00