2025-05-20 12:52 AM
Hi,
I am using STM32G474RET6 controller and would like to send and receive data in classic mode. I have configured all necessary parameters using cubemx but the hard fault occured when I call this function HAL_FDCAN_AddMessageToTxFifoQ(&hfdcan1, &TxHeader, TxData).
The CAN termination is connected properly.
Following are my configuration settings:
i also init the CAN filter before transmit can message using the function below:
the can message transmitting function is as below:
when the code run till FDCAN_CopyMessageToRAM, it will go into HardFault_Handler, that's really confused me.
disable the code that related to can function in main.c file, it could run normally.
2025-05-20 12:58 AM
i have downloaded the example code at https://github.com/STMicroelectronics/STM32CubeG4/tree/master/Projects/STM32G474E-EVAL/Examples/FDCAN/FDCAN_Classic_Frame_Networking ,but i find that the configuration of FDCAN1 of this example is in FDCAN_MODE_NORMAL, I'm even more confused T^T. Is the example code right?