Skip to main content
Explorer
June 3, 2024
Solved

CAN Communication in normal mode in STM32F407

  • June 3, 2024
  • 2 replies
  • 1303 views

I want to receive the MessageRx_CAN [8] in my RxFifo 0 buffer but i cannot get that. Could you please help me out how can i implement that to get if want this requirment.

DLC = 8;

StdId = 0x245;

IDE = CAN_ID_STD;

RTR = CAN_RTR_DATA;

I have attachted my GetRxFifoMessage function part.

Kindly check and correct and resolve my issue asap.

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

    Hello @rohitkumarkv07 

    First, please review our recommendations on how to post a thread on this community. Especially on how to share a source code: https://community.st.com/t5/community-guidelines/how-to-write-your-question-to-maximize-your-chances-to-find-a/ta-p/575228.

    Second, did you configure filters to receive CAN frames? Even to receive all possible IDs, you need to configure at least one filter for your FIFO0.

    Example:

     sFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK;
     sFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT;
     sFilterConfig.FilterIdHigh = 0x0000;
     sFilterConfig.FilterIdLow = 0x0000;
     sFilterConfig.FilterMaskIdHigh = 0x0000;
     sFilterConfig.FilterMaskIdLow = 0x0000;
     sFilterConfig.FilterFIFOAssignment = CAN_RX_FIFO0;
     sFilterConfig.FilterActivation = ENABLE;

    Don't forget to configure the filter bank:

     sFilterConfig.FilterBank = <depends on the CAN isntance used>
     sFilterConfig.SlaveStartFilterBank = <depends on the CAN isntance used>

    Hope it helps.

    2 replies

    mƎALLEmAnswer
    Technical Moderator
    June 25, 2024

    Hello @rohitkumarkv07 

    First, please review our recommendations on how to post a thread on this community. Especially on how to share a source code: https://community.st.com/t5/community-guidelines/how-to-write-your-question-to-maximize-your-chances-to-find-a/ta-p/575228.

    Second, did you configure filters to receive CAN frames? Even to receive all possible IDs, you need to configure at least one filter for your FIFO0.

    Example:

     sFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK;
     sFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT;
     sFilterConfig.FilterIdHigh = 0x0000;
     sFilterConfig.FilterIdLow = 0x0000;
     sFilterConfig.FilterMaskIdHigh = 0x0000;
     sFilterConfig.FilterMaskIdLow = 0x0000;
     sFilterConfig.FilterFIFOAssignment = CAN_RX_FIFO0;
     sFilterConfig.FilterActivation = ENABLE;

    Don't forget to configure the filter bank:

     sFilterConfig.FilterBank = <depends on the CAN isntance used>
     sFilterConfig.SlaveStartFilterBank = <depends on the CAN isntance used>

    Hope it helps.

    Technical Moderator
    June 27, 2024

    Hello,

    Did you solved your issue? Thank you to get back to us with a feedback...