S32K144 FLEXCAN RX mailbox identification

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

S32K144 FLEXCAN RX mailbox identification

ソリューションへジャンプ
1,024件の閲覧回数
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 解決策
996件の閲覧回数
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,007件の閲覧回数
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,013件の閲覧回数
VaneB
NXP TechSupport
NXP TechSupport

Hi @szblaci 

What do you mean by CB function?

0 件の賞賛
返信
997件の閲覧回数
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 件の賞賛
返信