A few CAN Bus Questions...

30 Nov 2010

I'm just getting back to this CAN Bus monitoring project that I started over the summer and have a few questions....

1) What does the incoming CAN Message buffer look like? How deep is the buffer? I seem to remember that it is only one message deep. If a new message comes in before you pull out the first message then the first message gets over written with the new message. Is this correct?

2) Is there a way to detect that a message has been lost? ie, a message was over written by a newwer message before it was pulled out of the buffer? I there a flag that can tell you this?

Thanks.

03 Dec 2010

Anyone?

03 Dec 2010

Hi Freddie,

1) Looking at the LPC1768 User Manual, section 16.5 confirms the transmit buffer is 3 entries deep, and the receive buffer is 2 entries deep.

Section 16.5.4 talks about the specifics of the Receive Buffer (RXB):

LPC1768 User Manual 16.5.4

If there is not enough space for a new message within the Receive Buffer, the CAN Controller generates a Data Overrun condition when this message becomes valid and the acceptance test was positive. A message that is partly written into the Receive Buffer (when the Data Overrun situation occurs) is deleted. This situation is signalled to the CPU via the Status Register and the Data Overrun Interrupt, if enabled.

2) To see if there have been any errors, you can call the CAN method rderror() which will return the number of read errors.

There are also other registers in the CAN controller you can read directly if needed, but this should give you what you need.

Simon