Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
For example, if I have an SPI memory and want to turn the power supply off during sleep mode (for low power consumption) what state should I put the SPI pins from the side of the MCU in order not to have sink/source leakage currents?
Hi,
Interestingly, if you drive a pin on some micro controllers high while the power is off the upper clamp diode will conduct and could actually start to power the device, turning it on. The current path is into the pin, through the clamp diode, to the +5v supply. Even though there is not much current available it could be enough to power the device.
Fairly obviously setting the pins as inputs will cure any potential problems, but if you're removing the positive power to the chip, then setting the processor pins LOW will avoid any issues as well.
If you don't have any pull-up or pull-down on the lines, and you set your GPIO to inputs, then the voltage can float. If it happens to float in no man's land, current consumption can increase in the uC as the input begins to switch.
Tony Nixon says:
A floating input WILL cause erratic chip operation. Maybe not while you force it to, but at some stage it will. I've had chips do all sorts of wierd things, until I eliminated a floating pin (or pins). Some of these chips froze just by placing a finger near them, some won't start, some start but run 'funny'. The worst problem is spending mutitudes of time finding out 'why', when you haven't realised the floating pin is the culprit. As far as I know, the excess currents are caused by input FETS not knowing what to do and the 'hi' and 'lo' ones turning on at the same time causing minute rail to rail shorts, which could be at any frequency. Surely this causes wonderful things to happen inside the die, false triggering the brown out detect etc. - who knows?.
I once inherited a design where current consumption was intended to be extremely low (~=60uA), and draw varied by the amount of ambient light falling of the PCB! Ends up, an LED was tied to an open-drain output. When the LED was off (normal), light level hitting the LED would change the voltage across it to the OD output (which was also an input, not unusual in a uP), and take the pin through different areas of the linear region. The solution was to pull-up the pin, so it was at VDD when the LED was off (the LED didn't care)."
Q: Recently, I had some odd problems with our [PICs] not going into sleep mode--or so it appears. Instead of the usual 30-70 uA of current draw from the battery, I am seeing 1-2 mA. Or what is even more baffling, a drop to sleep followed by a single slow rise to about 600 uA followed by a fall back to normal sleep current.
A: Dwayne Reid (dwayner at planet.eon.net) of Trinity Electronics Systems Ltd, Edmonton, AB, CANADA (780) 489-3199 voice (780) 487-6397 fax says:
I've had similar problems.
One of them turned out to be the oscillator pins floating. I added a 10M resistor from ocs1 to gnd - problem gone.
The other was an input pin floating - solution was to make it an output during sleep.
Use a high impedance probe and look around while the PIC is asleep - keep an eye on the quiescent current each time you touch something. Even a 10M scope probe will bring an input LO - you might not even see that it was floating if the pin / trace capacitance is really lo. But your quiescent current will plummet if you hit the problem pin.
I have a PIC16f886 that had PORTB3 analog floating hi, when PORTB5 goes low (dig output), the floating B3 also goes low, with no other encouragement than B5 going low.
Solution was to switch the analog input to an output.