cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G474 CAN FD no priorization of CAN IDs?

ATrug.1
Associate II

I have multiple CAN FD Participant which are configured the same way:

if (canFdMode == canFdModes_2mbit) {
		hfdcan1.Instance = FDCAN1;
		hfdcan1.Init.ClockDivider = FDCAN_CLOCK_DIV1;
		hfdcan1.Init.FrameFormat = FDCAN_FRAME_FD_BRS;
		hfdcan1.Init.Mode = FDCAN_MODE_NORMAL;
		hfdcan1.Init.AutoRetransmission = ENABLE;
		hfdcan1.Init.TransmitPause = DISABLE;
		hfdcan1.Init.ProtocolException = DISABLE;
		hfdcan1.Init.NominalPrescaler = 1;
		hfdcan1.Init.NominalSyncJumpWidth = 1;
		hfdcan1.Init.NominalTimeSeg1 = 127;
		hfdcan1.Init.NominalTimeSeg2 = 32;
		hfdcan1.Init.DataPrescaler = 2;
		hfdcan1.Init.DataSyncJumpWidth = 4;
		hfdcan1.Init.DataTimeSeg1 = 31;
		hfdcan1.Init.DataTimeSeg2 = 8;
		hfdcan1.Init.StdFiltersNbr = 0;
		hfdcan1.Init.ExtFiltersNbr = 0;
		hfdcan1.Init.TxFifoQueueMode = FDCAN_TX_FIFO_OPERATION;
		if (HAL_FDCAN_Init(&hfdcan1) != HAL_OK) {
			Error_Handler();
		}
 
		if (HAL_FDCAN_ConfigGlobalFilter(&hfdcan1,
		FDCAN_ACCEPT_IN_RX_FIFO0, FDCAN_ACCEPT_IN_RX_FIFO0,
		FDCAN_FILTER_REMOTE, FDCAN_FILTER_REMOTE) != HAL_OK) {
			Error_Handler();
			return;
		}
 
		if (HAL_FDCAN_ActivateNotification(&hfdcan1,
		FDCAN_IT_RX_FIFO0_NEW_MESSAGE, 0) != HAL_OK) {
			Error_Handler();
			return;
		}
 
		if (HAL_FDCAN_ConfigTxDelayCompensation(&hfdcan1, hfdcan1.Init.DataTimeSeg1 * hfdcan1.Init.DataPrescaler, 0) != HAL_OK) {
			Error_Handler();
		}
 
		if (HAL_FDCAN_EnableTxDelayCompensation(&hfdcan1) != HAL_OK) {
			Error_Handler();
		}
 
		if (HAL_FDCAN_Start(&hfdcan1) != HAL_OK) {
			Error_Handler();
		}

Communication works perfectly fine.

Problem is, when I have a Bus Load of 100%, I expect my devices to priorize the messages following the CAN rules, which is by Message ID.

To test this, I filled every Pariticipants TX Buffer with a rotation of the Message IDs 0x10x, 0x20x, 0x30x.

E.G.

Node 1: 0x101, 0x201, 0x301, 0x101, 0x201 .....

Node 2: 0x102, 0x202, 0x302, 0x102, 0x202 .....

What I expect: Node 1 and 2 are alternating with sending their messages.

What happens: Only 1 Node is sending all the time.

Whats the problem here?

1 REPLY 1
ATrug.1
Associate II

bump