Commit Graph

20 Commits

Author SHA1 Message Date
Andrew Tridgell 1c8048df8f HAL_ChibiOS: fixed CANFD timings
our CANFD timings were resulting in a lot of busoff errors. Here is an
example of master at 1Mbit/5MBit:

Getting @SYS/can0_stats.txt as -
------- Clock Config -------
CAN_CLK_FREQ:   80MHz
Std Timings: bitrate=1000000 presc=7
sjw=0 bs1=7 bs2=0 sample_point=90.00000%
FD Timings:  bitrate=5000000 presc=1
sjw=0 bs1=5 bs2=0 sample_point=90.00000%
------- CAN Interface Stats -------
tx_requests:    2689
tx_rejected:    0
tx_overflow:    443
tx_success:     7
tx_timedout:    2232
tx_abort:       0
rx_received:    18470
rx_overflow:    0
rx_errors:      0
num_busoff_err: 34439
num_events:     18477
ECR:            F8
fdf_rx:         18467
fdf_tx_req:     2182
fdf_tx:         0

here is an example with the new timings:

------- Clock Config -------
CAN_CLK_FREQ:   80MHz
Std Timings: bitrate=1000000 presc=8
sjw=1 bs1=8 bs2=1 sample_point=90.00000%
FD Timings:  bitrate=8000000 presc=2
sjw=3 bs1=8 bs2=3 sample_point=80.00000%
------- CAN Interface Stats -------
tx_requests:    3023
tx_rejected:    0
tx_overflow:    0
tx_success:     3023
tx_timedout:    0
tx_abort:       0
rx_received:    27865
rx_overflow:    0
rx_errors:      0
num_busoff_err: 0
num_events:     30888
ECR:            0
fdf_rx:         27862
fdf_tx_req:     3016
fdf_tx:         3016

I am testing between a CubeOrange and a Pixhawk6X. I tested 1, 2, 4, 5
and 8 MBit (which are the only valid FD bitrates in our parameters)

Many thanks to Kai from Salient Motion for finding this issue and
providing the corrected timing table
2024-01-25 11:44:02 +11:00
Andrew Tridgell c0d0aeee86 HAL_ChibiOS: reimplement CAN with BinarySemaphore 2024-01-03 07:37:05 +11:00
Andrew Tridgell c2011570f7 HAL_ChibiOS: use chSysLock for CAN critical section
this avoids an assert in some code paths that combine with hrt
functions
2024-01-03 07:37:05 +11:00
Andrew Tridgell bfff5548ef HAL_ChibiOS: implement get_statistics() 2022-12-13 16:56:57 +11:00
bugobliterator faf0c0d7c3 AP_HAL_ChibiOS: set canfd bitrates using CANFD_SUPPORTED opt 2022-03-11 18:13:54 +11:00
bugobliterator 47dd964e63 AP_HAL_ChibiOS: add init method to take in separate canfd bitrate 2022-03-11 18:13:54 +11:00
Siddharth Purohit 8aa047d876 AP_HAL_ChibiOS: add support for CANFD for H7 and G4 2022-03-11 18:13:54 +11:00
Andrew Tridgell 124c9d5d9b HAL_ChibiOS: support mavcan message forwarding 2022-02-12 16:36:05 +11:00
bugobliterator a8ab20abd9 AP_HAL_ChibiOS: allow sending stats via mavftp on AP_Periph 2021-08-19 14:20:58 +10:00
Tom Pittenger f764bd6547 AP_HAL_ChibiOS: disable EventSource only when CH_CFG_USE_EVENTS is false
(cherry picked from commit 6e7542a70ca2343ab8d18470deaf5fc2d27390af) from bugobliterator
2021-06-09 18:36:18 +10:00
Siddharth Purohit ad9a8c8bd9 AP_HAL_ChibiOS: record error states in CANFDIface and CANIface 2021-05-26 18:25:01 +10:00
Andrew Tridgell f57b1b9c4b HAL_ChibiOS: support logical/physical CAN bus mapping
allow for first CAN interface to be CAN2 or CAN3
2021-03-23 12:01:20 +11:00
Andrew Tridgell 42bc9adfb7 HAL_ChibiOS: use ExpandingString for @SYS buffers 2021-01-05 10:52:00 +11:00
Siddharth Purohit 36ffcdae30 HAL_ChibiOS: modify hal can drivers for use by AP_Periph 2020-09-24 12:32:19 +10:00
bugobliterator 5eb0e0a718 AP_HAL_ChibiOS: fix name for RX Queue size define 2020-08-24 06:48:56 +10:00
Siddharth Purohit cdf8e369f1 AP_HAL_ChibiOS: create UAVCAN agnostic CANIface driver
HAL_ChibiOS
2020-08-19 17:31:09 +10:00
Andrew Tridgell 15e4641e51 AP_HAL_ChibiOS: cleanup ifdefs for SLCAN enable 2019-10-08 10:02:14 +11:00
Peter Barker 35c2406b17 AP_HAL_ChibiOS: add missing override keywords
This was causing CubeOrange not to build
2019-08-17 13:25:05 +10:00
Siddharth Purohit 2f153a3577 HAL_ChibiOS: remove singleton interface from slcan_router 2019-07-08 12:18:29 +10:00
Siddharth Purohit 67c925865c HAL_ChibiOS: add support for CAN on STM32H7 boards 2019-07-08 12:18:29 +10:00