How to use FlexCan interrupt to recieve can data on S32R45

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

How to use FlexCan interrupt to recieve can data on S32R45

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

标签 (1)
标记 (3)
0 项奖励
回复
1 解答
6,831 次查看
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 项奖励
回复
3 回复数
6,832 次查看
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 项奖励
回复
5,996 次查看
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 项奖励
回复
6,767 次查看
aiweixin
Contributor IV

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

0 项奖励
回复