diff options
| author | Damien George <damien@micropython.org> | 2025-07-29 17:19:09 +1000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2025-08-01 15:10:15 +1000 |
| commit | 41987c6cf43c18ff387e88d227469bf8b8e29b55 (patch) | |
| tree | 8b57efda6f35c30577c643ae832ebf3c488780e3 | |
| parent | dea949e860c0adc615171d25c7df79b59639f8ed (diff) | |
rp2/rp2_pio: Configure jmp_pin for PIO use if it's isolation is set.
Signed-off-by: Damien George <damien@micropython.org>
| -rw-r--r-- | ports/rp2/rp2_pio.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/ports/rp2/rp2_pio.c b/ports/rp2/rp2_pio.c index d936553b5..8fc7c0e78 100644 --- a/ports/rp2/rp2_pio.c +++ b/ports/rp2/rp2_pio.c @@ -683,8 +683,10 @@ static mp_obj_t rp2_state_machine_init_helper(const rp2_state_machine_obj_t *sel } // Configure jmp pin, if needed. + int jmp_pin = -1; if (args[ARG_jmp_pin].u_obj != mp_const_none) { - sm_config_set_jmp_pin(&config, mp_hal_get_pin_obj(args[ARG_jmp_pin].u_obj)); + jmp_pin = mp_hal_get_pin_obj(args[ARG_jmp_pin].u_obj); + sm_config_set_jmp_pin(&config, jmp_pin); } // Configure sideset pin, if needed. @@ -716,6 +718,18 @@ static mp_obj_t rp2_state_machine_init_helper(const rp2_state_machine_obj_t *sel if (set_config.base >= 0) { asm_pio_init_gpio(self->pio, self->sm, &set_config); } + #if !PICO_RP2040 + if (jmp_pin >= 0) { + // On RP2350 pins by default have their isolation enabled. This means they will + // not work as input to a PIO without further configuration. That's different to + // RP2040 where pins can work as PIO input from a reset. To make RP2350 have + // similar behaviour as RP2040, configure the jmp pin for PIO use if it's isolation + // is enabled (which means it's probably unconfigured from reset). + if (pads_bank0_hw->io[jmp_pin] & PADS_BANK0_GPIO0_ISO_BITS) { + pio_gpio_init(self->pio, jmp_pin); + } + } + #endif if (sideset_config.base >= 0) { asm_pio_init_gpio(self->pio, self->sm, &sideset_config); } |
