AnsweredAssumed Answered

S32 LIN Component

Question asked by Philipp Kolb on Dec 15, 2017

Hi,

 

I try to use the LIN component of the processor expert, but I have some questions regarding the documentation and the usage of the component.

 

 

/* Global variables */
uint16_t timerCounterValue[2] = {0u};
uint16_t timerOverflowInterruptCount = 0u;
/* Callback function to get time interval in nano seconds */
uint32_t timerGetTimeIntervalCallback0(uint32_t *ns)
{
timerCounterValue[1] = (uint16_t)(ftmBase->CNT);
*ns = ((uint32_t)(timerCounterValue[1] + timerOverflowInterruptCount*65536u - timerCounterValue[0]))*1000 / TIMER_1US;
timerOverflowInterruptCount = 0U;
timerCounterValue[0] = timerCounterValue[1];
return 0U;
}

I don't get the usage of this callback function, it always returns zero, are the global vars polled by the driver?

Must this function be called by an timer interrupt? And if yes, wich is the necessary intervall 0.1µs?

 

I wanted to use the flexTimer1 for the LIN stack, but I haven’t found any corresponding part for „ftmBase->CNT“.

I assume that at this point the current timer value is read.

And the define TIMER_1US is just a placeholder for the nano second calculation, depending on the max timer value?

 

It would be appreciated if someone can give me a hint.

Outcomes