CAN Timestamp

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

CAN Timestamp

Jump to solution
3,629 Views
fernando_barrio
Contributor III

Hi,

I am trying to create a function that will check when the last CAN message was received, and if it has not been received within x amount of time an action will be take. My question is how do I get the current time, to be able to see the difference between the CAN Timestamp and current time? Also is this timestamp in seconds?

Thank you in advance,

Fernando

Tags (1)
1 Solution
3,439 Views
constantinrazva
NXP Employee
NXP Employee

Hello fernando.barrios@uwaterloo.ca‌, dumitru-daniel.popa‌,

Sorry for the delayed answer on this topic, I missed it; I think it was answered here . To answer the question, here is the output of the CAN block:

pastedImage_1.png

This timestamp is part of the MB structure (2B long), and is a value that the free running timer returns.

pastedImage_2.png

The TIMER_SRC bit (from CAN_CTRL2) is negated, thus the free running timer is clocked by the CAN bit-clock (the one that defines the baud rate on the CAN bus). This timer increments by one after each bit (received/transmitted); when there is no message on the bus, it counts using the programmed baud rate.

You can find out more details in the reference manual, in FlexCAN -> Functional description -> CAN protocol related features -> Timestamp. 

Kind regards,

Razvan.

View solution in original post

3 Replies
3,438 Views
Daniel_Popa
NXP Employee
NXP Employee

constantinrazvan.chivu‌,

Please have a look over this. Is it still an issue ?

0 Kudos
Reply
3,440 Views
constantinrazva
NXP Employee
NXP Employee

Hello fernando.barrios@uwaterloo.ca‌, dumitru-daniel.popa‌,

Sorry for the delayed answer on this topic, I missed it; I think it was answered here . To answer the question, here is the output of the CAN block:

pastedImage_1.png

This timestamp is part of the MB structure (2B long), and is a value that the free running timer returns.

pastedImage_2.png

The TIMER_SRC bit (from CAN_CTRL2) is negated, thus the free running timer is clocked by the CAN bit-clock (the one that defines the baud rate on the CAN bus). This timer increments by one after each bit (received/transmitted); when there is no message on the bus, it counts using the programmed baud rate.

You can find out more details in the reference manual, in FlexCAN -> Functional description -> CAN protocol related features -> Timestamp. 

Kind regards,

Razvan.

3,439 Views
fernando_barrio
Contributor III

Hi constantinrazvan.chivu‌,

Yes you did answer it on my other post, this explanation is helpful though I really appreciate it.

Thank you,

Fernando

0 Kudos
Reply