CAN Timestamp

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

CAN Timestamp

跳至解决方案
3,496 次查看
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

标记 (1)
1 解答
3,306 次查看
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 回复数
3,305 次查看
Daniel_Popa
NXP Employee
NXP Employee

constantinrazvan.chivu‌,

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

0 项奖励
回复
3,307 次查看
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,306 次查看
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 项奖励
回复