cancel
Showing results for 
Search instead for 
Did you mean: 

Timestamp with can_message.h is not working

TGIRA.1
Associate II

I try to use the timestamp function from can_message.h to know the timestamp of a message received on the CAN.

But the value is every time 0. Is it a knowed bug?

Because I use this function with another hardware without problem.

With STM32 I'm not able to see an error when a can message is not received by the MCU

Thank you

2 REPLIES 2
YS.K
Associate III

The STM32 CAN controllers has timestamp register. in STM32 bxCAN reference manual, this one has a register.

Check out CAN_RDTxR. It has timestamp field.

This field contains the 16-bit timer value captured at the SOF detection.

Each mailbox will have all info (ID, Data, Timestamp, Error count etc) related to that message.

Timestamp mode is enabled when the next bit is set to 1 in Initialization.

CAN_MCR register

TTCM (Time Triggered Communication Mode) bit

Thank you for your response,

But I don't know how to make it working in Simulink.

I tried to enable the TTCM in cubeMX on CAN1 with no more success

In simulink I use interupt to receive CAN message and in the toolbox CAN_read_Data I checked Output CAN_MESSAGE type like that I can use CAN_unpack with .dbc file to read my can message.

On the CAN_unpack toolbox I check the option output timestamp and I have a timastamp output from CAN_unpack. But the timastamp value is every time 0...

I use this toolbox with another hardware (Speedgoat) and the timestamp output work perfectly.

I don't know if it can work on simulink and I just don't know how to make it worked, or if it's a real problem.

Do you know how I can set it to make it work?

Thanks