CAN bus - can_message_t .cs - Code and Status

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

CAN bus - can_message_t .cs - Code and Status

ソリューションへジャンプ
2,431件の閲覧回数
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 解決策
2,090件の閲覧回数
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 返答(返信)
2,091件の閲覧回数
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,089件の閲覧回数
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 件の賞賛