CAN bus - can_message_t .cs - Code and Status

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

CAN bus - can_message_t .cs - Code and Status

Jump to solution
2,930 Views
vagabond
Contributor II

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. 

1 Solution
2,589 Views
alexandrunan
NXP Employee
NXP Employee

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.

View solution in original post

2 Replies
2,590 Views
alexandrunan
NXP Employee
NXP Employee

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.

2,588 Views
vagabond
Contributor II

Thanks a lot Alexandru, it's clear now.

Found the complete description in the reference manual at 

https://www.nxp.com/docs/en/reference-manual/S32K-RM.pdf 

page 1718 :smileyhappy:

0 Kudos
Reply