2020-05-05 03:45 AM
A little something I have noticed today. I have been developing an application which is using the G431 and uses FD-CAN. My code was working in External Loopback mode such that a CAN message of my choosing was being correctly received by an external device, yet in Normal mode otherwise the same code was creating error frames.
I had used the ST-provided HAL function HAL_FDCAN_ConfigTxDelayCompensation to ensure the self-reception of the message was compensated for the 4Mb/s bit rate I have chosen for the data part of the CAN frame.
The error frames were caused because there is a bit in the FDCAN_DBTP register which controls the delay compensation method which is not set by the ST-provided HAL function. This bit may be configurable elsewhere in the GUI or by other HAL functions, but it seems to me that a function designed to configure the delay compensation should include it where a non-zero time offet is desired.
For those who do not use the HAL, the DBTP register is part of the FDCAN_GlobalTypeDef struct - TDC is bit 23 of this register and must be set to true to enable delay compensation - see G431 Reference Manual Rev 2 page 1928.
My code now works so I can start to work on the Receive Message side.
I hope this helps somebody.
2020-06-05 03:57 AM
In the current firmware (for me it's STM32H7 FW V1.7.0) there should be a HAL function to enable this bit:
HAL_FDCAN_EnableTxDelayCompensation(&hfdcan);
2020-06-18 09:25 AM
Hello,
Could you please confirm that adding HAL function HAL_FDCAN_EnableTxDelayCompensation(&hfdcan); resolve your issue?
Otherwise, please details more your issue and share your source code ?
Best Regards,
Imen
2020-06-19 01:33 AM
Dear Imen,
I am afraid in the 7 weeks since I posted, much of the HAL code has been removed.
I have made a separate project to test both the functions HAL_FDCAN_EnableTxDelayCompensation() and HAL_FDCAN_ConfigTxDelayCompensation() and that project works.
Kind Regards,