FlexCAN Timer register behavior in RxFIFO mode

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

FlexCAN Timer register behavior in RxFIFO mode

Jump to solution
716 Views
yfliu
Contributor IV

Hi,

I am using S32K146's RxFIFO feature of FlexCAN device CAN0 for message receiving experiments. My intention is to get the current value of the free-run timer in FlexCAN module so that to compare it with the timer value in can_message_t.cs field of the received message.

Here are my settings:

  • FlexCAN is using external 8Mhz clock;
  • Message format is 8 byte standard CAN message;
  • CAN speed is 500Kbps

Upon receiving a new CAN message, the FlexCAN TIMER register value is read and compared with the value in the .cs field of the message. We found the delta is about 115 most of the time, which we don't know how to interpret.

If the stamp in .cs field means the starting of the CAN message, then the delta shall be equivalent to the time needed to receive the whole message from CAN bus -- this shall be 216us, if the free runner timer is ticking at 8Mhz, then the delta shall be 216*8=1728. This is not in line with the value 115.

Can anyone help on this topic?

 

 

 

 

 

 

 

0 Kudos
1 Solution
708 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

The timer is clocked by the FlexCAN bit-clock, which defines the baud rate on the CAN bus. During a message transmission/reception, it increments by one for each bit that is received or transmitted. When there is no message on the bus, it counts using the previously programmed baud rate. 
The timer value is captured when the second bit of the identifier field of any frame is on the CAN bus.

Standard ID frame with 8byte payload is 108 bits long, there can be additional stuff bits, so difference of 115 you got is reasonable.

BR, Petr 

View solution in original post

1 Reply
709 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

The timer is clocked by the FlexCAN bit-clock, which defines the baud rate on the CAN bus. During a message transmission/reception, it increments by one for each bit that is received or transmitted. When there is no message on the bus, it counts using the previously programmed baud rate. 
The timer value is captured when the second bit of the identifier field of any frame is on the CAN bus.

Standard ID frame with 8byte payload is 108 bits long, there can be additional stuff bits, so difference of 115 you got is reasonable.

BR, Petr