S32K144 FLEXCAN RX mailbox identification

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32K144 FLEXCAN RX mailbox identification

Jump to solution
1,026 Views
szblaci
Contributor III

Hi,

I am using S32K144 MCU for a CAN application with flexcan driver from SDK. I configured dedicated MBs for every incoming messages, RX FIFO is not used.

The CAN0_ORed_0_15_MB_IRQHandler is called for RX messages, this is fine. I also installed a CB function to monitor the CAN activity which is invoked from the IRQ handler.

How can I find out in the CB which mailbox caused the interrupt? As I see the IFLAG is cleared by the IRQ handler before calling my function.    

Thanks in advance!

Laszlo

Labels (1)
Tags (3)
0 Kudos
Reply
1 Solution
998 Views
szblaci
Contributor III

Hello VanaB,

Meanwhile I have realized that I used wrong type of callback function. The right one has the buffIdx as a parameter so I can identify the mailbox. (In the FlexCANState structure we have callback and an error_callback functions and they have different signature)

Sorry for waisting your time.

 

 

View solution in original post

0 Kudos
Reply
3 Replies
1,009 Views
szblaci
Contributor III

Hello VaneB,

I have added a callback function using FLEXCAN_DRV_InstallEventCallback driver API. In this function I can check what kind of event provoked the interrupt (FLEXCAN_EVENT_RX_COMPLETE or FLEXCAN_EVENT_TX_COMPLETE) but I do not know how to identify the source mailbox. 

Maybe my concept is wrong or I misunderstood something. I would like to implement an interrupt based CAN communication. When a certain frame is received I should copy the data and notify the corresponding software module in the upper layer that its data buffer is updated. So somehow I should know which frame (or mailbox / message buffer) activated the IRQ handler. 

The description of the interrupt hander says that "indicating a successful transmission or reception for Message Buffers 0-15." It checks the IFLAG register to find out the actual message buffer number but later on this information is not stored.  

 

0 Kudos
Reply
1,015 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @szblaci 

What do you mean by CB function?

0 Kudos
Reply
999 Views
szblaci
Contributor III

Hello VanaB,

Meanwhile I have realized that I used wrong type of callback function. The right one has the buffIdx as a parameter so I can identify the mailbox. (In the FlexCANState structure we have callback and an error_callback functions and they have different signature)

Sorry for waisting your time.

 

 

0 Kudos
Reply