Skip to content

jmp_pin seems ignored instead of in_base for logical group #17155

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

Closed
Pi3DAudioMagic opened this issue Apr 18, 2025 · 1 comment
Closed

jmp_pin seems ignored instead of in_base for logical group #17155

Pi3DAudioMagic opened this issue Apr 18, 2025 · 1 comment
Labels

Comments

@Pi3DAudioMagic
Copy link

Port, board and/or hardware

RP2040

MicroPython version

for RP2040:

PIN_MOSI = 16  # MOSI - Data Pin
PIN_CS = 17    # Chip Select
PIN_SCK = 18   # Clock
mosi = Pin(PIN_MOSI, Pin.IN)  # Pin 16
cs = Pin(PIN_CS, Pin.IN, Pin.PULL_UP) # Pin 17
sm = StateMachine(0, spi_slave_read_byte, in_base=mosi, jmp_pin=cs, freq=2_000_000)

Normally wait(0, pin, 0) should refer to cs but i have to write wait(0, pin, 1) to refer to cs.

So it seems jmp_pin is ignored

Reproduction

Normally wait(0, pin, 0) should refer to cs but i have to write wait(0, pin, 1) to refer to cs.

Expected behaviour

Normally wait(0, pin, 0) should refer to cs but i have to write wait(0, pin, 1) to refer to cs.

Observed behaviour

it is the same writing sm = StateMachine(0, spi_slave_read_byte, in_base=mosi, freq=2_000_000) (withount jmp_pin).

Additional Information

No, I've provided everything above.

Code of Conduct

Yes, I agree

@peterhinch
Copy link
Contributor

The instruction wait(state, pin, n) causes the SM to pause until pin(n) is in the requested state. The integer n is the offset relative to base_pin. The jmp_pin determines the single pin which is tested by the jmp(pin, label) instruction; it has no connection with the wait instruction.

In other words the behaviour you describe is expected behaviour and not a bug.

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

No branches or pull requests

2 participants