cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7 FDCAN: sending FD message not working, non-FD works

Fr4nky
Associate II

Hi,

I am trying to send a CAN FD message with a STM32H743, using initialization code generated by CubeMX. Attached you can find a screenshot of the CubeMX settings. The clock to the FDCAN module is 100MHz. This is the code I use to send the message:

HAL_FDCAN_EnableISOMode(&hfdcan1);
HAL_FDCAN_Start(&hfdcan1);		
 
FDCAN_TxHeaderTypeDef header;
header.DataLength = FDCAN_DLC_BYTES_8;
header.TxFrameType = FDCAN_DATA_FRAME;
header.BitRateSwitch = FDCAN_BRS_ON;
header.ErrorStateIndicator = FDCAN_ESI_PASSIVE;
header.FDFormat = FDCAN_FRAME_FD_BRS;
header.IdType = FDCAN_STANDARD_ID;
header.TxEventFifoControl = FDCAN_NO_TX_EVENTS;
header.MessageMarker = 0;
header.Identifier = 1234;
 
uint8_t data[8] = {0, 1, 2, 3, 4, 5, 6, 7};
HAL_FDCAN_AddMessageToTxFifoQ(&hfdcan1, &header, data);

Unfortunately, only a standard CAN frame is sent, not a CAN FD one.

Does anyone have any idea why?

1 ACCEPTED SOLUTION

Accepted Solutions
Fr4nky
Associate II

Well, I figured it out, not sure how I managed to mess this up.

One line in the code was wrong, it should instead be this:

header.FDFormat = FDCAN_FD_CAN;

View solution in original post

1 REPLY 1
Fr4nky
Associate II

Well, I figured it out, not sure how I managed to mess this up.

One line in the code was wrong, it should instead be this:

header.FDFormat = FDCAN_FD_CAN;