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
解決済! 解決策の投稿を見る。
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.
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.
Hi @szblaci
What do you mean by CB function?
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.