Strange behavior of Tiny828 when in sleep mode

Go To Last Post
16 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

When I leave my keyboard at rest, it goes to sleep and draws 3.5uA, then after a while(can be over an hour) it suddenly draws 500uA - what causes this. Normal operation is proven as key pressed, wakes up tiny828, transmit keycode then go to sleep(3.5uA). A key press is the normal wake up due to pin-change interrupt on 1 of 7 column sense lines of the key matrix. When the tiny has entered this excess(500uA) state I am able to press a key and bring it back to the normal(sleep) state drawing 3.5uA.

Also discovered that when I attempt to measure supply voltage with a DVM it seems to force the tiny into this excess current state.

I have left the design powered up overnight, after adding extra capacitance on the tiny's 3V supply.

Anyone had any problems like this with a low power uC design?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

-- What is connected to your AVR?
-- Which wakeup sources are enabled?
-- Are there any floating I/O pins?

My guess would be either a spurious wakeup from a floating pin, or floating pins themselves causing excessive draw.

Also, how is the current consumption being measured? The AVR draw itself, or to a regulator?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

PB0-6 are i/p's with pullup's (no drive signal until key pressed), PA0-7 are o/p's(no load until key pressed). portC all i/p's with pull-up except PC0 which drives NPN transistor base via 1k, PortD allocated to 6-pin ISP interface for debug/programming. Not sure how spi i/f should be handled once debug i/f is disconnected?
Wakeup is via PB0-6(pin change)
No floating inputs that I'm aware of.

I measure current between 9V supply and the i/p of the 3V regulator(very low Iq and leakage)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

I measure current between 9V supply and the i/p of the 3V regulator(very low Iq and leakage)

I realize that certain regulators "star" in these situations. But IMO you need to measure the current draw between the regulator and the AVR so that you can definitely point to the AVR as the culprit.

Also examine your current measurement setup. For example, with some models of Fluke DMM the characteristics change when they go to sleep.

Is the "wake" current 500uA? (in other words, do symptoms point to a spurious wakeup?)

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Your points are valid, I will certainly be switching to direct current measurement of the 3V rail tomorrow. My current measurements are being made with a mains supplied digital meter that doesn't sleep/wake and the interesting point was touching the dc power rail with a DVM probe changed the supply current from 3.5 to 500uA. Yes it could be a spurious wakeup but since no key is pressed it should go straight back to sleep.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As a sanity check in situations like this, I'd do something like this:

-- Initialize an EEPROM location for "wakeup count".
-- Have an EEPROM array of n bytes; say 100.
-- Each wakeup, increment the wakeup count location, and store the wakeup cause (in your case, PINB) to the corresponding byte of the array.
-- After a run, use ISP to read out and examine the logged information.

In your case, a PINB indicating nothing pressed would be all high bits? Whichever; high or low. If "no key pressed" then it would be a spurious wakeup from some source. Examine the code for other possible wakeup sources--USART? TWI?

If no wakeups are logged, then it shouldn't be the AVR per se, right?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yep, that's another fine idea - I'll certainly give this a go, cheers.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If your transistor drive pin is high, it will be sourcing about 4ma into the transistor base. That comes from the power supply.

Also, 4mA is a lot of base current. Fully saturated at a beta of 10, that transistor can sink 40mA. Do you need to sink that much current with the transistor?

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My transistor base drive current will be in the order of (2.9V - 0.7)/1K=2.2mA, (due to operating supply voltage of 3V and base limiting resistor) and with a beta >50 and my load side current limiting components means my Load consumes about 70mA, This is what I want as the load is only driven by very short pulse bursts(6 x 7us) and this only occurs when the uC is awake and I see a valid key press. Cheers Guys.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So, The overnight current meter still reads 3.2uA therefore the circuit has not locked up in 500uA mode but when I touch the dc neg rail with DVM lead it goes straight into 500uA mode, power on/off cycle to bring it back to normal - more investigations needed I thimk. At least it didn't lockup into 500uA mode overnight so thats good!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Looks like static electricity is launching the uC into excess current mode(500uA). If I hold onto Earth and touch the supply rail with the DVM all is good, then if I let go of the earth and move my chair and touch the rail again the uC draws excess current, lovely! Transient suppressor maybe?

Just sprayed the floor with anti-static solution, good idea huh? I now have to walk the length of my room and back to cause the excess current problem.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So, the slightest static causes the tiny828 to wake from sleep mode(thinks a key has been pressed) and the uC powers up but my code detects "no key down" and should go back to sleep but doesn't. So, I changed my code, checking my column sense lines early after wakeup and if non-active, go straight back to sleep. Guess what - it seems to work, brilliant! My design doesn't jump into excess current mode when I'm not using it and if I get spurious wakeups(static) it just goes back to sleep again.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It may work, but if this was my project I would want to sort the problem out at source, rather than find a workaround.
I know some people regard this as heresy.

Four legs good, two legs bad, three legs stable.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The problem occurs due to static on the i/o pins and because they are configured for a pinchange interrupt the uC wakes, by the time port is read there's no active state showing. I could of course filter all my column sense lines but I reckon the design will be more robust when enclosed in it's case but should a spurious wakeup occur it now does not get stuck in the powered ON state.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

but should a spurious wakeup occur it now does not get stuck in the powered ON state.

I thought you said earlier that when awakened, it would go back to sleep?

Anyway, our AVR apps seem to be pretty robust generally when "handled". Certainly when a 'scope probe crosses pins or the like, strange things would happen to the app.

But indeed you must protect the final app from any conditions that might violate Absolute Maximum Ratings.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm afraid if someone wants to destroy a product I'm sure they can find a way. This design seems robust now and there is no possible way of making direct contact to discharge static when its fitted into its case. Most of my problems yesterday/today were down to me carrying around a cloud electrons and it seems they wanted to jump into my circuit(or something similar).