How to use FlexCan interrupt to recieve can data on S32R45

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

How to use FlexCan interrupt to recieve can data on S32R45

Jump to solution
2,965 Views
aiweixin
Contributor IV

Hi,

The flexCan demo use polling to recieve data, i want to use flexCan interrupt.

I have made flexCan0 IRQ enable, and defined callback function.

aiweixin_0-1670902746522.pngaiweixin_1-1670902759317.png

aiweixin_2-1670902800976.png

According to (https://community.nxp.com/t5/S32K/Flexcan-interrupt-mode/m-p/785362), define callback function formit (See attachment).

But, it is not working normally. The first time can enter this function, second and others not enter IRQ function.

On debug:

TX mailbox is MB0, RX mailbox is MB1.

The first time, execute FlexCAN_Ip_Send(), Register IFLAG1 BIT0 and BIT1 is '1', transmit interrupt and reciver interrupt trigger(transmit interrupt not enable); after recieve interrupt callback, BIT1 clear.

aiweixin_0-1670924707110.jpeg

then with debug tools, force to clear BIT0.

aiweixin_1-1670925698847.png

Second time, execute FlexCAN_Ip_Send(), Register IFLAG1 BIT0 and BIT1 no change. It seem abnormal.

aiweixin_2-1670925787787.png

Labels (1)
Tags (3)
0 Kudos
Reply
1 Solution
2,917 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

if selecting polling mode for sending message you should call FlexCAN_Ip_MainFunctionWrite to process transmitted Tx MessageBuffer, or do not select polling mode and it will be done within message interrupt.
Do not have code for S32R45 but attached is the code for S32K3xx, which should be similar. It shows usage of callback.

Hope it helps.

BR, Petr 

View solution in original post

0 Kudos
Reply
3 Replies
2,918 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

if selecting polling mode for sending message you should call FlexCAN_Ip_MainFunctionWrite to process transmitted Tx MessageBuffer, or do not select polling mode and it will be done within message interrupt.
Do not have code for S32R45 but attached is the code for S32K3xx, which should be similar. It shows usage of callback.

Hope it helps.

BR, Petr 

0 Kudos
Reply
2,082 Views
Lita
Contributor II

The chip I am using is S32K314, I have the same problem, can cannot enter the interrupt, I refer to the MAIN.c file you sent, still can not enter the interrupt. How can I fix it? Thank you!

0 Kudos
Reply
2,853 Views
aiweixin
Contributor IV

Thank you for your help, it's very useful.

0 Kudos
Reply