Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 17:00 19 Jan 2026 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Unintended GPIO output during start of program

Author Message
Arne
Regular Member

Joined: 05/01/2025
Location: Germany
Posts: 46
Posted: 10:48am 18 Jan 2026
Copy link to clipboard 
Print this post

Is there an easy possibility to block the output of data to the GPIOs before/during setting of GPIOs as outputs. My code is as follows:

SetPin 24,dout
SetPin 25,dout
SetPin 26,dout
SetPin 27,dout
SetPin 29,dout
SetPin 31,dout
SetPin 32,dout
SetPin 34,dout
SetPin 11,dout
SetPin 12,dout
SetPin 14,dout
SetPin 15,dout
SetPin 16,dout
SetPin 17,dout
SetPin 19,dout
SetPin 20,dout
Port(11,2,14,4,19,2,24,4,29,1,31,2,34,1)=&B1111111111111111

If I start the program for approx. 5ms (during the SetPin - phase) unintended outputs to the GPIOs happen. A flickering of < 1 ms would be ok.

Any ideas ?

Arne
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10868
Posted: 11:06am 18 Jan 2026
Copy link to clipboard 
Print this post

The pins will be high-Z when the program starts. If important you would need pullup or pulldown resistors on your board
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2940
Posted: 11:23am 18 Jan 2026
Copy link to clipboard 
Print this post

> pin(1)=1 :setpin 1,dout :? pin(1):pin(2)=1 :setpin 2,dout :? pin(2)
1
1
>

So you could try:-
Pin(24)=1 : SetPin 24,dout
Pin(25)=1 : SetPin 25,dout
Pin(26)=1 : SetPin 26,dout
Pin(27)=1 : SetPin 27,dout
Pin(29)=1 : SetPin 29,dout
Pin(31)=1 : SetPin 31,dout
Pin(32)=1 : SetPin 32,dout
Pin(34)=1 : SetPin 34,dout
Pin(11)=1 : SetPin 11,dout
Pin(12)=1 : SetPin 12,dout
Pin(14)=1 : SetPin 14,dout
Pin(15)=1 : SetPin 15,dout
Pin(16)=1 : SetPin 16,dout
Pin(17)=1 : SetPin 17,dout
Pin(19)=1 : SetPin 19,dout
Pin(20)=1 : SetPin 20,dout
Port(11,2,14,4,19,2,24,4,29,1,31,2,34,1)=&B1111111111111111

It should make them go straight from high-Z to 1 without first being set to 0 (the default after Setpin) before the port command.
Edited 2026-01-18 21:33 by phil99
 
Arne
Regular Member

Joined: 05/01/2025
Location: Germany
Posts: 46
Posted: 12:22pm 18 Jan 2026
Copy link to clipboard 
Print this post

To set the pins before SetPin command worked perfect.

Thanks all,

Arne
 
DaveJacko
Regular Member

Joined: 25/07/2019
Location: United Kingdom
Posts: 92
Posted: 09:26pm 18 Jan 2026
Copy link to clipboard 
Print this post

While we're on the subject of GPIO..
can anyone point out what stupid mistake I'm making here?

wire together GP0 and GP1

setpin GP0,dout
setpin GP1,din
pin (GP0)=1
print pin(GP1)   - prints a 0 !!

also tried pin(GP0)=0, and PWM 1Khz 50%
checked with a meter, volts/freq as expected.
Just getting 0 on GP1
(I'm ultimately trying to get a settick type interrupt > 1 KHz )
Thanks in anticipation mates.
Try swapping 2 and 3 over
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2940
Posted: 10:24pm 18 Jan 2026
Copy link to clipboard 
Print this post

> setpin GP0,dout : setpin GP1,din
> pin(GP0)=1 : ? pin(GP1)
1
>

Check with a meter that you are getting 3.3V on GP1 at the pad on the Pico module.
If so you may have a dead pin. Try GP2 etc.
 
DaveJacko
Regular Member

Joined: 25/07/2019
Location: United Kingdom
Posts: 92
Posted: 10:54pm 18 Jan 2026
Copy link to clipboard 
Print this post

Thanks, Phil, I've tried that bit of code verbatim right now..
mine returns a zero
yes, I previously checked with meter, 3+ volts
tried another pico zero, same.
I think I may be making an even more fundamentally stupid mistake,
I'll sleep on it with a glass of Aussie red,
will let you know how I get on
Try swapping 2 and 3 over
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4209
Posted: 11:12pm 18 Jan 2026
Copy link to clipboard 
Print this post

  DaveJacko said  While we're on the subject of GPIO..
can anyone point out what stupid mistake I'm making here?

wire together GP0 and GP1

setpin GP0,dout
setpin GP1,din
pin (GP0)=1
print pin(GP1)   - prints a 0 !!

also tried pin(GP0)=0, and PWM 1Khz 50%
checked with a meter, volts/freq as expected.
Just getting 0 on GP1
(I'm ultimately trying to get a settick type interrupt > 1 KHz )
Thanks in anticipation mates.

You have a space after pin in
pin (GP0)=1

Please try it without the space (sorry, I'm guessing it matters here but may be wrong).

John
 
DaveJacko
Regular Member

Joined: 25/07/2019
Location: United Kingdom
Posts: 92
Posted: 11:25pm 18 Jan 2026
Copy link to clipboard 
Print this post

thanks, John, but well spotted!
tried it, don't think that's the problem.. sleeping on it
Try swapping 2 and 3 over
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2940
Posted: 11:31pm 18 Jan 2026
Copy link to clipboard 
Print this post

I would have expected that to be the issue too, had I noticed it. A CODE window makes spaces clearer.
However :-
> pin(GP0)=0 : ? pin(GP1)
0
> pin (GP0)=1 : ? pin(GP1) '1 space
1
> pin (GP0)=0 : ? pin(GP1) '1 space
0
> pin  (GP0)=1 : ? pin(GP1) '2 spaces
1
>
Did not expect that!
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6433
Posted: 11:52pm 18 Jan 2026
Copy link to clipboard 
Print this post

It should work as presented.
As Phil suggested, try GP2 etc
To see if one of the pins is reserved for some system purpose, try
new
option list
list pins


Jim
VK7JH
MMedit
 
mozzie
Senior Member

Joined: 15/06/2020
Location: Australia
Posts: 196
Posted: 02:12am 19 Jan 2026
Copy link to clipboard 
Print this post

G'day DaveJacko,
It might be a good idea to post the version of PicoMite and options list you are using, it could be a problem with a specific variant or option rather than generic.

I have tried your code on a RP2350A and RP2040 using V6.02.00RC7 and both work as expected, something strange going on somewhere.  

What happens if you apply 3v3 direct to GP1?

Regards,
Lyle

EDIT: Also tested on RP2040-Zero with V6.02.00RC7 and it works as expected. Possibly an option setting conflict?
Edited 2026-01-19 12:45 by mozzie
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2026