Tiny12 / Tiny11 Sleep mode wake on pin change

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

Hi. I have made an infrared remote with 4 buttons with a tiny12. All work fine, but now, I have to put the MCU into Sleep mode, waiting for a pin change interrupt... I'm not able to do it... When I put it on sleep mode, the MCU consume 9 mA... the application note say under 1 uA.. I have tested it with no part connected to the MCU, Same result...

Here is my test code:

reset:
cli
cbi DDRB,0 ;Set Input
sbi DDRB,1 ;Set Input
cbi DDRB,2 ;Set Input
cbi DDRB,3 ;Set Input

sbi PORTB,3 ;PullUp
sbi PORTB,2 ;PullUp
sbi PORTB,1 ;PullUp
sbi PORTB,0 ;PullUp

cbi PORTB,4 ;LED 0 at start
sbi DDRB,4 ;Led Output

; sbi DDRB,5 ;Feedback Output
; cbi PORTB,5 ;Zero at start

;Sleep Enabled code here...
ldi temp,0b00110001
out MCUCR,temp ;Enable Power down sleep mode, Sleep mode enabled
ldi temp,0b00100000
out GIMSK,temp ;Pin change interrupt enabled
ldi temp,0
out TIMSK,temp ;No timer interrupt
sei
stest:

sleep
rjmp stest

if someone can give me a code exemple, that would be very helpful.

Thanks!

Cedric, www.innovativedevice.com

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

Are you absolutely certain the chip is staying in sleep mode when you measure the power consumption? The way your test program works, it could be be caught in an infinite loop between sleeping and waking if any I/O pins are changing.

If you are only trying to measure the sleep mode power consumption with your test program, disable all interrupts and enter power down sleep mode, then see how much current the chip is consuming.

If you find the power consumption is what the data sheet claims at < 1 uA, then I would look for some unexpected signal activity on one or more I/O pins that prevents the chip from staying in sleep mode.

If you find the power consumption is still too high, then look for things like input pin voltages that are floating somewhere between ground Vcc levels. Is the brown out detector enabled? Is the internal voltage reference enabled by using the analog comparator bandgap reference? Watchdog timer enabled?

If none of the above helps, then it would be good to know which AVR clock source you are using.