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
Solved! Go to Solution.
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
a FLEXCAN_EVENT_RX_COMPLETE event is hit too and green LED is also toggled.
BR, Petr
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
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
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...
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
a FLEXCAN_EVENT_RX_COMPLETE event is hit too and green LED is also toggled.
BR, Petr
This worked. Thank you!