cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 CAN Receive Mailbox

skhullar9
Associate
Posted on February 20, 2013 at 13:40

Hi,

I am working with STM32F101 using CAN1 controller.

I configure the CAN filter to accept messages from 0x100 to 0x1FF as follows:

CAN_FilterInitTypeDef CAN_FilterInitStructure ;

CAN_FilterInitStructure. CAN_FilterNumber = 0 ;

CAN_FilterInitStructure. CAN_FilterMode = CAN_FilterMode_IdMask ;

CAN_FilterInitStructure. CAN_FilterScale = CAN_FilterScale_16bit ;

CAN_FilterInitStructure. CAN_FilterIdHigh = 0x100 << 5 ;

CAN_FilterInitStructure. CAN_FilterIdLow = 0x200 << 5 | 0x10 ;

CAN_FilterInitStructure. CAN_FilterMaskIdHigh = 0xFE0 << 5 ;

CAN_FilterInitStructure. CAN_FilterMaskIdLow = 0xFFF << 5 | 0x10 ;

CAN_FilterInitStructure. CAN_FilterFIFOAssignment = 0 ;

CAN_FilterInitStructure. CAN_FilterActivation = ENABLE ;       

CAN_FilterInit(&CAN_FilterInitStructure);

Now when I have CAN_FilterInitStructure.CAN_FilterFIFOAssignment = 0,I get the message frames in above range successfully.

But when CAN_FilterInitStructure.CAN_FilterFIFOAssignment =1,no frames are received.

So I would like to know,what is the role of this parameter?

Is it not to set the FIFO of receive mailbox?

If not what is the way to configure the Receive mailbox FIFO?

#stm32-can
1 REPLY 1
Amel NASRI
ST Employee
Posted on February 22, 2013 at 14:45

Hi Sonam,

As explained in the stm32f10x_can.h file, CAN_FilterFIFOAssignment parameter specifies which FIFO (CAN_Filter_FIFO0 or CAN_Filter_FIFO1) to be assigned to used filter.

Then, to set the FIFO of receive mailbox, you have to use ''CAN_Receive'' function where you specify the receive FIFO number.

Go back to the standard library for more details on parameters to set for this function.

ST.MCU

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.