PIO program refuse to load: wait instruction need to have the GPIO nb-16 if pio_gpio_base is 16 #2342

Open
opened 2025-03-10 08:03:45 -05:00 by FreddyVRetro · 10 comments
FreddyVRetro commented 2025-03-10 08:03:45 -05:00 (Migrated from github.com)

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)

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)
lurch commented 2025-03-10 08:12:04 -05:00 (Migrated from github.com)

Are you using the RP2350B ?

Are you using the RP2350B ?
FreddyVRetro commented 2025-03-10 08:33:06 -05:00 (Migrated from github.com)

Yes of course

Le lun. 10 mars 2025, 14:12, Andrew Scheller @.***> a
écrit :

Are you using the RP2350B ?

—
Reply to this email directly, view it on GitHub
https://github.com/raspberrypi/pico-sdk/issues/2342#issuecomment-2710555583,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ASCSLB7TGCATENCFHBARCHD2TWFTVAVCNFSM6AAAAABYWCB4LCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMJQGU2TKNJYGM
.
You are receiving this because you authored the thread.Message ID:
@.***>
[image: lurch]lurch left a comment (raspberrypi/pico-sdk#2342)
https://github.com/raspberrypi/pico-sdk/issues/2342#issuecomment-2710555583

Are you using the RP2350B ?

—
Reply to this email directly, view it on GitHub
https://github.com/raspberrypi/pico-sdk/issues/2342#issuecomment-2710555583,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ASCSLB7TGCATENCFHBARCHD2TWFTVAVCNFSM6AAAAABYWCB4LCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMJQGU2TKNJYGM
.
You are receiving this because you authored the thread.Message ID:
@.***>

Yes of course Le lun. 10 mars 2025, 14:12, Andrew Scheller ***@***.***> a écrit : > Are you using the RP2350B ? > > — > Reply to this email directly, view it on GitHub > <https://github.com/raspberrypi/pico-sdk/issues/2342#issuecomment-2710555583>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/ASCSLB7TGCATENCFHBARCHD2TWFTVAVCNFSM6AAAAABYWCB4LCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMJQGU2TKNJYGM> > . > You are receiving this because you authored the thread.Message ID: > ***@***.***> > [image: lurch]*lurch* left a comment (raspberrypi/pico-sdk#2342) > <https://github.com/raspberrypi/pico-sdk/issues/2342#issuecomment-2710555583> > > Are you using the RP2350B ? > > — > Reply to this email directly, view it on GitHub > <https://github.com/raspberrypi/pico-sdk/issues/2342#issuecomment-2710555583>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/ASCSLB7TGCATENCFHBARCHD2TWFTVAVCNFSM6AAAAABYWCB4LCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMJQGU2TKNJYGM> > . > You are receiving this because you authored the thread.Message ID: > ***@***.***> >
peterharperuk commented 2025-03-10 08:41:35 -05:00 (Migrated from github.com)

Is PICO_PIO_USE_GPIO_BASE == 1 ?

Is PICO_PIO_USE_GPIO_BASE == 1 ?
FreddyVRetro commented 2025-03-10 09:08:38 -05:00 (Migrated from github.com)

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: @.***>

Yes as well. Envoyé à partir de Outlook pour Android<https://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 GitHub<https://github.com/raspberrypi/pico-sdk/issues/2342#issuecomment-2710638478>, or unsubscribe<https://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 GitHub<https://github.com/raspberrypi/pico-sdk/issues/2342#issuecomment-2710638478>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ASCSLB4WZTUQ6O3VU53GB7D2TWJCLAVCNFSM6AAAAABYWCB4LCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMJQGYZTQNBXHA>. You are receiving this because you authored the thread.Message ID: ***@***.***>
FreddyVRetro commented 2025-03-10 10:06:58 -05:00 (Migrated from github.com)

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 ?

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 ?
kilograham commented 2025-03-18 09:44:18 -05:00 (Migrated from github.com)

would be helpful to know what SDK version you are using, and to give some example code

would be helpful to know what SDK version you are using, and to give some example code
FreddyVRetro commented 2025-03-18 10:13:06 -05:00 (Migrated from github.com)

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 ?

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 ?
kilograham commented 2025-03-18 10:17:08 -05:00 (Migrated from github.com)

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

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
kilograham commented 2025-04-07 11:51:18 -05:00 (Migrated from github.com)

Please attach a snippet of an actual .pio file and .c code 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 equivalent

Also, 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 a wait 0 gpio 14 then of course the function refuses as you cannot reference pin 14 when gpio base is 16

Please attach a snippet of an actual `.pio` file and `.c` code 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 equivalent Also, 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 a `wait 0 gpio 14` then of course the function refuses as you cannot reference pin 14 when gpio base is 16
kilograham commented 2025-07-22 17:00:40 -05:00 (Migrated from github.com)

bumping 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

bumping 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
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-raspberrypi/pico-sdk#2342
No description provided.