2020-01-28 01:17 PM
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?
Solved! Go to Solution.
2020-01-29 06:14 AM
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;
2020-01-29 06:14 AM
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;