Skip to main content
Explorer
October 14, 2024
Solved

STM32H523RET6: FDCAN ID FilterConfig

  • October 14, 2024
  • 2 replies
  • 833 views

I'm applying ID masking for filtering in the FDCAN protocol, but it's not working.

The sensor I'm using has an ID of 315. In the code, I've set it to only receive messages with an ID of 320, but it's also receiving messages with an ID of 315, which it shouldn't.

The same issue is mentioned in this link: https://community.st.com/t5/stm32-mcus-products/help-with-fd-can-filter/td-p/585525. I'm configuring all the code settings, but ID filtering in CAN FD is not working. Can anyone explain why this is happening???

CANZTFD_0-1728911277544.png

CANZTFD_1-1728911290312.png

    This topic has been closed for replies.
    Best answer by mƎALLEm

    Hello,

    As stated in a previous thread, please use </> button to share the code. No screen shots of the code please.

    Also, please don't duplicate threads.

    Add this line after your filter config:

     /* Configure global filter to reject all non-matching frames */
     HAL_FDCAN_ConfigGlobalFilter(&hfdcan, FDCAN_REJECT, FDCAN_REJECT, FDCAN_REJECT_REMOTE, FDCAN_REJECT_REMOTE

     

    2 replies

    Technical Moderator
    October 14, 2024

    Hello @CANZT-FD and welcome to the community,

    First, please use English language instead of other languages as it is an international forum. Please review our tips on posting a thread in this community: https://community.st.com/t5/community-guidelines/how-to-write-your-question-to-maximize-your-chances-to-find-a/ta-p/575228

    Approximate translation:

    I am implementing ID masking for filtering in FDCAN protocol but it is not working.

    The sensor I am using has ID 315. In the code, I have set it to receive only messages with ID 320, but it is also receiving messages with 315 which it should not.

    https://community.st.com/t5/stm32-mcus-products/help-with-fd-can-filter/td-p/585525
    The same problem is also mentioned in this link. I have configured all the code settings, but ID filtering in CAN FD is not working. Can anyone explain why???

    Second, you need to provide more details about the MCU part number you are using, which board? share your code either by attaching the project (compressed) or paste your code using </> button.

    Thank you for your understanding.

    mƎALLEmAnswer
    Technical Moderator
    October 14, 2024

    Hello,

    As stated in a previous thread, please use </> button to share the code. No screen shots of the code please.

    Also, please don't duplicate threads.

    Add this line after your filter config:

     /* Configure global filter to reject all non-matching frames */
     HAL_FDCAN_ConfigGlobalFilter(&hfdcan, FDCAN_REJECT, FDCAN_REJECT, FDCAN_REJECT_REMOTE, FDCAN_REJECT_REMOTE