cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H743 fdcan not sending messages from FIFO

NGiar.1
Associate II

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

5 REPLIES 5
Bouraoui Chemli
ST Employee

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

Is there a viable CAN bus and devices attached to the system?​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

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)

Yes, as I said to Mr. Chemli, it is connected to an F4 which is in WFI

LSant.6
Associate II

hey did you find a solution? i have the same issue with the same chip that nothing leaves my tx fifo...