Hi guys,
Does anyone know what exactly is the .cs field in can_message_t struct represents?
Struct is defined as below, and I can't find a clear definition, except "Code and Status"
typedef struct {
uint32_t cs; /*!< Code and Status*/
uint32_t id; /*!< ID of the message */
uint8_t data[64]; /*!< Data bytes of the CAN message*/
uint8_t length; /*!< Length of payload in bytes */
} can_message_t;
I'm using a S32K144 EVB and a USB-CAN interface.I'm sending data from the USB-CAN interface to the SK32K144 board.
Everything works fine, but when I am receiving data from the CAN bus, this ".cs" value changes every time, apparently random, even if the data sent from the CAN adapter is the same.
已解决! 转到解答。
That fileld represents the code and status of the message buffer, you can read his description in the Chip RM "Message buffer structure" in FlexCAN module description chapter.
It encodes more fields and one of them is a Time STAMP filed "This 16-bit field is a copy of the Free-Running Timer, captured for Tx and Rx frames at the time when the beginning of the Identifier field appears on the CAN bus." This is way every time have a different value/ random see as you mention.
That fileld represents the code and status of the message buffer, you can read his description in the Chip RM "Message buffer structure" in FlexCAN module description chapter.
It encodes more fields and one of them is a Time STAMP filed "This 16-bit field is a copy of the Free-Running Timer, captured for Tx and Rx frames at the time when the beginning of the Identifier field appears on the CAN bus." This is way every time have a different value/ random see as you mention.