You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In short I am trying to get a timestamp of a single CAN message through millis or micros using the FIFO mailbox and interrupts. This timestamp is supposed to be as precise as possible, which is why I would vastly prefer it to be queried within the interrupt or from the CAN controller(?). Using something like the following function makes millis return garbage:
Received CAN msg: ..., with timestamp: 23527, with data: ...
Received CAN msg: ..., with timestamp: 33502, with data: ...
Received CAN msg: ..., with timestamp: 43665, with data: ...
Received CAN msg: ..., with timestamp: 53472, with data: ...
Received CAN msg: ..., with timestamp: 63373, with data: ...
Received CAN msg: ..., with timestamp: 7928, with data: ...
Received CAN msg: ..., with timestamp: 17933, with data: ...
Received CAN msg: ..., with timestamp: 27911, with data: ...
Received CAN msg: ..., with timestamp: 37904, with data: ...
When printing them later outside of the interrupt the timestamp can be seen to be garbage. Am I not allowed to query the timestamp using the aforementioned functions within an interrupt? I've seen other libraries do it, so maybe it's because of the complexity of the interrupt handler. Does FlexCAN offer some alternative? CAN_message_t's timestamp is only 16-bit and I read somewhere else that it's only indicative of the tx/rx time for each message, making it useless for me. Or is there some way to make use of it here?
The text was updated successfully, but these errors were encountered:
@tonton81 do you then have any idea how I could instead track the time at which a message is received? The only other idea I have is have a function that is run every N microseconds through TeensyThreads that will then give each message the time it reads then, but this isn't really that reliable.
what i did was set a volatile global variable whenever the isr was entered and flag it in the isr, then if the isr returns to loop the flag when checked would check millis() from the loop, then unset the flag
In short I am trying to get a timestamp of a single CAN message through
millis
ormicros
using the FIFO mailbox and interrupts. This timestamp is supposed to be as precise as possible, which is why I would vastly prefer it to be queried within the interrupt or from the CAN controller(?). Using something like the following function makesmillis
return garbage:When printing them later outside of the interrupt the timestamp can be seen to be garbage. Am I not allowed to query the timestamp using the aforementioned functions within an interrupt? I've seen other libraries do it, so maybe it's because of the complexity of the interrupt handler. Does FlexCAN offer some alternative?
CAN_message_t
'stimestamp
is only 16-bit and I read somewhere else that it's only indicative of the tx/rx time for each message, making it useless for me. Or is there some way to make use of it here?The text was updated successfully, but these errors were encountered: