FlexCAN Timestamp support

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

FlexCAN Timestamp support

跳至解决方案
515 次查看
anakha
Contributor III

Hi,

I try to calculate CAN Rx message period by using timestamp but it is 16 bit and overflow for higher periods. 

for testing, I am sending single CAN message for 100 times (to check fluctuation).

the measurements are like below:

Rx Period (ms)Measured timestamp (average)
105000
2010600
5025000
10050000
20034470 ( + 65535(overflow) = 100000)
100041200 
200017000
1573 (this fluctuate between 125 and 1000)

 

The baudrate is 500 kbps and FlexCAN runs at 80 Mhz. 

 

  • How can 500 is approximately refers to 1ms?
  • It seems there is a correlation but timestamp is 16bit and only counts to 65535. So, it overflows at 200ms for example. How can I understand if it overflows and how many times?
  • How can I activate HR timestamp as seen at below? I am using RTD 3.0.0 with S32DS 3.5

erinc_0-1720176272844.png

  • Is there a way to change CTRL2?

thanks in advance.

 

标记 (3)
0 项奖励
回复
1 解答
449 次查看
Senlent
NXP TechSupport
NXP TechSupport

Hi@erinc

Q1.How can 500 is approximately refers to 1ms?

I think you have misunderstood. This timestamp should be the interval between the start or end of each frame, not the time it takes for a frame to be transmitted.

 

Q2.It seems there is a correlation but timestamp is 16bit and only counts to 65535. So, it overflows at 200ms for example. How can I understand if it overflows and how many times?

Yes, the default is the Free running 16-bit timer, which has no overflow flag(i didn't see), but you can set CRTL1[TSYN] = 1, so that the timer will automatically reset after receivied Frame.

 

Q3.How can I activate HR timestamp as seen at below? I am using RTD 3.0.0 with S32DS 3.5

a.You need to enable the following options:

Senlent_0-1720519877698.png

b.You need to configure Stm for HR timestamp.(ps,:you can refer to "Stm_Gpt_Example_S32k344")

c.Read HR timestamp, for example:

temp = (uint32)IP_CAN_0->HR_TIME_STAMP[mb_idx];

Also,You can enable the interrupt of Stm and record the number of overflows of Stm

 

在原帖中查看解决方案

0 项奖励
回复
2 回复数
450 次查看
Senlent
NXP TechSupport
NXP TechSupport

Hi@erinc

Q1.How can 500 is approximately refers to 1ms?

I think you have misunderstood. This timestamp should be the interval between the start or end of each frame, not the time it takes for a frame to be transmitted.

 

Q2.It seems there is a correlation but timestamp is 16bit and only counts to 65535. So, it overflows at 200ms for example. How can I understand if it overflows and how many times?

Yes, the default is the Free running 16-bit timer, which has no overflow flag(i didn't see), but you can set CRTL1[TSYN] = 1, so that the timer will automatically reset after receivied Frame.

 

Q3.How can I activate HR timestamp as seen at below? I am using RTD 3.0.0 with S32DS 3.5

a.You need to enable the following options:

Senlent_0-1720519877698.png

b.You need to configure Stm for HR timestamp.(ps,:you can refer to "Stm_Gpt_Example_S32k344")

c.Read HR timestamp, for example:

temp = (uint32)IP_CAN_0->HR_TIME_STAMP[mb_idx];

Also,You can enable the interrupt of Stm and record the number of overflows of Stm

 

0 项奖励
回复
463 次查看
Senlent
NXP TechSupport
NXP TechSupport

Hi@erinc

I am working on your question.

It will take some time because there are fewer questions about FlexCAN Timestamp.

I need some time to do some testing.

0 项奖励
回复