Skip to content

v1.22.1: uart.flush() takes way too long #13377

Closed
@hmaerki

Description

@hmaerki

Observation

Raspberry Pi pico, v1.21.0, uart.flush() takes 11ms (correct)
Raspberry Pi pico, v1.22.1/0, uart.flush() takes 785ms (way too long)

How to reproduce

import sys
import time
from machine import UART

print(sys.implementation)

bits_per_s = 9600
uart = UART(0, bits_per_s, bits=8, parity=None, stop=1, tx="GPIO0", rx="GPIO1")

text = "Hello World"
start_us = time.ticks_us()
uart.write(text)
print(f"Duration write() {time.ticks_diff(time.ticks_us(), start_us)/1000:0.2f}ms")

uart.flush()
print(f"Duration write()+flush() {time.ticks_diff(time.ticks_us(), start_us)/1000:0.2f}ms")

bits_per_char = 11 # 1(startbit)+8(bits)+1(stopbit)+1(parity)
print(f"Expected time {len(text)*bits_per_char/bits_per_s*1000:0.2f}ms")

Output

(name='micropython', version=(1, 21, 0), _machine='Raspberry Pi Pico with RP2040', _mpy=4358)
Duration write() 0.16ms
Duration write()+flush() **11.41ms** (ok)
Expected time 12.60ms
(name='micropython', version=(1, 22, 0, ''), _machine='Raspberry Pi Pico with RP2040', _mpy=4614)
Duration write() 0.15ms
Duration write()+flush() **785.37ms** (way too long)
Expected time 12.60ms
(name='micropython', version=(1, 22, 1, ''), _machine='Raspberry Pi Pico with RP2040', _mpy=4614)
Duration write() 0.20ms
Duration write()+flush() **785.42ms** (way too long)
Expected time 12.60ms

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions