How to use FlexCan interrupt to recieve can data on S32R45

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

How to use FlexCan interrupt to recieve can data on S32R45

ソリューションへジャンプ
6,887件の閲覧回数
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,839件の閲覧回数
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,840件の閲覧回数
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 件の賞賛
返信
6,004件の閲覧回数
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,775件の閲覧回数
aiweixin
Contributor IV

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

0 件の賞賛
返信