Skip to content

busio.UART receive only responds when buffer is full #10471

Open
@Mizenheimer

Description

@Mizenheimer

CircuitPython version and board name

Adafruit CircuitPython 9.2.7 on 2025-04-01; Adafruit Feather ESP32-S3 Reverse TFT with ESP32S3

Code/REPL

import board
import busio

uart = busio.UART(board.TX, board.RX, baudrate=1200)
#string being sent is "<AA>\n"

while True:
    line = uart.readline()
    if line:
        print("Received line:", line.decode().strip())
    num_bytes = uart.in_waiting
    if num_bytes > 0:
        print(f"{num_bytes} bytes waiting")
        data = uart.read(num_bytes)

Behavior

Code done running.

Press any key to enter the REPL. Use CTRL-D to reload.
soft reboot

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Received line:
115 bytes waiting
Received line:
115 bytes waiting
Received line:
115 bytes waiting
Received line:
115 bytes waiting

Description

When sending a test string "\n" at a rate 1 full string per 2 sec, nothing happens until the receive buffer is full (that's my assumption). Once the program is running, the first "Received line: " doesn't happen until the buffer reaches the 115 bytes. Then waits again for a period then prints the same thing again. As opposed the expected behavior of a single showing 5 bytes waiting. I've tried just a version using "uart.read(1)" with a similar result - that being it doesn't respond until the buffer is full.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy