CAN bus - can_message_t .cs - Code and Status

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

CAN bus - can_message_t .cs - Code and Status

跳至解决方案
2,834 次查看
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,493 次查看
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,494 次查看
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,492 次查看
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 项奖励
回复