How to use FlexCAN_Ip in S32K344

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

How to use FlexCAN_Ip in S32K344

跳至解决方案
6,448 次查看
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,356 次查看
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,412 次查看
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,369 次查看
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,357 次查看
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,311 次查看
MateoSegura413
Contributor III

This worked. Thank you!

0 项奖励
回复