2025-02-10 11:36 PM - last edited on 2025-02-11 12:31 AM by SofLit
Hi all,
I am configuring FDCAN3 on the STM32H723 to receive data for a specific ID, but I'm encountering an issue. Here's what I've done so far:
We have configured the FDCAN filter as follows:
Filter_config_def.IdType = FDCAN_STANDARD_ID;
Filter_config_def.FilterIndex = 0;
Filter_config_def.FilterType = FDCAN_FILTER_MASK;
Filter_config_def.FilterConfig = FDCAN_FILTER_TO_RXFIFO0;
Filter_config_def.FilterID1 = 0x7E8;
Filter_config_def.FilterID2 = 0x7E8;
Filter_config_def.RxBufferIndex = 0;
Then, we applied the filter using:
if (HAL_FDCAN_ConfigFilter(&hfdcan3, &Filter_config_def) != HAL_OK) {
Error_Handler();
}
However, I am still receiving all IDs, such as 0x90, 0x7E8, and 0x110, even though I only expect 0x7E8. I would like to call the callback function only when data with ID 0x7E8 is received.
Here is the relevant configuration for FDCAN3:
hfdcan3.Instance = FDCAN3;
hfdcan3.Init.FrameFormat = FDCAN_FRAME_FD_NO_BRS;
hfdcan3.Init.Mode = FDCAN_MODE_NORMAL;
hfdcan3.Init.AutoRetransmission = DISABLE;
hfdcan3.Init.TransmitPause = DISABLE;
hfdcan3.Init.ProtocolException = DISABLE;
hfdcan3.Init.NominalPrescaler = 50;
hfdcan3.Init.NominalSyncJumpWidth = 1;
hfdcan3.Init.NominalTimeSeg1 = 2;
hfdcan3.Init.NominalTimeSeg2 = 2;
hfdcan3.Init.DataPrescaler = 1;
hfdcan3.Init.DataSyncJumpWidth = 1;
hfdcan3.Init.DataTimeSeg1 = 1;
hfdcan3.Init.DataTimeSeg2 = 1;
hfdcan3.Init.MessageRAMOffset = 0;
hfdcan3.Init.StdFiltersNbr = 1;
hfdcan3.Init.ExtFiltersNbr = 0;
hfdcan3.Init.RxFifo0ElmtsNbr = 2;
hfdcan3.Init.RxFifo0ElmtSize = FDCAN_DATA_BYTES_8;
hfdcan3.Init.RxFifo1ElmtsNbr = 1;
hfdcan3.Init.RxFifo1ElmtSize = FDCAN_DATA_BYTES_8;
hfdcan3.Init.RxBuffersNbr = 1;
hfdcan3.Init.RxBufferSize = FDCAN_DATA_BYTES_8;
hfdcan3.Init.TxEventsNbr = 1;
hfdcan3.Init.TxBuffersNbr = 1;
hfdcan3.Init.TxFifoQueueElmtsNbr = 2;
hfdcan3.Init.TxFifoQueueMode = FDCAN_TX_FIFO_OPERATION;
hfdcan3.Init.TxElmtSize = FDCAN_DATA_BYTES_8;
Any insights or suggestions on how to configure the filter or callback to only process messages with ID 0x7E8 would be greatly appreciated.
Best regards,
Aashritha
2025-02-11 12:21 AM - edited 2025-02-11 12:31 AM
Hello,
First you need to describe what the issue is:
@Aashritha_Vuda wrote:
Hi all,
I am configuring FDCAN3 on the STM32H723 to receive data for a specific ID, but I'm encountering an issue.
Second, please use </> button to paste your code. I'm editing your post.
Third, this post was posted in STM32CubeIDE which doesn't have any relation to the IDE. Needs to be moved to STM32 MCU products (linked to the MCU usage).
2025-02-11 12:29 AM
After editing your post, I've noticed the description in the middle. That's why you need to use </> button for the code.
Try this
Filter_config_def.FilterType = FDCAN_FILTER_MASK;
Filter_config_def.FilterConfig = FDCAN_FILTER_TO_RXFIFO0;
Filter_config_def.FilterID1 = 0x7E8;
Filter_config_def.FilterID2 = 0x7FF;
+
HAL_FDCAN_ConfigGlobalFilter(&hfdcan3, FDCAN_REJECT, FDCAN_REJECT, FDCAN_REJECT_REMOTE, FDCAN_REJECT_REMOTE);
2025-02-11 12:35 AM - edited 2025-02-11 12:35 AM
Another remark:
Avoid this kind of timing configuration:
hfdcan3.Init.NominalPrescaler = 50;
hfdcan3.Init.NominalSyncJumpWidth = 1;
hfdcan3.Init.NominalTimeSeg1 = 2;
hfdcan3.Init.NominalTimeSeg2 = 2;
hfdcan3.Init.DataPrescaler = 1;
hfdcan3.Init.DataSyncJumpWidth = 1;
hfdcan3.Init.DataTimeSeg1 = 1;
hfdcan3.Init.DataTimeSeg2 = 1;
Very low TSEG1 and TSEG2 values.
You can use this link for CAN bit time calculation to select the suitable values of TSEG1 and TSEG2.
2025-02-11 12:49 AM
Check if you have enabled the interrupts for the FIFO.