zephyr/drivers/can
Grant Ramsay e9bc195bf4 drivers: can: mcan: manually track available TX buffers
The MCAN driver operates in TX queue mode (TXBC.TFQM = 1). In this mode
TXFQS.TFQPI returns the first available buffer (usually buffer zero).

Hardware is free to re-use a buffer as soon as TX completes, it does not
have to wait for the matching TX event to be processed.

If a TX completes and that TX buffer is re-used before processing the TX
event, two TX events for the same buffer occur. The first event calls the
second events TX callback, and the second event results in a NULL pointer
exception.

In a "normal" configuration, the TX event ISR will always preempt the
queuing of a TX frame to the same TX buffer.
However, this issue could occur if:
 * Sending a message with ISRs temporarily disabled.
 * The ISR is processed on a different core to the TX call.

The fix is to manually track which TX buffers are available, only freeing
a buffer after the TX event has been processed.

The MCAN user manual states that this is allowed:
"The application may use register TXBRP instead of the Put Index and may
place messages to any Tx Buffer without pending transmission request"

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-08-28 08:23:37 +01:00
..
transceiver drivers: can: transceiver: Update drivers to use dts Kconfig symbol 2022-09-08 15:30:23 +00:00
can_common.c drivers: can: common: document sample point calculation function 2023-03-27 09:50:24 +02:00
can_esp32_twai.c drivers: can: fix long lines 2023-07-25 18:12:33 +02:00
can_fake.c device: remove redundant init functions 2023-04-19 10:00:25 +02:00
can_handlers.c drivers: can: use flags fields for can_frame and can_filter structs 2022-10-25 16:32:10 +02:00
can_kvaser_pci.c drivers: can: sja1000: move public header file to public include path 2023-02-23 09:00:34 +01:00
can_loopback.c drivers: can: move CAN utility function to public header 2023-02-23 09:00:12 +01:00
can_mcan.c drivers: can: mcan: manually track available TX buffers 2023-08-28 08:23:37 +01:00
can_mcp2515.c drivers: can: mcp2515: set thread name 2023-06-02 09:43:16 +02:00
can_mcp2515.h drivers: can: mcp2515: abort transfers before entering configuration mode 2022-09-23 17:25:01 +00:00
can_mcux_flexcan.c drivers: can: mcux: flexcan: can_set_mode supports can_mode_3_samples 2023-08-15 10:11:32 -07:00
can_mcux_mcan.c drivers: can: mcan: move header file to public includes 2023-06-01 18:04:42 -04:00
can_native_posix_linux.c drivers: can: move CAN utility function to public header 2023-02-23 09:00:12 +01:00
can_native_posix_linux_socketcan.c drivers: can: npl: ensure CANFD_FDF flag is defined 2022-10-17 17:04:16 +02:00
can_native_posix_linux_socketcan.h drivers: can: native_posix_linux: initial implementation 2022-09-09 10:08:59 +02:00
can_nxp_s32_canxl.c drivers: can: support NXP S32 CANEXCEL 2023-04-29 12:23:40 +02:00
can_rcar.c drivers: can: Fix R-Car driver can_stop behavior 2023-05-24 19:43:45 -04:00
can_sam.c drivers: can: mcan: move header file to public includes 2023-06-01 18:04:42 -04:00
can_sam0.c drivers: can: mcan: move header file to public includes 2023-06-01 18:04:42 -04:00
can_shell.c drivers: can: shell: add debug log for calculated timing parameters 2023-03-20 09:53:14 +01:00
can_sja1000.c drivers: can: sja1000: move public header file to public include path 2023-02-23 09:00:34 +01:00
can_sja1000_priv.h drivers: can: add NXP SJA1000 common driver backend 2022-07-30 17:32:04 +01:00
can_stm32_bxcan.c drivers: can: stm32: bxcan: rename driver to match reference manuals 2023-08-16 13:03:00 +02:00
can_stm32_fdcan.c drivers: can: stm32: fdcan: rename driver to match reference manuals 2023-08-16 13:03:00 +02:00
can_stm32h7_fdcan.c drivers: can: stm32h7: fdcan: rename driver to match reference manuals 2023-08-16 13:03:00 +02:00
CMakeLists.txt drivers: can: stm32h7: fdcan: rename driver to match reference manuals 2023-08-16 13:03:00 +02:00
Kconfig drivers: can: stm32h7: fdcan: fold Kconfig file into stm32 Kconfig file 2023-08-16 13:03:00 +02:00
Kconfig.esp32 drivers: can: add ESP32 TWAI CAN controller driver 2022-07-30 17:32:04 +01:00
Kconfig.fake drivers: can: remove CAN_HAS_CANFD Kconfig helper 2023-01-25 15:00:39 +00:00
Kconfig.kvaser drivers: can: add driver for the Kvaser PCIcan CAN controller PCI card 2022-11-01 15:22:31 -04:00
Kconfig.loopback drivers: can: remove CAN_HAS_CANFD Kconfig helper 2023-01-25 15:00:39 +00:00
Kconfig.mcan drivers: can: remove CAN_HAS_CANFD Kconfig helper 2023-01-25 15:00:39 +00:00
Kconfig.mcp2515 drivers: can: mcp2515: increase default stack size 2023-06-02 09:43:16 +02:00
Kconfig.mcux drivers: can: add kconfig CAN_MAX_MB 2023-07-27 11:06:45 -05:00
Kconfig.native_posix_linux drivers: can: native_posix_linux: initial implementation 2022-09-09 10:08:59 +02:00
Kconfig.nxp_s32 drivers: can: support NXP S32 CANEXCEL 2023-04-29 12:23:40 +02:00
Kconfig.rcar drivers: can: Update drivers to use devicetree Kconfig symbol 2022-07-21 06:02:28 -05:00
Kconfig.sam drivers: can: sam: do not select cache management 2023-07-31 19:38:22 +00:00
Kconfig.sam0 sam: can: CAN driver for SAM0 socs 2023-05-22 08:03:58 +00:00
Kconfig.sja1000 drivers: can: add NXP SJA1000 common driver backend 2022-07-30 17:32:04 +01:00
Kconfig.stm32 drivers: can: stm32h7: fdcan: rename driver to match reference manuals 2023-08-16 13:03:00 +02:00