Keeping daughter board asleep after the microcontroller goes to sleep - Page 1
Forum section: electronics / beginners

author: cryptyk
author_rank: Contributor
timestamp: May 09, 2015, 04:14:51 pm
content: Hi!I'm new at this, so forgive my naivete. I have a Spark Core attached to a VS1053 (mp3 player) breakout board. I'm measuring current with the  uCurrent Gold device.When the system is up and running, the VS1053 board consumes about 35mA. When I drive the reset pin low on the VS1053, the current drops to about 4mA. The problem is that after I put the Spark Core to sleep, the current draw for the VS1053 jumps to about 55mA.My hypothesis is that when the Spark goes to sleep, the GPIO pin I use to drive the VS1053 reset low starts floating. I guess this doesn't account for the *increased* draw of 55mA vs. the regular 35mA, though.Not sure where to go from here. Any thoughts on solutions or troubleshooting would be awesome.Thanks!Ryan

author: kolonelkadat
author_rank: Regular Contributor
timestamp: May 09, 2015, 04:36:22 pm
content: maybe put a mosfet switch on the power for the peripherals? that way the micro goes to sleep, the mosfet turns off, then none of the peripherals get power.maybe also have a google for pull-up and pull-down resistors.

author: cryptyk
author_rank: Contributor
timestamp: May 09, 2015, 05:13:55 pm
content: Awesome. I'll go look at mosfets. I use pull-* resistors on my switches, so I'm familiar with them. Not sure how they apply here, though?Thanks,Ryan

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 09, 2015, 05:24:53 pm
content: Quote from: cryptyk on May 09, 2015, 05:13:55 pmFirst you should be shure that it is the floating reset pin.To be shure, hardwire reset to ground and send the spark into the power safe mode.If this works a simple pull-down resistor on the reset pin should keep it in power-down/reset if the MCU output floats.If the power still is high, disconnect the VS1053 to be shure that draws the power, if so, only then go for the FET

author: kolonelkadat
author_rank: Regular Contributor
timestamp: May 09, 2015, 05:28:55 pm
content: Quote from: cryptyk on May 09, 2015, 05:13:55 pmQuote from: cryptyk on May 09, 2015, 04:14:51 pmQuote from: PeterFW on May 09, 2015, 05:24:53 pm

author: cryptyk
author_rank: Contributor
timestamp: May 09, 2015, 05:46:14 pm
content: Oh, GOT IT!I hadn't thought of using a pull down that way. THANKS!!!Ryan

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 09, 2015, 06:54:20 pm
content: Quote from: cryptyk on May 09, 2015, 05:46:14 pmWell... that is what they are made for, if you think about it. :-)

author: cryptyk
author_rank: Contributor
timestamp: May 09, 2015, 07:34:34 pm
content: Ok, so that didn't work, but you helped me learn more about the problem, although the results make no sense to me...If I drive the VS1053 reset pin low using a GPIO write, it correctly drops to 4ma low power mode.If I instead unplug the reset pin jumper and move it directly to ground, it drops from about 35mA to 20mA. I would have expected it to go to low power modeThat could just be a huge misunderstanding on my part of how these things work...It's as if grounding the reset pin just gets me to 20mA, but setting it low with the GPIO pin correctly gets it into low power mode. Therefore my pull-down resistor still only gets me connected to ground, but that's not good enough.I hope that makes sense.Thanks for all of the help,Ryan

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 09, 2015, 07:45:27 pm
content: Quote from: cryptyk on May 09, 2015, 07:34:34 pmThere is someting bad happening, i just had a quick glance at the datasheet so i might be wrong, but the power consumption of the VS1053 should be <10µA when the reset pin is low.Correct supply voltage?No shorts?Maybe parasitic power?I would test the VS1053 without annything connected to it, if possible, to see if it behaves as the datasheet says.Then i would connect the data lines in sequence to see if/when this strange behaviour occours.Maybe a output of the spark core is shorted when the VS1053 is in reset, or something else.I do not know wich state it is or what is connected were but the datasheet says during reset the IO of the VS1053 will change to the respected default state.

author: cryptyk
author_rank: Contributor
timestamp: May 09, 2015, 07:55:06 pm
content: I just looked at the datasheet too, and saw the same thing. Maybe I should have mentioned this before, but this is the breakout I'm using:https://www.adafruit.com/products/1381It also has an SDcard on it, and some other stuff. I'm wondering if there's some weird interaction between the vs1053, sd card, and spark core such that when the spark goes to sleep, something else happens that causes "part" of the vs1053 board to come out of sleep mode.I like the idea of pulling the data pins and seeing if I can narrow down a bit more.I've tried supplying the board with 5v on the VCC pin and 3v3 on the 3v3 pin. Same results. Both of those voltages come from the spark core, which has both 5v and 3v3 outputs on it.Be back in a bit with some more details.Thanks,Ryan

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 09, 2015, 08:24:38 pm
content: Quote from: cryptyk on May 09, 2015, 07:55:06 pmYou blithering oath, there is your problem! :-) (i think)Well, at least one problem, that board is 5V tolerant, but works on 3.3V only and it has its own power regulators from the looks of it.You only connect one or the other supply, either 5V or 3.3V i suspect. At least that is the case with most of these boards. I suspect one of those is a output and not a input.

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 09, 2015, 08:31:57 pm
content: Yep, had a look, here it is:https://learn.adafruit.com/system/assets/assets/000/011/221/original/adafruit_products_vs1053_v2.png?1380122647The schematic says:The VIn/5V pin is the input to the on board 3.3V regulator.The 3.3V pin is theoutputof the on board regulator.

author: cryptyk
author_rank: Contributor
timestamp: May 09, 2015, 08:42:24 pm
content: I was only using one of those voltages at a time, not both at the same time. Sounds like I should be using 5v to the VCC pinI also found the problem: It's the DREQ pin.The VS1053 pulls it's DREQ pin low to indicate it can receive more data/commands. I have this hooked up to a GPIO input on the Spark Core.Here's the summary:1) Drive the VS1053 reset pin low: 4mA draw2) Put the Spark Core to sleep: 20mA3) Unplug the DREQ pin: 4mA4) Plug the DREQ pin back in: 20mAI obviously can't avoid using the DREQ pin in normal operation. It seems weird to me that DREQ, being an output on the VS1053, would cause the board to draw power when it's connected, but not when it's disconnected.

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 09, 2015, 08:56:28 pm
content: Quote from: cryptyk on May 09, 2015, 08:42:24 pm4mA with a sd-card in the socket or without a sd-card in the socket?The DREQ pin is not wired through the level shifter.You wired the DREQ directly to the Spark-IO and are using the Spark pin configured as input to read the state of DREQ?My wild guess DREQ is default high, during reset as well, then the spark IO pin goes low during power down/sleep (no idea how it works, never used one)."Short" between DREQ and spark IO.Solution, resitor in line, 100K perhaps, rough guess.

author: cryptyk
author_rank: Contributor
timestamp: May 09, 2015, 09:16:14 pm
content: You're a god.I put a 6.8k resistor inline, and now DREQ still works, and powerdown mode only consumes 2.2mA.I'm still not sure why it's not in the uA range, but that may just be the SD card- not sure.Thank you SO much for taking your Saturday morning and helping me!!!Ryan

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 09, 2015, 09:46:37 pm
content: Quote from: cryptyk on May 09, 2015, 09:16:14 pmJaffa, kree!QuoteInteresting and strange at the same time, but good that it works now.Does the Spark-IO really go low in the sleep mode?Maybe, if it really was a short, there could allready have been a tiny bit of magic blue smoke leakage.QuoteYes, that is the sd-card, they have horrible stand by currents.You are lucky that is only draws 2.2mA, that could be much, much worse.You have 4 components consuming power:Regulator @ ~80µALevel shifter @ 1µAMP3 decoder @ 5µA (in reset)and the SD cardIf you really want to safe as much power as you can, you will have to switch the power to the whole board off using a n channel fet with low rds-on and low-vgs.And you will have to make shure that all data lines are low or tristate when the board power is switched off or you will have some parasitic feeding through the data lines.Or you can use a buffer to tri state all lines together with the FET.Edit:There are SD card with much better idle currents, maybe you card has a power safe mode too.Check if all data lines are low when the spark is in sleep mode.Again, disconnect the data lines to make shure of that.Maybe the sd-card goes into sleep mode if it does not see anny action on the spi interface for long enough.