STM32H743 fdcan not sending messages from FIFO
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-29 09:38 AM
Hello everyone,
I'm trying to use the FDCAN of the STM32H743 using the Tx FIFO. The board correctly receives all messages, but when trying to send them from the FIFO, it fills without sending anything.
This is a piece of the code:
if (HAL_FDCAN_AddMessageToTxFifoQ(&hfdcan1, &pTxHeader, CanPayload) != HAL_OK) // Adding message to Tx FIFO
{
printf("Can_Err: Tx vel\n");
}
while (!HAL_FDCAN_GetTxFifoFreeLevel(&hfdcan1))
;
The FDCAN is set as follows:
hfdcan1.Instance = FDCAN1;
hfdcan1.Init.FrameFormat = FDCAN_FRAME_CLASSIC;
hfdcan1.Init.Mode = FDCAN_MODE_NORMAL;
hfdcan1.Init.AutoRetransmission = ENABLE;
hfdcan1.Init.TransmitPause = DISABLE;
hfdcan1.Init.ProtocolException = DISABLE;
hfdcan1.Init.NominalPrescaler = 8;
hfdcan1.Init.NominalSyncJumpWidth = 8;
hfdcan1.Init.NominalTimeSeg1 = 31;
hfdcan1.Init.NominalTimeSeg2 = 8;
hfdcan1.Init.DataPrescaler = 1;
hfdcan1.Init.DataSyncJumpWidth = 1;
hfdcan1.Init.DataTimeSeg1 = 1;
hfdcan1.Init.DataTimeSeg2 = 1;
hfdcan1.Init.MessageRAMOffset = 0;
hfdcan1.Init.StdFiltersNbr = 10;
hfdcan1.Init.ExtFiltersNbr = 0;
hfdcan1.Init.RxFifo0ElmtsNbr = 6;
hfdcan1.Init.RxFifo0ElmtSize = FDCAN_DATA_BYTES_8;
hfdcan1.Init.RxFifo1ElmtsNbr = 6;
hfdcan1.Init.RxFifo1ElmtSize = FDCAN_DATA_BYTES_8;
hfdcan1.Init.RxBuffersNbr = 0;
hfdcan1.Init.RxBufferSize = FDCAN_DATA_BYTES_8;
hfdcan1.Init.TxEventsNbr = 0;
hfdcan1.Init.TxBuffersNbr = 0;
hfdcan1.Init.TxFifoQueueElmtsNbr = 6;
hfdcan1.Init.TxFifoQueueMode = FDCAN_TX_FIFO_OPERATION;
hfdcan1.Init.TxElmtSize = FDCAN_DATA_BYTES_8;
And the code is generated from CubeMX
- Labels:
-
FDCAN
-
STM32H7 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-30 03:37 AM
Hi,
The FDCAN configuration seems to be ok. Did you check the FDCAN examples provide in STM32CubeH7 package? Also, it is available via this path STM32Cube_FW_H7_Vx.x.\Projects\STM32H743I-EVAL\Examples\FDCAN
Bouraoui
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-30 04:09 AM
Is there a viable CAN bus and devices attached to the system?​
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-30 05:59 AM
Yeah, I checked, the only difference seems to be that they use
hfdcan.Init.FrameFormat = FDCAN_FRAME_FD_BRS;
Moreover, I tried disabling auto-retransmission and something has changed, the bus has a strange behavior.
What it does is that:
-The bus is in error mode (shifts between 0-1-0 each x ms);
-Then a message appears, but it is sent only until a bit between the RTR and the end of the second byte (message of 4 bytes)
-The bus goes back in error mode without completing the transmission of the frame.
The H7 is connected to an F4 which waits for an interrupt from the controller for a received message (no filters are applied)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-30 06:00 AM
Yes, as I said to Mr. Chemli, it is connected to an F4 which is in WFI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-06-25 09:08 AM
hey did you find a solution? i have the same issue with the same chip that nothing leaves my tx fifo...