AtMega328 disable BOD

Hi together,

I’m trying to minimize the power consumption of a pure AtMega328 as much as possible.

I don’t understand why I can’t disable BOD programmatically.

No matter how I do it, it has no effect:

  • LowPower.powerDown(SLEEP_1S, ADC_OFF, BOD_OFF);
  • sleep_bod_disable();
  • MCUCR |= (1<<BODS) | (1<<BODSE);
    MCUCR &= ~(1<<BODSE);
    sleep_cpu();

BUT when I set extended fuse manually to 0x07 with avrdude, current drops from 25uA to 6uA - which should be the difference consumed by bod.

Any hints or ideas?

Are you using a '328 instead of a '328p? (a '328-PU is not a '328p, it's a '328 in DIP package; the corresponding p-spec part is '328p-pu. The part after the - in atmel part numbers indicates the package, for example -AU is TQFP, -PU is DIP, etc.)

Per datasheet: Note: 1. BODS and BODSE only available for picoPower devices ATmega48PA/88PA/168PA/328P

As I interpret it, that means you can only disable the BOD from within the software on picopower devices.

Does the datasheet say you can do software can change the BOD? I don't think it does.

28.2 Fuse Bits

The ATmega48A/PA/88A/PA/168A/PA/328/P has three Fuse bytes. Table 28-4 - Table 28-9 on page 283 describe briefly the functionality of all the fuses and how they are mapped into the Fuse bytes. Note that the

fuses are read as logical zero, “0”, if they are programmed.

This includes the Extended fuse byte for BOD.

28.2.1 Latching of Fuses

The fuse values are latched when the device enters programming mode and changes of the fuse values will

have no effect until the part leaves Programming mode. This does not apply to the EESAVE Fuse which will

take effect once it is programmed. The fuses are also latched on Power-up in Normal mode.

28.8 Serial Downloading

Both the Flash and EEPROM memory arrays can be programmed using the serial SPI bus while RESET is

pulled to GND. The serial interface consists of pins SCK, MOSI (input) and MISO (output). After RESET is set

low, the Programming Enable instruction needs to be executed first before program/erase operations can be

executed. NOTE, in Table 28-17 on page 295, the pin mapping for SPI programming is listed. Not all parts use the SPI pins dedicated for the internal SPI interface.

So, I read it as something the software can't do. An external programmer is needed. Need to check the references in the prior post as well.

See top of page 40, top of page 45.

Hi,
thanks to you for your answers.

i could get it working as expected (it is an 328p-pu) with the code provided form the docs :slight_smile: :

 set_sleep_mode(SLEEP_MODE_PWR_DOWN);
 
  cli();
  if (true)
  {
    sleep_enable();
    sleep_bod_disable();
    sei();
    sleep_cpu();
    sleep_disable();
  }
  sei();

While the code from LowPower.powerDown is still not working properly.