Datasheet

Table Of Contents
4.2.6.5. UARTEINTR
The error interrupt is asserted when an error occurs in the reception of data by the UART. The interrupt can be caused
by a number of different error conditions:
framing
parity
break
overrun.
You can determine the cause of the interrupt by reading the Raw Interrupt Status Register, UARTRIS, or the Masked
Interrupt Status Register, UARTMIS. It can be cleared by writing to the relevant bits of the Interrupt Clear Register,
UARTICR (bits 7 to 10 are the error clear bits).
4.2.6.6. UARTINTR
The interrupts are also combined into a single output, that is an OR function of the individual masked sources. You can
connect this output to a system interrupt controller to provide another level of masking on a individual peripheral basis.
The combined UART interrupt is asserted if any of the individual interrupts are asserted and enabled.
4.2.7. Programmer’s Model
The SDK provides a uart_init function to configure the UART with a particular baud rate. Once the UART is initialised,
the user must configure a GPIO pin as UART_TX and UART_RX. See Section 2.19.5.1 for more information on selecting a
GPIO function.
To initialise the UART, the uart_init function takes the following steps:
Deassert the reset
Enable clk_peri
Set enable bits in the control register
Enable the FIFOs
Set the baud rate divisors
Set the format
SDK: https://github.com/raspberrypi/pico-sdk/tree/master/src/rp2_common/hardware_uart/uart.c Lines 39 - 64
39 uint uart_init(uart_inst_t *uart, uint baudrate) {
40 invalid_params_if(UART, uart != uart0 && uart != uart1);
41
42 if (clock_get_hz(clk_peri) == 0)
43 return 0;
44
45 uart_reset(uart);
46 uart_unreset(uart);
47
48 #if PICO_UART_ENABLE_CRLF_SUPPORT
49 uart_set_translate_crlf(uart, PICO_UART_DEFAULT_CRLF);
50 #endif
51
52 // Any LCR writes need to take place before enabling the UART
53 uint baud = uart_set_baudrate(uart, baudrate);
54 uart_set_format(uart, 8, 1, UART_PARITY_NONE);
55
56 // Enable the UART, both TX and RX
RP2040 Datasheet
4.2. UART 445