cancel
Showing results for 
Search instead for 
Did you mean: 

CAN Communication in normal mode in STM32F407

rohitkumarkv07
Associate III

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.

1 ACCEPTED SOLUTION

Accepted Solutions
SofLit
ST Employee

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.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

View solution in original post

2 REPLIES 2
SofLit
ST Employee

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.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
SofLit
ST Employee

Hello,

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

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.