Tiny2313 Sleep mode

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

I am wanting to run a Tiny2313 from 4x NmHi batteries and am therefore using Sleep mode to conserve power. This is also the first time I have used Sleep.

The hardware consists of
Tiny 2313 running at 20Mhz external Ceramic Resonator
3 way switch PD3 - PD6
8 way switch PB1 - PB7
Wake up Push switch on PD2 (Int0)
1 way switch on PD0
LED on PD3
RS485 Driver on PD1

Brown out Detector is disabled.
Watchdog is disabled (WDTCSR = 0x00;)

No external pull up are used.

When awake I have an LED (set for 5mA) flashing every second. When a sleep, the LED stops flashing.

The following are my routine to put the Tiny to sleep
and the Interrupt to wake it up.

Just before I call SleepNow, I disable interrupts.

void sleepNow()
{
	LED0 = 0;					// LED off (high)
	MCUCR |= (1<<PUD);
	set_sleep_mode(SLEEP_MODE_PWR_DOWN);
	UCSRB = 0x00;
	sleep_enable();
	sleep_mode();
}

ISR(INT0_vect)
{
	UCSRB |= (1<<TXEN)|(1<<TXCIE);
	sei();
	MCUCR &= !(1<<PUD);
	LED0 = 1;								// LED on (low)
	tick = 0;
	tickRIP = 0;
	sleep_disable();						//wake up
}

So what I have noticed when I put a multimeter in series with the battery, in normal operation the current draw is 56mA. In Sleep it goes down to 48mA.
I have tried both Sleep in Idle and Standby, but these seem to make very little difference.

Is this the best I should expect?

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

Quote:
Just before I call SleepNow, I disable interrupts.
Then, how can you wake up the chip?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
// you should never call sei() from inside an ISR()
   sei();
// this is plain wrong
   MCUCR &= !(1<<PUD);
// this means:
   MCUCR &= 0;

You probably intended to use

   MCUCR &= ~(1<<PUD);

20MHz seems quite a fast clock for an LED flasher.

I suspect that your RS485 chip and other hardware will be drawing current.

Do you have a schematic ?

David.

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

7 way switch PB1 - PB7 or 8 way switch PB0 - PB7

LED on PD3 and 3 way switch PD3 - PD6

attention to detail will always be its own reward.

Ross McKenzie ValuSoft Melbourne Australia