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: UART parity settings gives wrong timing
OS: MicroPython v1.20.0 on 2023-04-26; Raspberry Pi Pico with RP2040
I use the Pico with a serial communication with parity settings 'parity=2' (on the PC it's 'even' parity setting).
When running it with sample code 1, there is one bit missing in the output (obviously the parity bit).
When doing the same with sample code 2, where I first init with 'parity=1' and then 'parity=2' it works correctly. I attached screenshot from my oscilloscope (the output driver put it to 24V).
Also I think the nomenclature of 'even' and 'odd' should be changed (in comparison to my PC serial connection).
Sample Code 1 (not working):
from machine import Pin, UART
uart = UART(1, baudrate=115200, timeout=1000, tx=Pin(8), rx=Pin(9), parity=2, stop=1, invert=UART.INV_TX)
uart.write(b'\xC8\x37')
Sample Code 2 (work around, working!):
from machine import Pin, UART
uart = UART(1, baudrate=115200, timeout=1000, tx=Pin(8), rx=Pin(9), parity=1, stop=1, invert=UART.INV_TX)
uart = UART(1, baudrate=115200, timeout=1000, tx=Pin(8), rx=Pin(9), parity=2, stop=1, invert=UART.INV_TX)
uart.write(b'\xC8\x37')