MCMCAN: Receive Timeout Mode setup

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
srgbtl
Level 1
Level 1
First reply posted 5 sign-ins First like given

Hello Community,

I want to detect a case when there are no messages received during some interval. E.g: If there are no Rx messages during 1sec some interrupt is triggered.
In the user manual (40.3.1.6, 40.4.4.9), I found that it is possible to set up receive timeout mode, but it is not clear how exactly this timer should be set up:

  • How to calculate RELOAD value?
  • Does this value reset when a message is stored in a dedicated buffer?

It would be good to see some examples of how to use it.

Currently, I implemented it this way:

// Initialization
    g_mcmcan.canNodeConfig.interruptConfig.timeoutOccurredEnabled = TRUE;
    g_mcmcan.canNodeConfig.interruptConfig.reti.priority = ISR_PRIORITY_CAN_RETI;
    g_mcmcan.canNodeConfig.interruptConfig.reti.interruptLine = IfxCan_InterruptLine_0;
    g_mcmcan.canNodeConfig.interruptConfig.reti.typeOfService = IfxSrc_Tos_cpu0;
	
	Ifx_CAN_N *nodeSfr = IfxCan_getNodePointer(g_mcmcan.canModule.can, IfxCan_NodeId_0);
	/* 
	Reload value to have an interrupt each 500ms:
	This value I get from https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/GPT12_Timer_Interrupt_1_KIT_TC397_TFT/GPT12_Timer_Interrupt.c#L41
	But seems like for CAN it should be different
	*/
    nodeSfr->NT.RTR.B.RELOAD = 48828u; 
    nodeSfr->NT.RTR.B.TEIE = 1;

 

0 Likes
1 Solution
Di_W
Moderator
Moderator
Moderator
1000 replies posted 250 solutions authored 100 likes received

 

Hi srg,

The NTRTRx Timer decremented per clock which is given by (TPSC+1) CAN bit times.

You can refer to NTCCRx.TRIGSRC and NTCCRx.TPSC.

For TRIGSRC, 000 fSYNi, 001 STM, 010 GTM

dw_1-1651572752852.png

dw

View solution in original post

1 Reply
Di_W
Moderator
Moderator
Moderator
1000 replies posted 250 solutions authored 100 likes received

 

Hi srg,

The NTRTRx Timer decremented per clock which is given by (TPSC+1) CAN bit times.

You can refer to NTCCRx.TRIGSRC and NTCCRx.TPSC.

For TRIGSRC, 000 fSYNi, 001 STM, 010 GTM

dw_1-1651572752852.png

dw