uart
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
uart [2025/04/19 19:18] – arisotura | uart [2025/05/10 11:55] (current) – arisotura | ||
---|---|---|---|
Line 80: | Line 80: | ||
IRQ 4 is fired when a byte of data is received. To acknowledge it, read the data from the data output port. | IRQ 4 is fired when a byte of data is received. To acknowledge it, read the data from the data output port. | ||
- | IRQ 6 is fired when data reception fails. For example this happens if the RX line is pulled low (when polarity set to active high). The only known way to acknowledge this IRQ is to reset the UART entirely. | + | IRQ 6 is fired when data reception fails. For example this happens if the RX line is pulled low (when polarity set to active high). This also happens on parity errors. The only known way to acknowledge this IRQ is to reset the UART entirely. |
- | Unknown what IRQ 12 would be, maybe parity error? | + | Unknown what IRQ 12 would be. Firmware code has a case for it, but I haven' |
Line 105: | Line 105: | ||
| 0 | RX FIFO not empty | | | 0 | RX FIFO not empty | | ||
| 1 | RX FIFO overflow (received data while FIFO already full) | | | 1 | RX FIFO overflow (received data while FIFO already full) | | ||
+ | | 2 | RX parity error | | ||
+ | | 3 | RX error, ? (FIFO overflow?) | | ||
| 4 | RX line error (ie. line held low) | | | 4 | RX line error (ie. line held low) | | ||
| 5 | 1 when ready to send, 0 when sending | | | 5 | 1 when ready to send, 0 when sending | | ||
Line 134: | Line 136: | ||
^ Bits ^ Desc. ^ | ^ Bits ^ Desc. ^ | ||
| 0 | Enable UART | | | 0 | Enable UART | | ||
- | | 1 | Bit order; 0=LSb first, 1=MSb first | | + | | 1 | Data bit order; 0=LSb first, 1=MSb first | |
| 2 | Line polarity; 0=active high, 1=active low | | | 2 | Line polarity; 0=active high, 1=active low | | ||
Line 183: | Line 185: | ||
^ Bits ^ Desc. ^ | ^ Bits ^ Desc. ^ | ||
- | | 0-4 | ??? | | + | | 0-3 | ??? | |
+ | | 4 | Aux. LED (for UART2) (0=off, 1=on) | | ||
| 8-14 | ??? | | | 8-14 | ??? | | ||
Line 264: | Line 267: | ||
Output '' | Output '' | ||
+ | |||
+ | ===== Using with DMA ===== | ||
+ | |||
+ | Much like SPI, the UARTs can be used conjointly with [[DMA]] channels 0 or 1. | ||
+ | |||
+ | To send data using DMA, you simply start a write DMA transfer instead of manually writing data to the UART's data output port. You should rely on the TX IRQ (2) to detect transfer completion. | ||
+ | |||
+ | To receive data using DMA, you can start a read DMA transfer at any moment. The DMA transfer will complete when the requested amount of bytes has been received. Note that if a read DMA transfer is active on the UART, it will suppress the RX IRQ. Thus, you should rely on the DMA completion IRQ to detect transfer completion. |
uart.1745090334.txt.gz · Last modified: 2025/04/19 19:18 by arisotura