Can I run an Atmega168 at 1Mhz with the Arduino bootloader on it? if so, what do I need to do to get the bootloader to work?
I want to make a battery operated device where speed is not critical so running it at 1Mhz (or even 8Mhz if that is easier) will give a much logner battery life.
Has anyone done this before?
system
December 6, 2008, 9:18pm
2
I'm sure it is doable but it might take a custom bootloader to get the communications right or possibly you can just change the upload speed to some value that is 1/8 of the lilypad.
system
December 8, 2008, 4:00pm
3
Ok, 1mhz it works!! I hacked together an example from the lilypad bootloader, tested millis and serial communication too.
exit arduino
unzip http://opengauge.org/projects/slowduino.zip to your bootloader directory
edit your boards.txt and add this to the bottom of the file and save it:
##############################################################
slowduino.name=slowduino
slowduino.upload.protocol=stk500
slowduino.upload.maximum_size=14336
#slowduino.upload.speed=19200
slowduino.upload.speed=2400
#slowduino.bootloader.low_fuses=0xe2
slowduino.bootloader.low_fuses=0x62
slowduino.bootloader.high_fuses=0xdd
slowduino.bootloader.extended_fuses=0x00
slowduino.bootloader.path=slowduino
slowduino.bootloader.file=slowduinoBOOT_168.hex
slowduino.bootloader.unlock_bits=0x3F
slowduino.bootloader.lock_bits=0x0F
slowduino.build.mcu=atmega168
slowduino.build.f_cpu=1000000L
slowduino.build.core=arduino
start arduino, select board slowduino, burn bootloader.
enjoy
It is hacked to run at 2400 baud for uploading. here is a script I had to tweak but it also sends out data at 2400 baud from the script running @1MHZ :
#define ledPin 13
void setup(){
pinMode(ledPin,OUTPUT);
Serial.begin(19200);
UBRR0L=25;//2400 baud @1mhz hack
}
void loop(){
digitalWrite(ledPin,HIGH);
delay(1000);
digitalWrite(ledPin,LOW);
delay(1000);
Serial.println(F_CPU);
}
Of course it could be better/faster baud, but if you don't care about that then this works.
Note: It doesn't matter if you have a crystal installed, these settings will effectively ignore it (same with lilypad).
system
December 8, 2008, 6:46pm
4
Thanks, might give this a try later
zooto68
December 9, 2008, 11:34am
5
Cool. I will give this a go too. Thanks.