What is the state of GPIO pins during upload?

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
BAleiHi
 
Posts: 4
Joined: Mon May 10, 2021 12:05 pm

What is the state of GPIO pins during upload?

Post by BAleiHi »

Hello,
I have an Adalogger, Feather M0 and with a scope on D12 I see a noisy 3.3V while uploading a sketch. The first thing I do in the setup code is set the pinMode and do a digitalWrite LOW which brings it back to 0. But the pin is connected to a valve that opens when HIGH and I don't want it to open when I upload a new or updated sketch (the valve opens a vacuum that I want to release only under very specific circumstances). And for sketches that don't deal with the pin, it stays high. Is that the default for all the pins? Can I change it?
Thanks.

User avatar
jevada
 
Posts: 194
Joined: Fri Dec 15, 2017 5:29 am

Re: What is the state of GPIO pins during upload?

Post by jevada »

In most controllers, GPIO pins that are floating after a reset. If your valve opens on a Vfloat and you need the pin to be low, you should add hardware to (weakly) pull the pin low. A pull-down resistor (let's say some 47k or so) usually will suffice.

User avatar
BAleiHi
 
Posts: 4
Joined: Mon May 10, 2021 12:05 pm

Re: What is the state of GPIO pins during upload?

Post by BAleiHi »

Thank you jevada,
I tried that - with a 47K and a 4.7K resistor and I'm still getting the issue. To be clear, I connected the resistor between the pin controlling the valve (D12) and ground. It appears that both D11 and D12 are set high during upload, with or without the resistor. The signal to them does not appear to be floating...it's definitely up at 3.3 V, but there is noise on it for part of the time. See below:
M0UploadD12.png
M0UploadD12.png (29.46 KiB) Viewed 64 times
My guess is that the "noise" has something to do with the serial communication during upload since it's very predictable. I also note that the base voltage is about 2.8V, not 3.3V. Any other thoughts?
Thanks

User avatar
westfw
 
Posts: 2008
Joined: Fri Apr 27, 2007 1:01 pm

Re: What is the state of GPIO pins during upload?

Post by westfw »

Some SAMD21 bootloader support loading over either the serial or the USB port. You might be seeing attempts to allow serial uploading, even though the feather uploads over USB.

Locked
Please be positive and constructive with your questions and comments.

Return to “Feather - Adafruit's lightweight platform”