GR740-UM-DS, Nov 2017, Version 1.7
265
www.cobham.com/gaisler
GR740
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 CanTxSIZE.SIZE field. The number of CAN messages allo-
cated are SIZE * 4.
E.g. CanTxSIZE.SIZE =2 means 8 CAN messages are allocated 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. CanTxSIZE.SIZE = 2 means that a maximum of 7 CAN messages can be present in the buffer at
any given time.
17.5.2 Write and read pointers
The write pointer (CanTxWR.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 (CanTxRD.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 messages available in
the buffer for transmission. The difference is calculated using the buffer size, specified by the CanTx-
SIZE.SIZE field, taking wrap around effects of the circular buffer into account.
Examples:
•
There are 2 CAN messages available for transmit when CanTxSIZE.SIZE=2,
CanTxWR.WRITE=2 and CanTxRD.READ=0.
•
There are 2 CAN messages available for transmit when CanTxSIZE.SIZE=2, CanTxWR.WRITE
=0 and CanTxRD.READ =6.
•
There are 2 CAN messages available for transmit when CanTxSIZE.SIZE=2, CanTxWR.WRITE
=1 and CanTxRD.READ =7.
•
There are 2 CAN messages available for transmit when CanTxSIZE.SIZE=2, CanTxWR.WRITE
=5 and CanTxRD.READ =3.
When a CAN message has been successfully transmitted, the read pointer (CanTxRD.READ) is auto-
matically incremented, taking wrap around effects of the circular buffer into account. Whenever the
write pointer CanTxWR.WRITE and read pointer CanTxRD.READ are equal, there are no CAN mes-
sages available for transmission.
17.5.3 Location
The location of the circular buffer is defined by a base address (CanTxADDR.ADDR), which is an
absolute address. The location of a circular buffer is aligned on a 1 KiB address boundary.
17.5.4 Transmission procedure
When the channel is enabled (CanTxCTRL.ENABLE=1), as soon as there is a difference between the
write and read pointer, a message transmission will be started. Note that the channel should not be
enabled if a potential difference between the write and read pointers could be created, to avoid the
message transmission to start prematurely.
A message transmission will begin with a fetch of the complete CAN message from the circular buffer
to a local fetch-buffer in the CAN controller. After a successful data fetch, a transmission request will
be forwarded to the CAN core. If there is at least one additional CAN message available in the circu-
lar buffer, a prefetch of this CAN message from the circular buffer to a local prefetch-buffer in the