← index #11678Issue #12410
Off-topic · high · value 1.750
QUERY · ISSUE

RP2 UART timeout is incorrect

openby peterhinchopened 2023-06-01updated 2023-06-01
bug

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.

CANDIDATE · ISSUE

RP2: UART parity settings gives wrong timing

closedby climblinneopened 2023-09-11updated 2023-09-11
bug

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')

scope_1

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')

scope_0

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied