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

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

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

跳至解决方案
1,669 次查看
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 项奖励
回复
1 解答
1,617 次查看
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 项奖励
回复
3 回复数
1,653 次查看
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 项奖励
回复
1,624 次查看
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 项奖励
回复
1,618 次查看
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 项奖励
回复