We have a Particle Electron microcontroller connected to an Adafruit RFID Shield(PN532). Somehow, the microcontroller's VUSB (+5V typical) ended up connected to the GND pin of the Shield and the microcontrollers 3V3 to the Shields 5V input. Oddly enough, the devices seemed to properly function despite this. Shouldnt this cause an issue? Is it okay to just swap the ground and supply pins on a microcontroller?
-
3\$\begingroup\$ No, it is not okay in general to swap power and ground on a microcontroller. However, without schematics of both boards it is difficult to say exactly how things were connected. What was the USB connector connected to at the time? \$\endgroup\$– Elliot AldersonCommented May 8, 2019 at 18:16
-
1\$\begingroup\$ It would be helpful if you explained in full detail how it was setup. Ideally you'd provide a schematic. Otherwise we are left to make assumptions. I will assume the board was powered from the USB port, and not through a pin header. \$\endgroup\$– BortCommented May 8, 2019 at 18:28
2 Answers
Looking at the schematics here is how the Arduino gets connected:
I'm guessing what happened is that you offset the pins down by one (which I don't see how is possible but I guess it can happen), causing the +5V to get connected to GND2 and +3V to be connected to +5V on the shield.
The shield has its own power supply:
Which takes anywhere from 2.5V to 5.5V and converts it to VDD. That is why the +3V worked just fine as the power input (some Arduino's are actually 3.3V).
It is not recommended to swap V+ and GND on any microcontroller. This can often exceed the limits of the controller (even though it won't power up) and burn out portions of the internal circuitry.
What you ended up having though was a short between +5V and GND2, and I'm not sure why that didn't cause an issue. Perhaps the Arduino has some circuitry to withstand that, but because GND1 and GND2 are tied together, it was probably at a low enough potential to allow the shield to operate properly.
Some USB ports are also smart enough to shut off the power if they sense a short, so if you were powering it through a hub or from a computer via USB and had an external supply on it, it may have went into some kind of fail-safe protection.
-
\$\begingroup\$ "shunted it" -> "shut it off"? I think "shunted" implies a crowbar circuit \$\endgroup\$ Commented May 8, 2019 at 22:15
-
\$\begingroup\$ @immibis - "Shunt" to me means shorting. \$\endgroup\$– BortCommented May 9, 2019 at 0:54
-
\$\begingroup\$ @Bort Right, which is not what the USB port does. \$\endgroup\$ Commented May 9, 2019 at 2:26
-
\$\begingroup\$ @immibis I used the wrong term there, I meant that the USB port may have some kind of short-circuit protection that kept it from burning out the port. \$\endgroup\$ Commented May 9, 2019 at 2:46
If you really swapped VCC and ground pins nothing would work as nearly all chips (there are several on an Arduino board) have ESD protection circuits like this:
on every pin. That's a lot of diodes and they're mostly in parallel (they're all between the supply line and Ground)
Note how there are two diodes in series which would work in forward mode (conduct) if the supply got reversed (VCC = 0 V and GND = +5V). If the supply can deliver enough current many of these diodes will be damaged and the ICs will become useless.
So I think that something else must be happening in your setup!