PIO program refuse to load: wait instruction need to have the GPIO nb-16 if pio_gpio_base is 16 #2342
Labels
No labels
bazel
bluetooth
board settings
boot_stage2
bug
build
c++
can't reproduce
clang
clib-interface
cmsis
code cleanliness
code size
compiler version issues
cyw43_driver
debug
discussion
documentation
duplicate
dynamic_clock
elf2uf2
enhancement
errata
filesystem
flash layout
floating point
FreeRTOS
hardware_adc
hardware_claim
hardware_clocks
hardware_dma
hardware_exception
hardware_flash
hardware_gpio
hardware_i2c
hardware_irq
hardware_pio
hardware_pwm
hardware_rcp
hardware_rtc
hardware_spi
hardware_sync
hardware_uart
hardware_vreg
hardware_watchdog
hardware_xosc
help wanted
host
IAR
installation
invalid
linker scripts
lto
lwip
mbedtls
missing API
needs reporter detail
networking
newlib
newlib-multicore
non-c
non-cmake
non-gcc
openocd
orphan PR
OS integration
pico_async_context
pico_base
pico_binary_info
pico_flash
picolibc
pico_lwip
pico_malloc
pico_multicore
pico_printf
pico_runtime
pico_stdio
pico_stdio_usb
pico_sync
pico_time
pico_util
pioasm
port
question
review
review2
rtos interop
runtime init
static library
svd
test
tinyusb
vscode
wifi integration
wontfix
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-raspberrypi/pico-sdk#2342
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hi,
I did a code that need pio_gpio_base set to 16.
However, we must use the GPIO pin number -16 in the wait instruction.
if we do this, the pio asm set the used_gpio_range to 2, and the sdk refuse to load the program with the return code -11
GPIO used for the wait : Pin 30 then goes to 14 when we remove 16.
I had to send the instruction via the register X, then do "mov exec,X" to have it doing the wait on the correct pin.
(It works like that)
Are you using the RP2350B ?
Yes of course
Le lun. 10 mars 2025, 14:12, Andrew Scheller @.***> a
écrit :
Is PICO_PIO_USE_GPIO_BASE == 1 ?
Yes as well.
Envoyé à partir de Outlook pour Androidhttps://aka.ms/AAb9ysg
From: Peter Harper @.>
Sent: Monday, March 10, 2025 2:41:57 PM
To: raspberrypi/pico-sdk @.>
Cc: FreddyV @.>; Author @.>
Subject: Re: [raspberrypi/pico-sdk] PIO program refuse to load: wait instruction need to have the GPIO nb-16 if pio_gpio_base is 16 (Issue #2342)
Is PICO_PIO_USE_GPIO_BASE == 1 ?
—
Reply to this email directly, view it on GitHubhttps://github.com/raspberrypi/pico-sdk/issues/2342#issuecomment-2710638478, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ASCSLB4WZTUQ6O3VU53GB7D2TWJCLAVCNFSM6AAAAABYWCB4LCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMJQGYZTQNBXHA.
You are receiving this because you authored the thread.Message ID: @.***>
[peterharperuk]peterharperuk left a comment (raspberrypi/pico-sdk#2342)https://github.com/raspberrypi/pico-sdk/issues/2342#issuecomment-2710638478
Is PICO_PIO_USE_GPIO_BASE == 1 ?
—
Reply to this email directly, view it on GitHubhttps://github.com/raspberrypi/pico-sdk/issues/2342#issuecomment-2710638478, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ASCSLB4WZTUQ6O3VU53GB7D2TWJCLAVCNFSM6AAAAABYWCB4LCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMJQGYZTQNBXHA.
You are receiving this because you authored the thread.Message ID: @.***>
Hi again.
it is not that it does not work.
I did prove that it work by modifying the PIO code from the Core, after loading the PIO program.
It is just the PIO program load that return an error, but it is correct... the wait instruction need a value <32, then the gpio number need to be reduced by 16.
Maybe the PIO asm does it if the pio_gpio_offset is set in the C portion of the .pio code ?
would be helpful to know what SDK version you are using, and to give some example code
Hi,
SDK 12.2.1
This is simple to reproduce, just set pio_gpio_base to 16
if we do a "wait 0 gpio 30" for example, it will be compiles as 30, not 14....
if we do "wait 0 gpio 14", the sdk will refuse it because 14 is < 16....
This is when the pio_gpio_base fonction is called in the main c code, not in the .pio file.
So, my question is are we obliged to do the pio_gpio_base in the .pio file, so that the asm detect it ?
you do have to set the gpio base before you load the program.
Example code is still helpful, even if a few lines of loading, and the source PIO, because otherwise we have to write it again to try and repro
Please attach a snippet of an actual
.piofile and.ccode that show the problem. Even your "simple" repro steps are far from clear."just set pio_gpio_base to 16" - where in the code?
"This is when the pio_gpio_base fonction is called in the main c code, not in the .pio file." presumably you mean
pio_set_gpio_base- what does "called from the .pio file" mean? if you mean in c code embedded in the .pio file then these are largely equivalentAlso, how are you loading the PIO program and initializing the PIO instance? (hence why .c code is helpful)
Note, if you call
pio_set_gpio_base(pio, 16)then try to load a program with await 0 gpio 14then of course the function refuses as you cannot reference pin 14 when gpio base is 16bumping to 2.3.0 as i havent heard back - suggest you try with the latest
develop(or 2.2.0 when it is release) though as there have been other changes in this area