Добрый! ATMega168PB. Хочу программно выключать BOD в спящем режиме.
В даташите так: The BODS bit must be written to '1' in order to turn off BOD during sleep.
Writing to the BODS bit is controlled by a timed sequence and the enable bit BODSE.
To disable BOD in relevant sleep modes, both BODS and BODSE must first be written to '1'.
Then, BODS must be written to '1' and BODSE must be written to zero within four clock cycles.
The BODS bit is active three clock cycles after it is set.
A sleep instruction must be executed while BODS is active in order to turn off the BOD for the actual sleep mode.
The BODS bit is automatically cleared after three clock cycles.
BODSE enables setting of BODS control bit, as explained in BODS bit description. BOD disable is controlled by a timed sequence.
Note: VBOT may be below nominal minimum operating voltage for some devices. For devices where this
is the case, the device is tested down to VCC = VBOT during the production test. This guarantees that a
Brown-Out Reset will occur before VCC drops to a voltage where correct operation of the microcontroller
is no longer guaranteed. The test is performed using BODLEVEL = 110, 101 and 100.
Делаю вот так, но судя по потреблению ус-ва не отключается BOD
mcucr1 = MCUCR |= (1<<BODS) | (1<<BODSE);
mcucr2 = mcucr1 &= ~(1<<BODSE);
MCUCR = mcucr1;
MCUCR = mcucr2;
или:
MCUCR |= (1<<BODS) | (1<<BODSE);
MCUCR &= ~(1<<BODSE);
или:
MCUCR = 0x60;
MCUCR = 0x40;