You are here

Priority of CAN messages?

3 posts / 0 new
Last post
hmijail
Offline
Last seen: 6 years 1 week ago
Joined: 2018-10-27 05:51
Posts: 2
Priority of CAN messages?

Hi,

I am wondering why the CAN message IDs are defined as they are in https://github.com/vedderb/bldc/blob/master/datatypes.h :

// CAN commands
typedef enum {
	CAN_PACKET_SET_DUTY = 0,
	CAN_PACKET_SET_CURRENT,
	CAN_PACKET_SET_CURRENT_BRAKE,
	CAN_PACKET_SET_RPM,
	CAN_PACKET_SET_POS,
	CAN_PACKET_FILL_RX_BUFFER,
	CAN_PACKET_FILL_RX_BUFFER_LONG,
	CAN_PACKET_PROCESS_RX_BUFFER,
	CAN_PACKET_PROCESS_SHORT_BUFFER,
	CAN_PACKET_STATUS,
	CAN_PACKET_SET_CURRENT_REL,
	CAN_PACKET_SET_CURRENT_BRAKE_REL,
	CAN_PACKET_SET_CURRENT_HANDBRAKE,
	CAN_PACKET_SET_CURRENT_HANDBRAKE_REL
} CAN_PACKET_ID;

The lower IDs have greater priorities, so it would make sense to have the message types sorted by their real-time needs.

But as far as I currently understand the code, the BUFFER commands are rather used for communications that should be in the lowest priorities, like the communication with the PC tool. Instead they are in the middle of the range. Is there any explanation of why this is so?

benjamin
Offline
Last seen: 5 days 10 hours ago
VESC FreeVESC OriginalVESC Platinum
Joined: 2016-12-26 15:20
Posts: 490

The reason is quite simple actually - I have added commands to the end as I have made new commands. This way compatibility is not broken between different firmware versions.

hmijail
Offline
Last seen: 6 years 1 week ago
Joined: 2018-10-27 05:51
Posts: 2

Aha, so making it explicit: CAN ID priorities are not considered important for the working of VESC, and so they are disregarded in favor of backwards compatibility.

Thank you!