2020-06-02 07:09 AM
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:
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!
Solved! Go to Solution.
2020-06-05 02:16 AM
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 :)
2020-06-05 02:16 AM
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 :)