AnsweredAssumed Answered

CAN frames timestamping

Question asked by tinito on Jun 19, 2012
Hi, I'm trying to benchmark a real-time CAN bus protocol exploiting the TTCAN features of the STM32 CAN controller.
Enabling CAN_MCR->TTCM and reading CAN_RDTR->TIME should give a precise timestamp expressed in bit time, that is the free running CAN timer value caputerd on SOF detection, as pointed out in the reference manual.
Anyway, with 1MBPs CAN configuration and sending a message every 1ms the difference between two consecutive timestamps is about 59000, while I was expecting 1000 (if the timer is incremented each bit time) or 9000 (if it is incremented each time quanta).

What am I missing?

My CAN configuration is:
APB1=36Mhz
BRP=3
TS1=4
TS2=2
bit_time = (1 + (1+TS1) + (1+TS2)) / (f_APB / (BRP+1)) = (1+(4+1)+(2+1)) / (36e6 / (3+1)) = 1e-6

Outcomes