Using the Transmit FIFO
Prior to using the transmit FIFO, the appropriate configuration settings for the application should be established:
• The TXTH field should be adjusted to the desired level. TXTH determines when the hardware will generate write requests and set
the TXRQ flag. TXTH acts as a low watermark for the FIFO data, and the TXRQ flag will be set any time the number of bytes in the
FIFO is less than or equal to the value of TXTH. For example, if the TXTH field is configured to 1, TXRQ will be set any time there
are zero or one bytes left to send in the transmit FIFO.
• Disable TI interrupts by clearing the TIE bit to 0. TI will still be set at the completion of every byte sent from the UART, but the TI flag
is typically not used in conjunction with the FIFO.
• Enable TFRQ interrupts by setting the TFRQE bit to 1.
As with basic data transfer, data transmission is initiated when software writes a data byte to the SBUF1 register. However, software
may continue to write bytes to the buffer until the transmit FIFO is full. Software may determine when the FIFO is full either by reading
the TXCNT directly from UART1FCT, or by monitoring the TXNF flag. TXNF is normally set to 1 when the transmit FIFO is not full,
indicating that more data may be written. Any data written to SBUF1 when the transmit FIFO is full will over-write the most recent data
written to the buffer, and a data byte will be lost.
In the course of normal operations, the transmit FIFO may be maintained with an interrupt-based system, filling the FIFO as space al-
lows and servicing any write request interrupts that occur. If no more data is to be sent for some period of time, the TFRQ interrupt
should be disabled by firmware until additional data will be sent.
In some situations, it may be necessary to halt transmission when there is still data in the FIFO. To do this, firmware should set the
TXHOLD bit to 1. If a data byte is currently in progress, the UART will finish sending that byte and then halt before the nxet data byte.
Trasnmission will not continue until TXHOLD is cleared to 0.
If it is necessary to flush the contents of the transmit FIFO entirely, firmware may do so by writing the TFLSH bit to 1. A flush will reset
the internal FIFO counters and the UART will cease sending data.
Note:
Hardware will clear the TFLSH bit back to 0 when the flush operation is complete. This takes only one SYSCLK cycle, so firm-
ware will always read a 0 on this bit.
EFM8UB3 Reference Manual
Universal Asynchronous Receiver/Transmitter 1 (UART1)
silabs.com
| Building a more connected world.
Rev. 0.2 | 295