Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors CAN task setup across multiple nodes and begins shifting STM32G4 (FDCAN) CAN TX toward an event-driven model by waking the TX task on enqueue and on TX-complete interrupts.
Changes:
- Replaced per-node CAN RX/TX task definitions/starts with
DEFINE_CAN_TASKS()/START_CAN_TASKS(). - Updated G4 FDCAN driver to route RX interrupts to IT0 and TX-complete interrupts to IT1, adding a TX callback hook.
- Made G4 CAN TX task notification-driven (enqueue notifies the TX task; TX-complete ISR notifies when FIFO space frees).
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| source/torque_vector/main.c | Switches to CAN task macros for Torque Vector node. |
| source/pdu/main.c | Switches to CAN task macros for PDU (bxCAN) node. |
| source/main_module/main.c | Switches to CAN task macros for Main Module node. |
| source/g4_testing/izze_imu_config.c | Switches to CAN task macros for G4 IMU config test. |
| source/g4_testing/canpiler.c | Switches to CAN task macros for G4 canpiler test. |
| source/f4_testing/canpiler.c | Switches to CAN task macros for F4 canpiler test. |
| source/driveline/main.c | Adds CAN task macros and starts CAN tasks for Driveline node. |
| source/dashboard/main.c | Switches to CAN task macros for Dashboard node. |
| source/a_box/main.c | Switches to CAN task macros for A-Box node. |
| common/phal_G4/fdcan/fdcan.h | Adds TX callback declaration; reformats filter API signature. |
| common/phal_G4/fdcan/fdcan.c | Routes RX/TX interrupts to separate lines; adds TX ISR + weak TX callback. |
| common/can_library/can_common.h | Introduces DEFINE_CAN_TASKS / START_CAN_TASKS macros. |
| common/can_library/can_common.c | Makes G4 TX notification-driven; removes TX enqueue backpressure waits. |
cc97e44 to
b60c6e5
Compare
| void CAN1_TX_IRQHandler() { | ||
| CAN_wake_tx_from_ISR(); | ||
| } |
There was a problem hiding this comment.
CAN1_TX_IRQHandler() doesn't acknowledge/clear the bxCAN TX interrupt source. With CAN_IER_TMEIE enabled, the ISR should clear the relevant completion flags in CAN1->TSR (e.g., write 1s to any set CAN_TSR_RQCPx bits, and potentially handle TXOK/ALST/TERR bookkeeping). Without clearing, the IRQ can re-fire immediately and starve the system.
| void CAN2_TX_IRQHandler() { | ||
| CAN_wake_tx_from_ISR(); | ||
| } |
There was a problem hiding this comment.
CAN2_TX_IRQHandler() doesn't acknowledge/clear the bxCAN TX interrupt source. With CAN_IER_TMEIE enabled, the ISR should clear the relevant completion flags in CAN2->TSR (e.g., write 1s to any set CAN_TSR_RQCPx bits, and potentially handle TXOK/ALST/TERR bookkeeping). Without clearing, the IRQ can re-fire immediately and starve the system.
37dccd0 to
98a4a1d
Compare
20533dc to
537d2f4
Compare
319e09d to
36e22b8
Compare
Uh oh!
There was an error while loading. Please reload this page.