CAN Messaging and CAN Buffers
Posted: Thu Aug 18, 2011 6:49 pm
Hi, I have a couple of queries on how the CAN buffers work with the CAN component, it all related to a different method of CAN messaging I'm working with so thought I should outline that first...
COMPOUND MESSAGING
I have a CAN based device which transmits different groups of variables but under the same CAN ID. As opposed to a standard CAN message which contains the same group of variables in each message. In our industry we often refer to this as compound messaging but this may not be a universally acknowledged term.
In this Compound method, the CAN message typically contains the full 8 data bytes but one of the data bytes is used to uniquely identify the subsequent group of variables, which occupy the remaining 7 bytes.
In the Compound example below, Byte0 of each message is used to uniquely identify the group. We refer to this value as the 'Compound ID'.
ID - DLC - Byte0 Byte1 Byte2 Byte3 Byte4 Byte5 Byte6 Byte7
7E8 - 8 - 0 Var#01 Var#02 var#03 var#04 var#05 var#06 var#07
7E8 - 8 - 1 Var#08 Var#09 var#10 var#11 var#12 var#13 var#14
7E8 - 8 - 2 Var#15 Var#16 var#17 var#18 var#19 var#20 var#21
7E8 - 8 - 3 Var#22 Var#23 var#24 var#25 var#26 var#27 var#28
As can be seen, this technique has allows many more variable to be transmitted under a single CAN ID, admittedly at a slower rate as you have to cycle though the groups of variables. And this brings me to my query on how the CAN buffers work with the CAN component.
CAN BUFFERS
A) After a message is loaded into the buffer, Under what conditions is the next message loaded into the buffer? Is it simply replaced as soon as the next message of the same ID is received?
B) If I read a byte from the buffer (I.e. the compound ID byte), when I read the next byte from the buffer will it be from the same message or could the buffer have been updated with new data.
B) Is there a method to read all of the bytes from the buffer in one go (or at least very quickly), thus ensuring you have all of that specific buffered message.
c) Is there a method to clear the buffer, to ensure that when I request a message,I know that the subsequent returned byte will drop straight into the buffer.
Any help and advice appreciated,
Cheer all,
John.
COMPOUND MESSAGING
I have a CAN based device which transmits different groups of variables but under the same CAN ID. As opposed to a standard CAN message which contains the same group of variables in each message. In our industry we often refer to this as compound messaging but this may not be a universally acknowledged term.
In this Compound method, the CAN message typically contains the full 8 data bytes but one of the data bytes is used to uniquely identify the subsequent group of variables, which occupy the remaining 7 bytes.
In the Compound example below, Byte0 of each message is used to uniquely identify the group. We refer to this value as the 'Compound ID'.
ID - DLC - Byte0 Byte1 Byte2 Byte3 Byte4 Byte5 Byte6 Byte7
7E8 - 8 - 0 Var#01 Var#02 var#03 var#04 var#05 var#06 var#07
7E8 - 8 - 1 Var#08 Var#09 var#10 var#11 var#12 var#13 var#14
7E8 - 8 - 2 Var#15 Var#16 var#17 var#18 var#19 var#20 var#21
7E8 - 8 - 3 Var#22 Var#23 var#24 var#25 var#26 var#27 var#28
As can be seen, this technique has allows many more variable to be transmitted under a single CAN ID, admittedly at a slower rate as you have to cycle though the groups of variables. And this brings me to my query on how the CAN buffers work with the CAN component.
CAN BUFFERS
A) After a message is loaded into the buffer, Under what conditions is the next message loaded into the buffer? Is it simply replaced as soon as the next message of the same ID is received?
B) If I read a byte from the buffer (I.e. the compound ID byte), when I read the next byte from the buffer will it be from the same message or could the buffer have been updated with new data.
B) Is there a method to read all of the bytes from the buffer in one go (or at least very quickly), thus ensuring you have all of that specific buffered message.
c) Is there a method to clear the buffer, to ensure that when I request a message,I know that the subsequent returned byte will drop straight into the buffer.
Any help and advice appreciated,
Cheer all,
John.