Pages: 1 [2]   Go Down
Author Topic: ATmega328P targeted at low-power battery use: help needed with baby steps!  (Read 2331 times)
0 Members and 1 Guest are viewing this topic.
Switzerland
Offline Offline
Sr. Member
****
Karma: 6
Posts: 375
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Anyone got a precompiled 1MHz-friendly ATmega328P bootloader.hex file?

Here you go.  They're untested I'm afraid, but I'm using Optiboot on other boards at non-standard frequencies and baud-rates with no problems.

atmega328_1a.hex (Optiboot for 9600baud at 1MHz)
Code:
:107E0000112484B714BE81FFE6D085E08093810001
:107E100082E08093C00088E18093C10086E0809377
:107E2000C2008CE08093C4008EE0BFD0259A86E02B
:107E300023EC3FEF91E0309385002093840096BBC4
:107E4000B09BFECF1D9AA8958150A9F7EE24FF2480
:107E5000AA24A394B5E0CB2EA1E1BA2EF3E0DF2E45
:107E600098D0813461F495D0082FA5D0023829F13B
:107E7000013811F485E001C083E083D07FC08234F3
:107E800011F484E103C0853419F485E09CD076C0F8
:107E9000853579F47ED0E82EFF247BD0082F10E0C2
:107EA000102F00270E291F29000F111F84D07801E1
:107EB00065C0863521F484E086D080E0DECF84364C
:107EC00009F040C066D065D0082F63D080E0E81686
:107ED00080E7F80618F4F701D7BEE895C0E0D1E0D6
:107EE00058D089930C17E1F7F0E0EF16F0E7FF06A2
:107EF00018F0F701D7BEE8955ED007B600FCFDCFBD
:107F0000A701A0E0B1E02C9130E011968C9111977F
:107F100090E0982F8827822B932B1296FA010C0160
:107F2000A7BEE89511244E5F5F4FF1E0A038BF0770
:107F300051F7F701C7BEE89507B600FCFDCFB7BE05
:107F4000E8951CC0843761F424D023D0082F21D0B9
:107F500032D0F70185917F0114D00150D1F70EC0C6
:107F6000853739F428D08EE10CD085E90AD08FE02E
:107F700084CF813511F488E018D01DD080E101D084
:107F80006FCF982F8091C00085FFFCCF9093C600E3
:107F900008958091C00087FFFCCF8091C00084FDD0
:107FA00001C0A8958091C6000895E0E6F0E098E150
:107FB000908380830895EDDF803219F088E0F5DF4B
:107FC000FFCF84E1DECF1F93182FE3DF1150E9F7D5
:107FD000F2DF1F910895282E80E0E7DFEE27FF27CC
:027FE000099402
:027FFE0000057C
:0400000300007E007B
:00000001FF

atmega328_1b.hex (Optiboot for 4800baud at 1MHz)
Code:
:107E0000112484B714BE81FFE6D085E08093810001
:107E100082E08093C00088E18093C10086E0809377
:107E2000C20089E18093C4008EE0BFD0259A86E02D
:107E300023EC3FEF91E0309385002093840096BBC4
:107E4000B09BFECF1D9AA8958150A9F7EE24FF2480
:107E5000AA24A394B5E0CB2EA1E1BA2EF3E0DF2E45
:107E600098D0813461F495D0082FA5D0023829F13B
:107E7000013811F485E001C083E083D07FC08234F3
:107E800011F484E103C0853419F485E09CD076C0F8
:107E9000853579F47ED0E82EFF247BD0082F10E0C2
:107EA000102F00270E291F29000F111F84D07801E1
:107EB00065C0863521F484E086D080E0DECF84364C
:107EC00009F040C066D065D0082F63D080E0E81686
:107ED00080E7F80618F4F701D7BEE895C0E0D1E0D6
:107EE00058D089930C17E1F7F0E0EF16F0E7FF06A2
:107EF00018F0F701D7BEE8955ED007B600FCFDCFBD
:107F0000A701A0E0B1E02C9130E011968C9111977F
:107F100090E0982F8827822B932B1296FA010C0160
:107F2000A7BEE89511244E5F5F4FF1E0A038BF0770
:107F300051F7F701C7BEE89507B600FCFDCFB7BE05
:107F4000E8951CC0843761F424D023D0082F21D0B9
:107F500032D0F70185917F0114D00150D1F70EC0C6
:107F6000853739F428D08EE10CD085E90AD08FE02E
:107F700084CF813511F488E018D01DD080E101D084
:107F80006FCF982F8091C00085FFFCCF9093C600E3
:107F900008958091C00087FFFCCF8091C00084FDD0
:107FA00001C0A8958091C6000895E0E6F0E098E150
:107FB000908380830895EDDF803219F088E0F5DF4B
:107FC000FFCF84E1DECF1F93182FE3DF1150E9F7D5
:107FD000F2DF1F910895282E80E0E7DFEE27FF27CC
:027FE000099402
:027FFE0000057C
:0400000300007E007B
:00000001FF

boards.txt entries:
Code:
atmega328_1mhz_9600baud.name=Optiboot 1MHz 9600baud
atmega328_1mhz_9600baud.upload.protocol=arduino
atmega328_1mhz_9600baud.upload.maximum_size=32256
atmega328_1mhz_9600baud.upload.speed=9600
atmega328_1mhz_9600baud.bootloader.low_fuses=0xff
atmega328_1mhz_9600baud.bootloader.high_fuses=0xde
atmega328_1mhz_9600baud.bootloader.extended_fuses=0x05
atmega328_1mhz_9600baud.bootloader.path=optiboot_v50
atmega328_1mhz_9600baud.bootloader.file=atmega328_1a.hex
atmega328_1mhz_9600baud.bootloader.unlock_bits=0x3F
atmega328_1mhz_9600baud.bootloader.lock_bits=0x2F
atmega328_1mhz_9600baud.build.mcu=atmega328p
atmega328_1mhz_9600baud.build.f_cpu=1000000L
atmega328_1mhz_9600baud.build.core=arduino
atmega328_1mhz_9600baud.build.variant=standard

atmega328_1mhz_4800baud.name=Optiboot 1MHz 4800baud
atmega328_1mhz_4800baud.upload.protocol=arduino
atmega328_1mhz_4800baud.upload.maximum_size=32256
atmega328_1mhz_4800baud.upload.speed=4800
atmega328_1mhz_4800baud.bootloader.low_fuses=0xff
atmega328_1mhz_4800baud.bootloader.high_fuses=0xde
atmega328_1mhz_4800baud.bootloader.extended_fuses=0x05
atmega328_1mhz_4800baud.bootloader.path=optiboot_v50
atmega328_1mhz_4800baud.bootloader.file=atmega328_1b.hex
atmega328_1mhz_4800baud.bootloader.unlock_bits=0x3F
atmega328_1mhz_4800baud.bootloader.lock_bits=0x2F
atmega328_1mhz_4800baud.build.mcu=atmega328p
atmega328_1mhz_4800baud.build.f_cpu=1000000L
atmega328_1mhz_4800baud.build.core=arduino
atmega328_1mhz_4800baud.build.variant=standard
« Last Edit: April 16, 2013, 03:53:20 pm by tim7 » Logged

London, UK
Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Ooooo!  Lovely, thanks!

I'll give that a whirl in the morning when I can get at my ISP!

Rgds

Damon

PS. Down to ~20uA for my 1Hz control loop with 8MHz clock, so at 1MHz...  B^>
« Last Edit: April 16, 2013, 05:10:39 pm by DamonHD » Logged

Anaheim CA.
Offline Offline
Faraday Member
**
Karma: 46
Posts: 2866
...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank You tim7 for the nice job... I can use them myself for several low powered battery powered applications..
and Thank You @ DamonHD for asking the questions...

Doc
Logged

--> WA7EMS <--
“The solution of every problem is another problem.” -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

London, UK
Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Tim,

Should the extended fuse be 0x06 to allow for 1.8V BOD?

Should the low fuse be 0x42 at least to have the /8 clock prescaler selected for the 8MHz RC clock?

Rgds

Damon
Logged

London, UK
Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I have just successfully used your bootloader, thank you, with fuse modifications and other tweaks for my IDE:

Code:
atmega328_1mhz_4800baud.name=Optiboot 5 for bare 328P, 1MHz internal clock, fast start, 1.8V BOD, 4800baud upload, c/o tim7 20130416
atmega328_1mhz_4800baud.upload.protocol=arduino
atmega328_1mhz_4800baud.upload.maximum_size=32256
atmega328_1mhz_4800baud.upload.speed=4800
#atmega328_1mhz_4800baud.bootloader.low_fuses=0xff
atmega328_1mhz_4800baud.bootloader.low_fuses=0x42
atmega328_1mhz_4800baud.bootloader.high_fuses=0xde
#atmega328_1mhz_4800baud.bootloader.extended_fuses=0x05
atmega328_1mhz_4800baud.bootloader.extended_fuses=0x06
#atmega328_1mhz_4800baud.bootloader.path=optiboot_v50
atmega328_1mhz_4800baud.bootloader.path=atmega
atmega328_1mhz_4800baud.bootloader.file=atmega328_1b.hex
atmega328_1mhz_4800baud.bootloader.unlock_bits=0x3F
atmega328_1mhz_4800baud.bootloader.lock_bits=0x2F
atmega328_1mhz_4800baud.build.mcu=atmega328p
atmega328_1mhz_4800baud.build.f_cpu=1000000L
atmega328_1mhz_4800baud.build.core=arduino
atmega328_1mhz_4800baud.build.variant=standard

Rgds

Damon
Logged

London, UK
Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

And I have the system running from 2xAA NiMH as planned, drawing about 1uA for the AVR and about 2uA average for the LED being flashed.  So, it definitely seems to work!

Many thanks again!

Rgds

Damon
Logged

Switzerland
Offline Offline
Sr. Member
****
Karma: 6
Posts: 375
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for letting us know it worked.  Quite right about the fuses, I forgot they'd need alteration.  BTW Optiboot is maintained by WestfW at http://code.google.com/p/optiboot/, and he's made the code very easy to compile using the tools already included in the Arduino IDE.
« Last Edit: April 17, 2013, 10:05:04 am by tim7 » Logged

London, UK
Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Unfortunately I don't currently even have anything as basic as "make" on my ageing Mac, and my puny SheevaPlug doesn't really have space.

I *could*/should try and set up a build/dev environment in the corner of one of my chunky hosted servers, but it somehow feels evil using a big fat machine half around the world away to do my uC builds.  Still, that's the "cloud" I suppose!

Rgds

Damon
Logged

Switzerland
Offline Offline
Sr. Member
****
Karma: 6
Posts: 375
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you have the Arduino IDE running then you already have everything you need (I'm less sure about Macs, but I think this is true).  Just get the half-dozen-or-so files that make up the bootloader source code and put them in a directory in .../hardware/arduino/bootloaders/.
Logged

London, UK
Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

So, if I put the .c (etc) files in that directory, how does a hex file built against the correct preprocessor directives (such as F_CPU) happen?

Rgds

Damon
Logged

Pages: 1 [2]   Go Up
Jump to: