2024-04-09 01:57 AM - last edited on 2024-04-09 03:36 AM by SofLit
We are using the STM32F429 in an ongoing project.
The CAN bus is used for the communication.
In a new project we change to the STM32G473VE.
The STM32G43VE is equiped with an FD CAN.
The low level interface is slightly different between CAN on the STM32F and FD CAN on the STM32G4.
After rewriting the software for the FD CAN, we have found that the Tx completed call back is not called. Callbacks are registered, but the IRQ remains off.
The callback registration for the F4 is:
// HAL_CAN_RegisterCallback(&hfdcan1, HAL_CAN_TX_MAILBOX0_COMPLETE_CB_ID, MessageTransmittedCallback);
// HAL_CAN_RegisterCallback(&hfdcan1, HAL_CAN_TX_MAILBOX1_COMPLETE_CB_ID, MessageTransmittedCallback);
// HAL_CAN_RegisterCallback(&hfdcan1, HAL_CAN_TX_MAILBOX2_COMPLETE_CB_ID, MessageTransmittedCallback);
Which is the equvalent register call back for the FD CAN?
HAL_FDCAN_RegisterCallback(&hfdcan1, HAL_FDCAN_TX_FIFO_EMPTY_CB_ID, MessageTransmittedCallback);
or
HAL_FDCAN_RegisterTxEventFifoCallback(&hfdcan1, (pFDCAN_TxEventFifoCallbackTypeDef) MessageTransmittedCallback);
or some other ?
2024-04-09 04:08 AM
I think for the G0 it is HAL_FDCAN_ActivateNotification(&hfdcan1, FDCAN_IT_TX_COMPLETE , FDCAN_TX_BUFFER0 | FDCAN_TX_BUFFER1 | FDCAN_TX_BUFFER2); Not sure for the G4. Take a look in the HAL Manual of the G4