S32K148 flexcan driver

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

S32K148 flexcan driver

1,256件の閲覧回数
pranitekatpure
Contributor I

Is there any way/interrupt handler that notifies CAN message has received on device? 

I have used FLEXCAN_DRV_InstallEventCallback() to install callback for MBs which triggers when FLEXCAN_DRV_Receive() is called first. For which FLEXCAN_DRV_Receive() to be called continuously or polled.

But in my application, I want to get notified that CAN message has received on device and I can now call FLEXCAN_DRV_Receive() and read the message in the user buffer. Is it possible? If yes how?

(I'm using flexcan SDK drivers.)

 

0 件の賞賛
返信
3 返答(返信)

1,235件の閲覧回数
pranitekatpure
Contributor I

Thanks, @PetrS.

That is okay in case of MB interrupt. I asking about interrupt when the message is received by device (like UART interrupt is generated when a packet is received in internal UART buffer registers then it can be read, in some MCUs). I want to avoid FLEXCAN_DRV_Receive function call in while loop or periodic call. 

0 件の賞賛
返信

1,224件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

 

if using SDK driver it does not give you a notification about message reception, there is no function for it. FLEXCAN_DRV_Receive updates some internal driver variable and enable MB interrupt. Thus if new message is received or there is already some in the MB (MB flag is set) the interrupt is called and within this interrupt message is read out from that MB, driver variable is updated and MB interrupt is disabled.

So you can check directly IFLAG register for MB flag, then call FLEXCAN_DRV_Receive.

 

BR, Petr 

 

0 件の賞賛
返信

1,241件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

 

each time you want to receive new message into MB you need to call FLEXCAN_DRV_Receive. Once message is accepted then an MB interrupt is entered and a callback (if installed) is called. Thus this callback is a good way to know a message is received.

Also within your code (main while loop etc) you can call FLEXCAN_DRV_GetTransferStatus to ascertain the state of the current receive progress: in progress (or busy) or complete (success).

 

BR, Petr

0 件の賞賛
返信