← index #15776Issue #16908
Off-topic · high · value 1.906
QUERY · ISSUE

RP2 build, doc strings, help()

openby thestumbleropened 2024-09-03updated 2024-11-22
bug

Port, board and/or hardware

rp2 pico

MicroPython version

MicroPython v1.24.0-preview.278.g5e692d046.dirty on 2024-09-03; RP2040

I have set MICROPY_ENABLE_DOC_STRING (1) in mpconfigboard.h

When building this way, I can clearly see, and print, __doc__ for each class. But the help() function doesn't return the docstring like it does in Python on the desktop.Also, there is only a __doc__ on a class -- on functions a doc string is not created regardless of the setting in mpconfigboard.h. Is this the expected behavior? Is this maybe unique to the RP2 port? I seem to remember this working on a STM32F4 board.

Reproduction

class Ocean:
  '''This is the Ocean Class.'''
  def __init__(self):
    pass
  def wave(self):
    '''Prints a wave.'''
    print('a wave')


Expected behaviour

Expected help(Ocean) or help(o) to show the doc string. Instead it shows what looks like dir(Ocean)

Expected help(o.wave) to show the doc string for the wave() function. Instead there is no doc string.

Observed behaviour

You can see the doc object on the class, but not on the function.
help() doesn't show the usual help output

Additional Information

No, I've provided everything above.

Code of Conduct

Yes, I agree

CANDIDATE · ISSUE

rp2.bootsel_button() not working on Raspberry Pi Pico 2 W (RP2350)

closedby sozoraemonopened 2025-03-11updated 2025-03-14
bug

Port, board and/or hardware

RP2 port, Raspberry Pi Pico 2 W (RP2350)

MicroPython version

3.4.0; MicroPython v1.25.0-preview.49.g0625f07ad.dirty on 2024-11-21
(name='micropython', version=(1, 25, 0, 'preview'), _machine='Raspberry Pi Pico 2 W with RP2350', _mpy=7942)

  • On Raspberry Pi Pico (RP2040), rp2.bootsel_button() works as expected.
  • On Raspberry Pi Pico 2 W (RP2350), rp2.bootsel_button() always returns 1, regardless of whether the BOOTSEL button is pressed or not.
  • Tested on MicroPython v1.25.0-preview.49.g0625f07ad.dirty (2024-11-21).
  • This issue does not occur on RP2040, suggesting that the BOOTSEL button may be wired differently on RP2350.
  • GPIO scan (GPIO0-29) did not detect any changes when pressing the button.
  • SIO registers (GPIO_HI_IN and GPIO_IN) also did not show a clear state change.
  • Further investigation is needed to determine how to read the BOOTSEL button on RP2350.

Reproduction

Steps to Reproduce

  1. Copy and paste the following code into a new file:
    import sys, time, rp2
    print(f"sys.implementation._machine={sys.implementation._machine}")
    for i in range(5):
        print(f"rp2.bootsel_button() = {rp2.bootsel_button()}")
        time.sleep(1)
    
    

2.Run the script on Raspberry Pi Pico 2 W (RP2350).
3.Press and release the BOOTSEL button during execution.

Expected behavior
・On Pico (RP2040): rp2.bootsel_button() returns 1 when pressed, 0 otherwise.
・On Pico 2 W (RP2350): Expected the same behavior.

Actual behavior
・Pico (RP2040): Works correctly.
・Pico 2 W (RP2350): Always returns 1, even when the button is not pressed.

Expected behaviour

Expected Behaviour

  • On Raspberry Pi Pico (RP2040):

    • rp2.bootsel_button() should return 1 when the BOOTSEL button is pressed and 0 otherwise.
    • Example output when pressing and releasing the button:
      rp2.bootsel_button() = 0
      rp2.bootsel_button() = 1  # Button pressed
      rp2.bootsel_button() = 1
      rp2.bootsel_button() = 0  # Button released
      
  • On Raspberry Pi Pico 2 W (RP2350):

    • Expected the same behavior as RP2040.
  • This function worked correctly in previous versions of MicroPython on RP2040.

  • If rp2.bootsel_button() is not supported on RP2350, an alternative API should be provided.

Observed behaviour

Observed Behaviour
On Raspberry Pi Pico 2 W (RP2350), rp2.bootsel_button() always returns 1, even when the BOOTSEL button is not pressed.

Actual output on Pico 2 W (RP2350):

sys.implementation._machine='Raspberry Pi Pico 2 W with RP2350'
rp2.bootsel_button() = 1
rp2.bootsel_button() = 1
rp2.bootsel_button() = 1
rp2.bootsel_button() = 1
rp2.bootsel_button() = 1

Additional Information

No, I've provided everything above.

Code of Conduct

Yes, I agree

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