RP2 UART timeout is incorrect
To repro link pins 0 and 1 and paste the following:
from machine import UART, Pin
uart = UART(0, 115200, rx=Pin(1, Pin.IN), tx=Pin(0, Pin.OUT), timeout=1000_000, timeout_char=1000_000)
uart.readline()
It times out after 15s rather than 16.6minutes.
Setting a long timeout is a hack to resolve https://github.com/micropython/micropython/issues/10867. In my opinion it should be possible to disable the timeout (set it to infinity). In uasyncio systems, uasyncio should provide any timeouts required by the application.
rp2/machine_uart.c: Handle UART RX timeout IRQ.
The pico-sdk 1.3.0 update in #8031 introduced a change that broke RP2 Bluetooth UART, and possibly machine_uart.c in general, which stops working right after UART is initialized. This commit https://github.com/raspberrypi/pico-sdk/commit/2622e9bc292a26cb576a80c3c7c30481dda04181 enables the UART receive timeout (RTIM) IRQ, which is asserted when the receive FIFO is not empty, and no more characters are received for a period of time. This PR makes sure the RTIM IRQ is handled and cleared in uart_service_interrupt.