In order to disable TX DMA if it is not needed anymore (e.g. all transfers are done and UART idle mode is desired), the following sequence must be use
- DMA mode 1 is set (both TX/RX DMA) by registers
UART_SCR[0] DMA_MODE_CTL = 0 and UART_FCR[3] DMA_MODE = 1:
- Set the UART_SCR[2-1]
DMA_MODE_2 bit fields to 01 (DMA mode 1)
- Set the UART_SCR[0]
DMA_MODE_CTL bit to1 (this setting of UART_SCR[0] DMA_MODE-CTL will
ignores UART_FCR[3] DMA_MODE_CTL bit)
Note:
It is strongly
suggested to do steps ‘a’ and ‘b’ in two separate write in order
to avoid malfunction of the device.
- Set the UART_FCR[3]
DMA_MODE bit to 0. It is not necessary but suggested to avoid restore of
DMA mode 1 during accidental reset of UART_SCR[0] DMA_MODE_CTL bit. Be
sure that all data was read out from RX FIFO and if it possible disable
the RX side. In UART mode the RTS/CTS or XOFF/XON protocol can be used.
In IrDA modes RX can be forcibly disabled by setting UART_ACREG[5]
DIS_IR_RX bit
Note:
There can be RX
DATA loss during the next steps if all DATA was not read out or
there was an ongoing reception!
- Set the UART_FCR[2-1]
DMA_MODE bit field to 11 (clear TX and RX FIFO and resets its counter
logic to 0. Returns to 0 after clearing FIFO).
- Set the UART_SCR[2-1]
DMA_MODE_2 bit field to 10 (DMA mode 2, RX only).
- Set the UART_FCR[2-1]
DMA_MODE bit field to 11 (clear TX and RX FIFO and the DMA request
again).
- Set the UART_SCR[2-1]
DMA_MODE_2 bit field to 00 (no DMA) or keep 10 if RX DMA is needed.
- DMA mode 1 is set (both TX/RX DMA) by registers
UART_FCR[3] DMA_MODE = 0 and UART_SCR[0] DMA_MODE_CTL = 1, UART_SCR[2-1]
DMA_MODE_2 = 01. It is almost the same as above, but steps ‘a’, and ‘b’ can be
skipped:
- Set the UART_FCR[3]
DMA_MODE bit to 0. It is not necessary but suggested to avoid restore of
DMA mode 1 during accidental reset of UART_SCR[0] DMA_MODE_CTL bit. Be
sure that all data was read out from RX FIFO and if it possible disable
the RX side. In UART mode the RTS/CTS or XOFF/XON protocol can be used.
In IrDA modes RX can be forcibly disabled by setting UART_ACREG[5]
DIS_IR_RX bit
Note:
There can be RX
DATA loss during the next steps if all DATA was not read out or
there was an ongoing reception!
- Set the UART_FCR[2-1]
DMA_MODE bit field to 11 (clear TX and RX FIFO and resets its counter
logic to 0. Returns to 0 after clearing FIFO).
- Set the UART_SCR[2-1]
DMA_MODE_2 bit field to 10 (DMA mode 2, RX only).
- Set the UART_FCR[2-1]
DMA_MODE bit field to 11 (clear TX and RX FIFO and the DMA request
again).
- Set the UART_SCR[2-1]
DMA_MODE_2 bit field to 00 (no DMA) or keep 10 if RX DMA is needed.
- DMA mode 3 is set (TX DMA only) by registers
UART_FCR[3] DMA_MODE = 0 and UART_SCR[0] DMA_MODE_CTL = 1, UART_SCR[2-1]
DMA_MODE_2 = 11. It is the same as above:
- Set the UART_FCR[3]
DMA_MODE bit to 0. It is not necessary but suggested to avoid restore of
DMA mode 1 during accidental reset of UART_SCR[0] DMA_MODE_CTL bit. Be
sure that all data was read out from RX FIFO and if it possible disable
the RX side. In UART mode the RTS/CTS or XOFF/XON protocol can be used.
In IrDA modes RX can be forcibly disabled by setting UART_ACREG[5]
DIS_IR_RX bit
Note:
There can be RX
DATA loss during the next steps if all DATA was not read out or
there was an ongoing reception!
- Set the UART_FCR[2-1]
DMA_MODE bit field to 11 (clear TX and RX FIFO and resets its counter
logic to 0. Returns to 0 after clearing FIFO).
- Set the UART_SCR[2-1]
DMA_MODE_2 bit field to 10 (DMA mode 2, RX only).
- Set the UART_FCR[2-1]
DMA_MODE bit field to 11 (clear TX and RX FIFO and the DMA request
again).
- Set the UART_SCR[2-1]
DMA_MODE_2 bit field to 00 (no DMA) or keep 10 if RX DMA is needed.