← index #14068Issue #13758
Off-topic · high · value 0.462
QUERY · ISSUE

Pin.DRIVE_0 mentioned in documentation but not exist in current code for RP2040

openby nuschplopened 2024-03-11updated 2024-03-11
bug

Checks

  • I agree to follow the MicroPython Code of Conduct to ensure a safe and respectful space for everyone.

  • I've searched for existing issues matching this bug, and didn't find any.

Port, board and/or hardware

Raspbery Pi Pico ( RP2040)

MicroPython version

On MicroPython v1.22.2 on 2024-02-22; Raspberry Pi Pico with RP2040

Reproduction

  1. Install forementioned micropython version on the formentioned board.
  2. Launch rshell
  3. Launch repl
  4. Reproduce below in interactive prompt:
>>> import machine
>>> machine.Pin.PULL_UP
1
>>> machine.Pin.DRIVE_0
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: type object 'Pin' has no attribute 'DRIVE_0'
>>> dir(machine.Pin)
['__class__', '__name__', 'value', 'ALT', 'ALT_GPCK', 'ALT_I2C', 'ALT_PIO0', 'ALT_PIO1', 'ALT_PWM', 'ALT_SIO', 'ALT_SPI', 'ALT_UART', 'ALT_USB', 'IN', 'IRQ_FALLING', 'IRQ_RISING', 'OPEN_DRAIN', 'OUT', 'PULL_DOWN', 'PULL_UP', '__bases__', '__dict__', 'board', 'cpu', 'high', 'init', 'irq', 'low', 'off', 'on', 'toggle']

Expected behaviour

Pin.DRIVE_0 returns enum value and can be used to configure Pin in line with the documentation.
Ideally files:
https://github.com/micropython/micropython/blob/master/ports/rp2/mphalport.h
and
https://github.com/micropython/micropython/blob/master/ports/rp2/machine_pin.h
would contain full implmentation of above bitfield

Observed behaviour

The ability documented here regarding Pin.DRIVE_0, Pin.DRIVE_1 despite supported by hardware is not implemented. It could be achieved with quirk like this:
machine.mem32[0x4 + 0x04*gpio_pin_number + 0x4001c000] = 0b01110001
where the above is a bitfield consisting of fields:

  • OutputDisable = 0 above
  • InputeEnable = 1 above
  • DriveStrength - 2 bits - 0b11 - maximum drive strength above
  • PullUpEnable - pull up disabled
  • PullDownEnable - pull down disabled
  • SchmittTriggerEnable - input Schmidt driver (hysteresis control) disabled
  • SlewRateFastEnable - fast slew rate enabled

Additional Information

No, I've provided everything above.

CANDIDATE · ISSUE

Give me a solution for the esp01 response throught Micropython

closedby Jayakrishna112opened 2024-02-26updated 2024-02-27
bug

Checks

  • I agree to follow the MicroPython Code of Conduct to ensure a safe and respectful space for everyone.

  • I've searched for existing issues matching this bug, and didn't find any.

Port, board and/or hardware

Raspberry Pi Pico

MicroPython version

MicroPython v1.22.1 on 2024-01-05; Raspberry Pi Pico with RP2040

Reproduction

when i run this python code :

from machine import UART, Pin
import utime

esp = UART(0, baudrate=115200)

def send_at_command(cmd):
    esp.write(cmd)
    response = waitResp(esp)
    # print(response.decode())
    return response

def waitResp(uart, timeout=2000):
    prvMills = utime.ticks_ms()
    resp = b""
    while (utime.ticks_ms()-prvMills) < timeout:
        if uart.any():
            resp = b"".join([resp, uart.readline()])
    print("resp:")
    try:
        print(resp.decode())
    except UnicodeError:
        print("E:", resp)
    return resp

send_at_command(b'AT')

Expected behaviour

the output should be:

resp:
AT

OK

Observed behaviour

but giving only:

resp:
At

Additional Information

No, I've provided everything above.

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