Skip to content

UART: unable to set value of pull-up/down/none on busio defined pins, needed on uart RX #8945

Open
@davs2rt

Description

CircuitPython version

Adafruit CircuitPython 8.2.9 on 2023-12-06; Seeed Studio XIAO ESP32C3 with ESP32-C3FN4

digitalio allows setting pin.pull values, however using busio.UART (and possibly others) the RX pin seems to be pulled up.

In my use case, the circuit driving RX is weak, and I'm not getting solid low voltages, causing data corruption. I'd like to see the default on inputs be configurable, or at least not pulled up or down, i.e tri-stated or pin.pull=None.
This seems to be similar to #8941 "Configure internal pull up on MISO", an enhancement.

Code/REPL

import board, busio, time, digitalio
while True:
    rx = digitalio.DigitalInOut(board.RX)
    rx.direction = digitalio.Direction.INPUT
    rx.pull = None
    print("RX is floating")
    time.sleep(10)
    rx.deinit()

    uart = busio.UART(tx=board.TX, rx=board.RX, timeout=60)
    print("""RX line is pulled up.
Note that there is no way to disable the pull-up in the API.""")
    time.sleep(10)
    uart.deinit()

Behavior

The code should run okay. The problem shows up as electrical due to board configuration. If you use a serial port monitor with lights, you'll see RXD flash as it's pulled high, and then off when tri-stated.

Description

No response

Additional information

This is probably easiest to observe with an oscilloscope, and the serial port not connected to anything driving the RX line. Compare the difference between digitalio pin.pull = None, pin.pull = digitalio.Pull.UP and what you get with busio.UART(rx=board.RX)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions