GR740-UM-DS, Nov 2017, Version 1.7
268
www.cobham.com/gaisler
GR740
•
write pointer
•
read pointer
The receive channel can be enabled or disabled.
17.6.1 Circular buffer
The receive channel operates on a circular buffer located in memory external to the CAN controller.
The circular buffer can also be used as a straight buffer. The buffer memory is accessed via the
AMBA AHB master interface.
Each CAN message occupies 4 consecutive 32-bit words in memory. Each CAN message is aligned to
4 words address boundaries (i.e. the 4 least significant byte address bits are zero for the first word in a
CAN message).
The size of the buffer is defined by the CanRxSIZE.SIZE field, specifying the number of CAN mes-
sages * 4 that fit in the buffer.
E.g. CanRxSIZE.SIZE=2 means 8 CAN messages fit in the buffer.
Note however that it is not possible to fill the buffer completely, leaving at least one message position
in the buffer empty. This is to simplify wrap-around condition checking.
E.g. CanRxSIZE.SIZE=2 means that 7 CAN messages fit in the buffer at any given time.
17.6.2 Write and read pointers
The write pointer (CanRxWR.WRITE) indicates the p1 of the last CAN message written to
the buffer. The write pointer operates on number of CAN messages, not on absolute or relative
addresses.
The read pointer (CanRxRD.READ) indicates the p1 of the last CAN message read from the
buffer. The read pointer operates on number of CAN messages, not on absolute or relative addresses.
The difference between the write and the read pointers is the number of CAN message positions avail-
able in the buffer for reception. The difference is calculated using the buffer size, specified by the
CanRxSIZE.SIZE field, taking wrap around effects of the circular buffer into account.
Examples:
•
There are 2 CAN messages available for read-out when CanRxSIZE.SIZE=2, Can-
RxWR.WRITE=2 and CanRxRD.READ=0.
•
There are 2 CAN messages available for read-out when CanRxSIZE.SIZE=2, Can-
RxWR.WRITE =0 and CanRxRD.READ=6.
•
There are 2 CAN messages available for read-out when CanRxSIZE.SIZE=2, Can-
RxWR.WRITE =1 and CanRxRD.READ=7.
•
There are 2 CAN messages available for read-out when CanRxSIZE.SIZE=2, Can-
RxWR.WRITE =5 and CanRxRD.READ=3.
When a CAN message has been successfully received and stored, the write pointer (Can-
RxWR.WRITE) is automatically incremented, taking wrap around effects of the circular buffer into
account. Whenever the read pointer CanRxRD.READ equals (CanRxWR.WRITE+1) modulo (Can-
RxSIZE.SIZE*4), there is no space available for receiving another CAN message.
The error behavior of the CAN core is according to the CAN standard, which applies to the error
counter, bus-off condition and error-passive condition.
17.6.3 Location
The location of the circular buffer is defined by a base address (CanRxADDR.ADDR), which is an
absolute address. The location of a circular buffer is aligned on a 1 KiB address boundary.