Hi,
A program that uses BODS compiles for Atmega328 but not for Atmega168. How to fix it?
Thanks,
WI
Hi,
A program that uses BODS compiles for Atmega328 but not for Atmega168. How to fix it?
Thanks,
WI
Do the devices have the P suffix?
That would depend on the code, which you forgot to post, the board choice and the exact processor type. State the latter and use code tags.
In the older ATMega168, fuse settings are used to control the brown out detector.
Here is the code
#include <avr/power.h>
void setup() {
// put your setup code here, to run once:
noInterrupts (); // timed sequence follows
// turn off brown-out enable in software
MCUCR = bit (BODS) | bit (BODSE); // turn on brown-out enable select
MCUCR = bit (BODS); // this must be done within 4 clock cycles of above
interrupts (); // guarantees next instruction executed
}
void loop() {
// put your main code here, to run repeatedly:
}
Compiles when Processor: "Amega328" is selected from sketch menu
Does not compiles when Processor: "Amega168" is selected from sketch menu
jremington:
In the older ATMega168, fuse settings are used to control the brown out detector.
I m not there yet. It doesnt even compile.
"ATmega168" in the menu is plain 168, "ATmega328" is 328P for the standard Arduino boards.
You can add
#if defined(BODS) && defined(BODSE)
...
#endif
around the problematic code.
oqibidipo,
That will eliminate my BODS code. Whats the point?
I want BODS and P version supports it, how to enable it, I guess I need to change boards.txt ?
Well, I was going to ask if disabling BOD during sleep is crucial for your project, but was in a bit of a hurry... So the answer is yes.
Which board do you have? Which MCU does it have? (Some version of 168 obviously...) Does it have P suffix? If not, then the only way to disable BOD (completely) is to change the fuses. (Or change the MCU to a P version. Or use a different board.)