CAN MCAL

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CAN MCAL

Jump to solution
1,291 Views
MridulBajaj
Contributor I

 

Hi,

I am trying to implement CAN communication using the AUTOSAR MCAL layer on the S32K144 MCU. I am able to transmit data successfully, but I am not able to receive any data.

I am using the polling method (not interrupts), and currently calling the following API periodically:

Can_MainFunction_Read();
 
  • Is this API sufficient for receiving CAN messages in polling mode?

  • Do I need to use any other API along with it to receive messages properly?

  • Could you please share an example or reference code to implement CAN reception using AUTOSAR MCAL (polling mode) on S32K144?

0 Kudos
Reply
1 Solution
1,212 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

you can check within debugger if message is really received. Inspect used MB area, MB flag.
Also be sure no error is detected during reception, otherwise message is not moved-in and no MB flag will be set, check ECR/ESR1 registers.

BR, Petr

View solution in original post

0 Kudos
Reply
4 Replies
1,249 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

yes, it is enough to call MainFunction_Read periodically. Upon reception you should get CanIf_RxIndication callback.
Refer e.g to RTD200 demo example, which is using polling mode for both TX and RX.

BR, Petr

0 Kudos
Reply
1,233 Views
MridulBajaj
Contributor I
When I try to debug my code, it’s not entering the Rx callback function. It gets stuck in the Can_Ipw_MainFunction_Read() function, where the Message Buffer (MB) state is not IDLE.
How can I resolve this issue?
0 Kudos
Reply
1,213 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

you can check within debugger if message is really received. Inspect used MB area, MB flag.
Also be sure no error is detected during reception, otherwise message is not moved-in and no MB flag will be set, check ECR/ESR1 registers.

BR, Petr

0 Kudos
Reply
1,179 Views
MridulBajaj
Contributor I
Thank you. I have figured out the solution.
0 Kudos
Reply