cancel
Showing results for 
Search instead for 
Did you mean: 

RECIVE MESSAGE IN FIFO1 ON CAN BUS

l90mehdi
Associate II
Posted on August 30, 2016 at 16:45

hi evry one

i working on CAN protocol with stm32f103rbt6.it working so good.

now problem is here: when i reading mailboxs of FIFO0 ،all think is ok but i can not receive the message from FIFO1.

please tell me how to do this

thank you

11 REPLIES 11
Walid FTITI_O
Senior II
Posted on August 31, 2016 at 14:09

Hi khastar.mehdi,

To make thing more clear , are you using both FIFO0 and FIFO1 ? are you configuring filters ?

-Hannibal-

l90mehdi
Associate II
Posted on August 31, 2016 at 14:50

Hi Hannibal 

yes. I configure my filter for FIFO1.But i can not Receive any thing.

sFilterConfig.FilterNumber = 2;

sFilterConfig.FilterMode = CAN_FILTERMODE_IDLIST;

sFilterConfig.FilterScale = CAN_FILTERSCALE_16BIT;

sFilterConfig.FilterIdHigh = 0xFEEF;       

sFilterConfig.FilterIdLow = 0xF7E0;            

sFilterConfig.FilterMaskIdHigh = 0x3DF8;

sFilterConfig.FilterMaskIdLow = 0xFFF8;

sFilterConfig.FilterFIFOAssignment = 1;

sFilterConfig.FilterActivation = ENABLE; 

and i use this code for receive message in interrupt mode

HAL_CAN_Receive_IT(&hcan,1);

but i do not receive any interrupt event in this mode

so 

please tell me what do i do????

thank you 

Posted on August 31, 2016 at 18:19

What messages exactly are you trying to receive? Please try to provide some context.

The filter looks badly created, it will filter a subset of messages with these IDs and RTR/IDE/EXID bits

FEEF : 7F7

F7E0 : 7BF

3DF8 : 1EF

FFF8 : 7FF

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
l90mehdi
Associate II
Posted on August 31, 2016 at 21:42

hi clive1.thank you for your feedback.

yes .my filter receive the messages with  : 0x7F7 - 0x7BF- 0x1EF- 0x7FF  IDs

all messages receive by FIFO0 without problem.

but i can not receive any message in FIFO1.

in user manual :

Receive FIFO

Two receive FIFOs are used by hardware to store the incoming messages. Three complete

messages can be stored in each FIFO.

The FIFOs are managed completely by hardware

.

so how can receive message in FIFO1???????

thank you

Posted on August 31, 2016 at 23:09

I'm not using F1 with HAL, so not going to be able to provide you with much assistance as it relates to functionality there.

Do you fully initialize the filter structure? BankNumber?

Do you get an error reported by HAL when configuring the filter?

Do you enable the right IRQ?

Try using the 16 or 32-bit ID's where you just mask the message bits, rather than use the list format.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
l90mehdi
Associate II
Posted on September 01, 2016 at 10:23

yes.i fully initialize the filters and it works good.

no.i do not get any error. 

i can receive messages in interrupt mode from FIFO0.

so IRQ settings is true.

i do not where is problem??

can you receive message from FIFO1????

if yes how do you do it??

thank you

jpeacock23
Associate III
Posted on September 01, 2016 at 14:37

Your code shows filter 2.  What are the settings for other filters.  It may be your message matches a higher priority filter first, sending it to the wrong FIFO.  Does your message arrive on FIFO0?

Are you sure the message being sent has the right ID?

  Jack Peacock

l90mehdi
Associate II
Posted on September 01, 2016 at 15:56

hi peacock.

yes i receive message in FIFO0.

with this filter configuration . when i use ''HAL_CAN_Receive_IT(&hcan,0)'' i receive message from FIFO0 but when i use ''HAL_CAN_Receive_IT(&hcan,1)'' i can not receive any message.

in filter configuration، change the fifo number and filter bank number has no effect.

can you receive message from FIFO1?

if yes please put your code and filter configuration.

thank you

Walid FTITI_O
Senior II
Posted on September 01, 2016 at 17:06

Hi khastar.mehdi,

It is related to a recent reported bug in Receive function about FiFONumber. It is under fix phase. Meanwhile , add the following line into can_Receive_IT() function before FMI line :

hcan->pRxMsg->FIFONumber = FIFONumber;

Check threads related to this topic:

[DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Configure%20CAN%20to%20receive%20in%20both%20FIFOs&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=53]thread1[DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32Java/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32Java/%5bSTM32F2%5d%20issue%20with%20CAN-HAL%20interrupt%20receivng&FolderCTID=0x01200200770978C69A1141439FE559EB459D758000F9A0E3A95BA69146A17C2E80209ADC21&currentviews=18]thread2

-Hannibal-