Uno R3 pin D0 weirdness

I just built a project using the Uno R3. Although the code is relatively straightforward, I ended up using all the analog input pins as well as all the digital IO pins.

Because of this I set up a second Uno R3 as the loader and successfully loaded my program without having the bootloader there. This solved all the stuff happening on the IO pins during bootloader operation - almost.

One of the first things I do in setup() is to set each pin as input or output. For the output pins I first set their state then set them to output so as to avoid sending unwanted signals to my external circuitry.

However, pin D0 still shows a short high pulse on startup. I was unable to find anything about this from a few hours of searching forums and the net so swapped this to an input pin which looks at a toggle switch. I set D0 to input with the internal pull-up enabled and all seemed to go well.

However, I noticed that under certain conditions related to power usage in my external circuits, the Uno would get into a ~4 second reboot cycle. I checked all supplies and even fed the Uno from a separate external supply to no avail. I checked for noise on the reset pin, or ground noise, all looks great. The actual reboot occurs during a steady state draw so is not transient related.

Then on a lark, thinking about the pulse on D0 and the switch grounding it out, I placed a 150 ohm resistor in series with the switch. Well, that fixed the problem.

What the heck is going on here? Is there some odd interaction between the main processor and the one controlling the USB which needs that pulse on D0? Or what?

My project is working but I really want to know what is happening here.

D0, D1 are permanently attached to the USB<>Serial chip, so should not be used for anything else. The sensible thing to do when you need more pins is to use port expanders, not a second Arduino. Show your project if you want help with that.
Leo..

5 Likes

Show your schematic, maybe there are efficiencies(pin reduction) we can help with, from the "tickle trunk" of neat tricks.

1 Like

I can't show my schematic ("new users cannot upload attachments") but it's a one-off project to evaluate pyrofuses. I use two analog inputs for trip time and current setting, three analog inputs to do a continuous self test of the pyrofuse initiators by measuring their resistance, and one analog input from an isolator/conditioner module which converts a big 100 mV shunt to 0-5 volts (it sits at 2.50 volts when there is zero current). I need six digital outputs for the LCD display, three for the three FETs driving the pyro initiators, one input for the arm/disarm switch, and four outputs for status LEDs and driving relays for remote monitoring. And there we go, no more IO pins. I suppose I could have used a serial LCD but I only had a week to design build and code this thing so had to use what I had laying around. A second unit won't be built, but the algorithms may end up being used, so I don't really need help optimizing this design, I just was really curious why what I saw happened. It's been a long time and my previous coding was assembler and in assembler nothing is hidden but here it takes a lot of web digging to see exactly what code is running from the initial power-on. SOMETHING is running to make that D0 pulse, but who knows, it may be in the other USB/serial chip. I don't even know if I need that second chip as I'm programming using another Uno via the 6 pin header. You're certainly far more familiar with these units than I am!

A (classic) Nano (same processor) has two more analogue pins, A6,A7.
And is breadboard-friendly. Note that A6,A7 are analogue input-only, and D13 (LED attached) should only be used as output.
Leo..

The D0/D1 pins frequently have resistors (1k) connecting them to the USB/Serial chip. This provides enough isolation that you can usually connect those pins to other (non-serial) devices, but the resistor on D0 (RX of the Uno) will act as a pull-up or pull-down depending on the state of the TX pin of the USB/Serial chip (normally high, so normally a pull-up.
Unless the USB chip has some sort of power-down state when USB isn't connected. (which will depend on the exact chip used on your board, and it may still have transient behavior during power-up or reset.)

Interesting. My circuit simply has the output pin connect to a FET with sufficiently low threshold voltage and a 10K resistor to ground. So if that USB chip has a high output through a 1K resistor that would drive my FET on, and might be in that state for the very short time before my code runs and turns the port pin to an output with a low state which would override the high state through the 1K resistor. That is certainly a plausible explanation for the quick pulse. I still don't understand about the rebooting behavior when D0 is hard grounded, but do suspect the USB/serial chip is somehow responsible.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.