User manual

Table Of Contents
Zynq-7000 AP SoC Technical Reference Manual www.xilinx.com 577
UG585 (v1.11) September 27, 2016
Chapter 18: CAN Controller
18.3.5 Write Messages to TxFIFO
With either option, can.SR[TXFLL] can be polled before writing a message.
All messages written to the TxFIFO should follow the format defined in Message Structure.
Example: Write Message to TxFIFO Using Polling Method
1. Poll the TxFIFO status. Read can.SR[TXFLL] for 0 and can.SR[TXFEMP] for 1 and then message
can be written into the TxFIFO.
2. Write message to TxFIFO. Write to all four data registers (can.TXFIFO_ID, can.TXFIFO_DLC,
can.TXFIFO_DATA1, and can.TXFIFO_DATA2).
Example: Write Message to TxFIFO Using Interrupt Method
In interrupt mode, writes can continue until can.ISR[TXFLL] generates an interrupt.
Messages can be continuously written to the TxFIFO until the TxFIFO is full. When the TxFIFO is full
the can.ISR[TXFLL] and can.SR[TXFLL] are set to 1. When the TxFIFO is empty, can.ISR[TXFEMP] is set
to 1.
18.3.6 Write Messages to TxHPB
All messages written to the TxHPB use the polling method. The format should follow section
18.2.2 Message Format.
Example: Write Message to TxHPB
1. Poll the TxHPB status. Read can.SR[TXBFLL] until it equals 0 and then write the message into the
TxHPB.
2. Write message to TxHPB. Write to all four data registers (can.TXHPB_ID, can.TXHPB_DLC,
can.TXHPB_DATA1, and can.TXHPB_DATA2).
18.3.7 Read Messages from RxFIFO
Whenever a new message is received and put into the RxFIFO, the can.ISR[RXNEMP] and
can.ISR[RXOK] bits are set to 1. If the RxFIFO is empty when the message is read, then the
can.ISR[RXUFLW] is also set to 1.
Example: Read Message from RxFIFO Using Polling Method
1. Poll the RxFIFO status. Read can.ISR[RXOK] or can.ISR[RXNEMP] register until a message is
received. Proceed to step 2 when a bit is set.
2. Read message from the RxFIFO. Read all four of the registers (can.RXFIFO_ID, can.RXFIFO_DLC,
can.RXFIFO_DATA1, can.RXFIFO_DATA2).
3. Determine if more messages are in the RxFIFO. Read can.ISR[RXNEMP].