Page 1 of 1

asm_pio error when working in Thonny - Shell

Posted: Sat Mar 20, 2021 9:20 am
by Barbabenno
I don't know if this is the right place to report this behaviour, and I also don't know if this behaviour is incorrect, but if I don't report it, it could not be fixed. ;-)
I am trying the example in the 'Get started with MicroPython on Raspberry Pi Pico' book.
When I create a program in a file, it seems to work. But if I start it using the shell, I get an error.

Code:

Code: Select all

from rp2 import PIO, StateMachine, asm_pio

@asm_pio(set_init=PIO.OUT_LOW)
def led_quarter_brightness():
    set(pins, 0) [2]
    set(pins, 1)
Error message:

Code: Select all

Traceback (most recent call last):
File "<stdin>", line 5, in <module>
File "rp2.py", line 254, in dec
File "<stdin>", line 7, in led_quarter_brightness
NameError: name '__thonny_helper' isn't defined

Software:
  • MicroPython v1.14 on 2021-03-19; Raspberry Pi Pico with RP2040
  • Thonny 3.3.6
Would it be possible to work with the @asm_pio when using the Shell?

Re: asm_pio error when working in Thonny - Shell

Posted: Sun Mar 21, 2021 6:56 am
by aivarannamaa
It looks like Thonny's bug. Please report it at https://github.com/thonny/thonny/issues/new and let's continue our discussion there. Also, please tell your OS, whether you are able to run some other programs and whether you can evaluate expressions in the Shell.

Re: asm_pio error when working in Thonny - Shell

Posted: Sun Mar 21, 2021 6:34 pm
by Barbabenno
Thanks for the info.
I submitted an issue with Thonny: https://github.com/thonny/thonny/issues/1718