Disable BOD by Software (Attiny85)

Hello,

As mentioned in the datasheet of the ATTiny85 on page 35 I would like to disable Brown-Out-Detection when going to sleep (Power Down) on my ATTiny85. Therefore I'm using the code from Jack here

But my current consumption is still 18.7uA which seems for me, that the BOD is still active. When the BOD is disabled I would expect anything below 1uA...
The date code on my ATTiny85 says 1614 - so it should be pretty new.

Has anyone ever archived to disable the BOD by software on an ATTiny85?? I couldn't find any "evidence" on the internet... Or even better, if you have an ATTiny85, could you please verify if the code from Jack above runs with low power consumption?

Btw: I have enabled BOD at 2.7v in my fuse settings.

Thanks!

1 Like

How do you measure the power consumption of your ATtiny85? Are you sure that your multimeter is still accurate enough to measure the µA?

Or even better, if you have an ATTiny85, could you please verify if the code from Jack above runs with low power consumption?

No, that code is not complete, it's just an excerpt. Show us the code you're using.

Did you read section 7.2.1 of the datasheet? What revision do you have?

I'm using a uCurrent Gold to measure the power consumption.

Here is the full code

#include <avr/sleep.h>
#include <avr/interrupt.h>
#define BODS 7                   //BOD Sleep bit in MCUCR
#define BODSE 2                  //BOD Sleep enable bit in MCUCR
uint8_t mcucr1, mcucr2;

void goToSleep(void) {
GIMSK |= _BV(INT0);                       //enable INT0
   MCUCR &= ~(_BV(ISC01) | _BV(ISC00));      //INT0 on low level
   ACSR |= _BV(ACD);                         //disable the analog comparator
   ADCSRA &= ~_BV(ADEN);                     //disable ADC
   set_sleep_mode(SLEEP_MODE_PWR_DOWN);
   sleep_enable();
   //turn off the brown-out detector.
   //must have an ATtiny45 or ATtiny85 rev C or later for software to be able to disable the BOD.
   //current while sleeping will be <0.5uA if BOD is disabled, <25uA if not.
   cli();
   mcucr1 = MCUCR | _BV(BODS) | _BV(BODSE);  //turn off the brown-out detector
   mcucr2 = mcucr1 & ~_BV(BODSE);
   MCUCR = mcucr1;
   MCUCR = mcucr2;
   sei();                         //ensure interrupts enabled so we can wake up again
   sleep_cpu();                   //go to sleep
   cli();                         //wake up here, disable interrupts
   GIMSK = 0x00;                  //disable INT0
   sleep_disable();               
   sei();                         //enable interrupts again (but INT0 is disabled from above)

}
 
void setup() {
goToSleep();
}
 
void loop() {

}

Yes, I saw that limitation. I don't know how to find out the revision of the chip. I searched for hours how to interpret the labels on the IC, nevertheless I couldn't find out. The datasheet was modified around 2008 with the section about software BOD disable and my Attiny date code is 1614, therefore I assume it should be revision C or even later. But I'm not sure. If you know, how to determine the revision... would be greatly appreciated.

The datasheet mentions where you find the revision information. What package format does your ATtiny have?

Your pins are floating and are not in a defined state. What external circuit do you have on your ATtiny? Post the schematic of your setup.

pylon:
The datasheet mentions where you find the revision information. What package format does your ATtiny have?

Your pins are floating and are not in a defined state. What external circuit do you have on your ATtiny? Post the schematic of your setup.

PDIP package.
In power down mode, floating pins do not matter as far as I know. No external circuit, just the bare Attiny85.
If I disable the BOD by fuses I get the expected power consumption of 200nA, therefore it's not an issue how I connected something...

The revision should be on the bottom side of the package.

The external circuit should at least include a decoupling capacitor.

To check if your ATtiny supports software BOD disabling you can try setting the BODS bit as described in the datasheet and just reading it again (within 3 clock cycles). If you read a 1 your Tiny supports the feature, otherwise it doesn't.