2020-06-13 11:29 AM
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
2020-06-14 12:06 AM
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
2020-06-14 02:11 AM
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