S32K144 FLEXCAN RX mailbox identification

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

S32K144 FLEXCAN RX mailbox identification

跳至解决方案
1,282 次查看
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

标签 (1)
标记 (3)
0 项奖励
回复
1 解答
1,254 次查看
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 项奖励
回复
3 回复数
1,265 次查看
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 项奖励
回复
1,271 次查看
VaneB
NXP TechSupport
NXP TechSupport

Hi @szblaci 

What do you mean by CB function?

0 项奖励
回复
1,255 次查看
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 项奖励
回复