How to use FlexCAN_Ip in S32K344

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

How to use FlexCAN_Ip in S32K344

ソリューションへジャンプ
6,491件の閲覧回数
MateoSegura413
Contributor III

Hello,

I am currently trying to implement a simple example described below

- S32K344 FlexCAN module will interrupt whenever it get's a message, at which point a new RTOS thread will read the values from the message received.

I started the project using the "FlexCAN_Ip_Example_S32K344", however it is not clear at all how to use this IP to get anything useful done. 

- How do I link my own code the interrupt handler?

- How do I read CAN without wasting CPU cycles?

Any help or guidance would be greatly appreciated.

Mateo Segura 

0 件の賞賛
返信
1 解決策
6,399件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

testing your code I got FLEXCAN_EVENT_TX_COMPLETE event in the callback, red LED is flashing with 1sec rate. Enabling receive on MB1 by uncommenting below line

PetrS_0-1645186823162.png

a FLEXCAN_EVENT_RX_COMPLETE event is hit too and green LED is also toggled.

BR, Petr

元の投稿で解決策を見る

0 件の賞賛
返信
4 返答(返信)
6,455件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

the FlexCAN_Ip_Example_S32K344 do simple transmit/receive testing in loopback mode. NOt sure if thee is anything with freeRTOS too.
Generally, if you do not want to have SW polling, you can install callback function which will be called from MB's interrupt. Within flexcan component add 

PetrS_0-1644329659210.png

 

if send/receive function will be called with parameter indicating non-polled mode then callback function will be called upon successful transmission or reception. 
you can check attached modified code for this example.

Hope it helps

BR, Petr

0 件の賞賛
返信
6,412件の閲覧回数
MateoSegura413
Contributor III

Hey @PetrS, first of, thank you very much for your response.

I tried to incorporate your example into a design studio project, but unfortunately the callback is not being called. I have tried it in loopback mode as well as out to a CAN tranceiver connected to a test board and no results either way. I have attached the project, is there anyway you could please take a quick look at it and tell me what I'm doing wrong?

Thanks...

0 件の賞賛
返信
6,400件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

testing your code I got FLEXCAN_EVENT_TX_COMPLETE event in the callback, red LED is flashing with 1sec rate. Enabling receive on MB1 by uncommenting below line

PetrS_0-1645186823162.png

a FLEXCAN_EVENT_RX_COMPLETE event is hit too and green LED is also toggled.

BR, Petr

0 件の賞賛
返信
6,354件の閲覧回数
MateoSegura413
Contributor III

This worked. Thank you!

0 件の賞賛
返信