Skip to main content
BSpoe.1
Associate III
June 2, 2020
Solved

[STM32H745] Transceiver Delay Compensation (TDC) not working on custom project

  • June 2, 2020
  • 1 reply
  • 1392 views

Hi,

I have a custom project with the internal FDCAN controllers and I try to set the bit timings to 1 MBit/s for arbitration and 2 MBit/s for data phase. For the project I use thel NUCLEO STM32H745ZI-Q board with a selfmade expansion with containing two CAN-FD transceivers from Microchip (MCP2542FD).

Without bitrate switching the two controllers talk to each other, but when I try to use the higher data bitrate, I get only errors. I tried the configuration of the example "FDCAN_Image_Transmission" of FW Version 1.7.0 and changed the parameters for the lower bitrate in data phase.

My configuration is the following:

/* Prepare Tx Header */
 fdcan1TxHeader.Identifier = 0x500;
 fdcan1TxHeader.IdType = FDCAN_STANDARD_ID;
 fdcan1TxHeader.TxFrameType = FDCAN_DATA_FRAME;
 fdcan1TxHeader.DataLength = FDCAN_DLC_BYTES_12;
 fdcan1TxHeader.ErrorStateIndicator = FDCAN_ESI_ACTIVE;
 fdcan1TxHeader.BitRateSwitch = FDCAN_BRS_OFF;
 fdcan1TxHeader.FDFormat = FDCAN_FD_CAN;
 fdcan1TxHeader.TxEventFifoControl = FDCAN_NO_TX_EVENTS;
 fdcan1TxHeader.MessageMarker = 0;
 
/* Configure and enable Tx Delay Compensation : TdcOffset = DataTimeSeg1*DataPrescaler */
 HAL_FDCAN_ConfigTxDelayCompensation(&hfdcan1, 23, 0);
 HAL_FDCAN_EnableTxDelayCompensation(&hfdcan1);

Parameters:

  • FDCAN kernel clock = 80 MHz
  • Bitrate prescaler = 1
  • TSEG1 = 23
  • TSEG2 = 16
  • Sync Jump Width = 16

With this parameters the sample point is 60%.

I measured with an oscilloscope that the transceiver delay is about 125ns.

Can anyone help me?

Thanks a lot!

This topic has been closed for replies.
Best answer by BSpoe.1

I found the solution for my problem:

From copy&paste of the example project into my existing one I copied the provided code after starting the CAN module with HAL_FDCAN_Start(). Starting the controller has to be the last step inside the initialization phase. I hope someone can use this information!

Greetings from Germany :)

1 reply

BSpoe.1
BSpoe.1AuthorBest answer
Associate III
June 5, 2020

I found the solution for my problem:

From copy&paste of the example project into my existing one I copied the provided code after starting the CAN module with HAL_FDCAN_Start(). Starting the controller has to be the last step inside the initialization phase. I hope someone can use this information!

Greetings from Germany :)