Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RP2: PIO commands in a python file are flagged as "Unresolved reference" errors #237

Open
sandyscott opened this issue May 31, 2023 · 1 comment

Comments

@sandyscott
Copy link

If you have a PIO program assembled in a python file, all of the instuctions are flagged as "Unresolved reference" errors.

import rp2

@rp2.asm_pio()
def quadrature_encoder():
    jmp("label1")
    nop()
    label("label1")

appears as
image

This issue applies to all instructions and directives appearing the program.

The full list of instructions and directives is visible in the official documentation:
Programmable IO - MicroPython latest documentation

@fiechr
Copy link

fiechr commented Jun 4, 2023

I'm having the same issue.

Example:

from machine import Pin
from rp2 import PIO, StateMachine, asm_pio
from time import sleep


@asm_pio(sideset_init=PIO.OUT_LOW)
def pwm_prog():
    pull(noblock) .side(0)
    mov(x, osr) # Keep most recent pull data stashed in X, for recycling by noblock
    mov(y, isr) # ISR must be preloaded with PWM count max
    label("pwmloop")
    jmp(x_not_y, "skip")
    nop()         .side(1)
    label("skip")
    jmp(y_dec, "pwmloop")

pycharm_20230604_072710

There are other error hints as well. It seems to me, that maybe the bundled µPython isn't the latest version? Can this be changed by the user? For example the class StateMachine doesn't have a exec() method, although in newer version it seems to have it, since the code runs completely fine when just flashing it to the RP2040.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants