S32K MCAL, CAN Transmission stops after all MBs are used up

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

S32K MCAL, CAN Transmission stops after all MBs are used up

Jump to solution
1,185 Views
cbhavi
Contributor III

Hello,

I am using Autosar MCAL v1.0.1 for S32K118 eval board. I have generated a config from EB-Tresos for the CAN module with 5 MBs defined for the Tx Hardware object. In my source code, after Can_Init if I run Can_Write in a loop, the number of times the message is transmitted is always equal to the number of MBs that are defined for module.

Is there some additional setting to be done in order to clear and reuse the MBs for subsequent transmissions? Or the MCAL takes care of this automatically but some other step is missing in order to do this?

0 Kudos
1 Solution
1,133 Views
cbhavi
Contributor III

Hello,

Thank you for pointing me towards the ISRs. I checked them and they are all disabled in the sources based on my CAN configuration in Tresos.

However, I figured out the issue. It seems that the interrupts have to be explicitly enabled after init routines to be able to generate interrupts. Just setting the CAN TX and RX to interrupt mode is Tresos doesnt automatically do this.

So this, along with the linker file changes that I had done seems to make the CAN interrupts work as expected.

View solution in original post

0 Kudos
3 Replies
1,169 Views
cbhavi
Contributor III

So I realized that the MB-IF flags are to be cleared once a message has been sent. There are interrupts for the same which have been enabled in the Tresos config.

However, what i am now stuck with is that the interrupts never trigger as expected. I have mapped them to the startup file available with the default S32K118 project (see attached picture), but still the interrupts are not generated. How do i make this work?

0 Kudos
1,140 Views
cuongnguyenphu
NXP Employee
NXP Employee

Can you try to use ISR's name defined in Integration Manual which is included in doc/ folder in your product installed directory:
For example, below is ISR table for CAN driver in S32K14X_MCAL4_3_RTM_1_0_1:

cuongnguyenphu_0-1652724575671.png

These ISR already defined in CAN module source code, you don't need to define again

0 Kudos
1,134 Views
cbhavi
Contributor III

Hello,

Thank you for pointing me towards the ISRs. I checked them and they are all disabled in the sources based on my CAN configuration in Tresos.

However, I figured out the issue. It seems that the interrupts have to be explicitly enabled after init routines to be able to generate interrupts. Just setting the CAN TX and RX to interrupt mode is Tresos doesnt automatically do this.

So this, along with the linker file changes that I had done seems to make the CAN interrupts work as expected.

0 Kudos