Pages: [1] 2   Go Down
Author Topic: Optiboot for Atmega8 needed.  (Read 5764 times)
0 Members and 1 Guest are viewing this topic.
Gatineau, Qu
Offline Offline
Jr. Member
**
Karma: 1
Posts: 94
Did you Arduino today?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I need help getting the optiboot_ATmega8.hex file.
I've downloaded the latest optiboot v3 zip file ....installed everything......open Arduino IDE ...... I see a lot of OPTIBOOT boards but no Atmega8?
I guess I need to do something? The optiboot site says it's supported.

Did some research and found some files needed updating. Did that.
Now I see an entry with optiboot atmega8 in the IDE but get an error message that the optiboot_atmega8.hex dose not exist?
Did more research.....I think I need to MAKE it.
Tried to make it and I keep getting errors. I'm on WinXP SP3.

I'm not a programmer so I'm kinda lost  smiley-red

Can someone make me a optiboot_atmega8.hex please.
Do I also need a .LST file?

And is that all I'm missing to have a atmega8 optiboot?

Thanks again!
« Last Edit: February 20, 2011, 01:19:59 am by alparent » Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 135
Posts: 6763
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
And is that all I'm missing to have a atmega8 optiboot?
No, you also need to know the correct fuses for mega8:  HFUSE = CC, LFUSE = BF

optiboot_atmega8.hex:

Code:
:101E00008FE594E09EBF8DBF112484B714BE81FF7F
:101E1000C7D085E08EBD82E08BB988E18AB986E8BB
:101E200080BD80E189B98EE0B7D0BD9A96E020E30D
:101E30003CEF54E040E23DBD2CBD58BF08B602FE69
:101E4000FDCF88B3842788BBA8959150A1F799242A
:101E50009394A5E0AA2EF1E1BF2E99D0813421F40C
:101E600081E0A9D083E01FC0823411F484E103C073
:101E7000853419F485E09FD083C0853579F487D007
:101E8000E82EFF2484D0082F10E0102F00270E2901
:101E90001F29000F111F89D0680172C0863529F4EF
:101EA00084E089D080E06FD06BC0843609F042C0F6
:101EB0006ED06DD0082F6BD080E0C81688E1D806B0
:101EC00020F483E0F60187BFE895C0E0D1E05FD061
:101ED00089930C17E1F7F0E0CF16F8E1DF0620F068
:101EE00083E0F60187BFE89560D007B600FCFDCF20
:101EF000A601A0E0B1E02C9130E011968C911197F1
:101F000090E0982F8827822B932B1296FA010C01D0
:101F100097BEE89511244E5F5F4FF1E0A034BF07F4
:101F200051F7F601A7BEE89507B600FCFDCFB7BE96
:101F3000E89526C08437B1F42AD029D0F82E27D0CE
:101F400034D0F601EF2C8F010F5F1F4F84911BD00F
:101F5000EA94F801C1F70894C11CD11CFA94CF0C83
:101F6000D11C0EC0853739F420D08EE10CD083E926
:101F70000AD087E098CF813511F488E00DD015D0D4
:101F800080E101D06ACF5D9BFECF8CB90895A89502
:101F90005F9BFECF8CB1089598E191BD81BD0895FE
:101FA00080E0FADFEE27FF270994F1DF803209F0A5
:101FB000F7DF84E1E8CF1F93182FE9DF1150E9F72D
:061FC000F4DF1F910895FB
:0400000300001E00DB
:00000001FF

(added 2/20)
Once you have the optiboot loaded on your mega8, don't forget that you'll need to edit boards.txt so that the arduino IDE knows how to talk to it (speed and max sketch size are different than the normal bootloader.)
Code:
##############################################################

opti8.name=Arduino Optiboot8
opti8.upload.protocol=stk500
opti8.upload.maximum_size=7680
opti8.upload.speed=115200
opti8.bootloader.low_fuses=0xbf
opti8.bootloader.high_fuses=0xdc
opti8.bootloader.path=optiboot
opti8.bootloader.file=optiboot_mega8.hex
opti8.bootloader.unlock_bits=0x3F
opti8.bootloader.lock_bits=0x0F
opti8.build.mcu=atmega8
opti8.build.f_cpu=16000000L
opti8.build.core=arduino
« Last Edit: February 20, 2011, 10:03:39 pm by westfw » Logged

Gatineau, Qu
Offline Offline
Jr. Member
**
Karma: 1
Posts: 94
Did you Arduino today?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank a lot for that code.

Can you explain how you created that file? Just to educate me.
Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 135
Posts: 6763
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It will depend on how much of a SW development environment you already have installed on your computer, and the type of computer.  On my Mac, I already have the Mac developer tools installed, so I have utilities like "make" already available, which makes things easier.  It OUGHT to be possible to build optiboot using only the files installed as part of the Arduino install (which includes make, the compiler, and a bunch of other tools, buried in that 100M+ of install), but that is (paradoxically?) more difficult...

In general:
1) Download the latest optiboot source from the mercurial repository (oh, you'll need mercurial as well!)  Note that this is well past the latest .zip file (for example, it includes the atmega8 modifications.)
2) patch optiboot.c as needed or desired for assorted problems (see the google code "issue" list.)
3) patch the optiboot makefile to point most of the tools (compiler, avrdude) at the versions in the arduino distribution.
4) in a shell window, do "make atmega8"
Logged

Gatineau, Qu
Offline Offline
Jr. Member
**
Karma: 1
Posts: 94
Did you Arduino today?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK thanks for the info.

I've uploaded the optiboot to my atmega8 with no issues.
But when I try to upload a sketch I get the following errors:

avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

???

FYI the atmega8  is on a breadboard with a 16mhz resonator.

I did the same this I did when the atmaga8 had the standard bootloader (non-optiboot) and that worked fine.

Now with the optiboot on the atmega8 I get those errors......the sketch I'm trying to load is blink (if that make any diffferance?)

Thanks again for your time and help.
Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 135
Posts: 6763
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Did you change the "boards.txt" file to include a "board" for the mega8 running optiboot?
The upload speed is different from  the normal mega8 boards (the the max sketch size changes.)
I have:
Code:
##############################################################

opti8.name=Arduino Optiboot8
opti8.upload.protocol=stk500
opti8.upload.maximum_size=7680
opti8.upload.speed=115200
opti8.bootloader.low_fuses=0xbf
opti8.bootloader.high_fuses=0xdc
opti8.bootloader.path=optiboot
opti8.bootloader.file=optiboot_mega8.hex
opti8.bootloader.unlock_bits=0x3F
opti8.bootloader.lock_bits=0x0F
opti8.build.mcu=atmega8
opti8.build.f_cpu=16000000L
opti8.build.core=arduino
(going back and editing my original reply to include this info.)
Logged

Gatineau, Qu
Offline Offline
Jr. Member
**
Karma: 1
Posts: 94
Did you Arduino today?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes I did.

I'm using an ATMEGA8-16AU 32pin SMD. If that make any difference. (For the fuses or something?)
Also using this setup: "Uploading Using an Arduino Board" section of this page http://arduino.cc/en/Tutorial/ArduinoToBreadboard

Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 135
Posts: 6763
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well,  I re-confirmed that it seems to work here, putting the mega8 into a duemilanove board.
I am having a hell of a time trying to get it to work in my SSS Arduino (with manual reset), however.
I'm going to check the timeouts and see if they are specified differently on mega8 vs mega328...
Logged

Gatineau, Qu
Offline Offline
Jr. Member
**
Karma: 1
Posts: 94
Did you Arduino today?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I see on another post that you add issues with atmega8 and resonators...I'm using a resonator.
Also do I need that .lst file?
Logged

Gatineau, Qu
Offline Offline
Jr. Member
**
Karma: 1
Posts: 94
Did you Arduino today?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

IT WORKS!!!!

The problem was with the reset.

First I followed this example "Uploading Using an Arduino Board" section of this page http://arduino.cc/en/Tutorial/ArduinoToBreadboard
But after reading this http://www.instructables.com/id/Arduino-on-all-sorts-of-Atmels/step4/Program-MCUs-with-bootloader/
I tried it and added a wire between pin 1 of the onboard socket (wich has the MCU removed) and the reset pin of my atmega8 and it worked!
Logged

Gatineau, Qu
Offline Offline
Jr. Member
**
Karma: 1
Posts: 94
Did you Arduino today?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks a million westfw.

I just programmed 4 32 pins atmega8 with blink to test them out and work just perfect.
Optiboot works great and it's fast!
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Would it be possible to have a atmega8 optiboot compiled for 8MHz? 
Logged

Gatineau, Qu
Offline Offline
Jr. Member
**
Karma: 1
Posts: 94
Did you Arduino today?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

BUMP  smiley-confuse

I don't like to bump stuff......but I would also really like to have this!

a atmega8 optiboot compiled for 8MHz
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 208
Posts: 12939
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

While I lack the experience to help you directly I can tell you that everything you need to build a bootloader is already on your computer.
Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 135
Posts: 6763
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I can tell you that everything you need to build a bootloader is already on your computer.
The version of optiboot distributed with Arduino does not yet include support for atmega8.

Here's hex code for an 8MHz atmega8.  Not tested this time; YMMV, and watch your fuse settings...
I'm calling this version 4.2 (calling the latest Arduino version, 4.0 being the source from mercurial, and .2 being two sets of significant edits by me.)  If you look closely you'll see the number 0402 at the end of flash space.

Code:
:10000000112484B714BE81FFD3D085E08093810092
:1000100082E08093C00088E18093C10086E08093F5
:10002000C20080E18093C4008EE0BCD0259A86E0B7
:1000300020E33CEF91E0309385002093840096BB51
:10004000B09BFECF1D9AA8958150A9F7992493944F
:10005000A5E0AA2EF1E1BF2E9DD0813421F481E0EC
:10006000B2D083E01FC0823411F484E103C0853430
:1000700019F485E0A8D083C0853579F48BD0E82EBB
:10008000FF2488D0082F10E0102F00270E291F29E9
:10009000000F111F92D0680172C0863529F484E0E8
:1000A00092D080E06FD06BC0843609F042C072D02D
:1000B00071D0082F6FD080E0C81688E3D80620F4EE
:1000C00083E0F60187BFE895C0E0D1E063D0899373
:1000D0000C17E1F7F0E0CF16F8E3DF0620F083E03D
:1000E000F60187BFE89569D007B600FCFDCFA601F1
:1000F000A0E0B1E02C9130E011968C91119790E046
:10010000982F8827822B932B1296FA010C0197BE09
:10011000E89511244E5F5F4FF1E0A038BF0751F71B
:10012000F601A7BEE89507B600FCFDCFB7BEE8957F
:1001300026C08437B1F42ED02DD0F82E2BD03DD050
:10014000F601EF2C8F010F5F1F4F84911BD0EA94B3
:10015000F801C1F70894C11CD11CFA94CF0CD11C32
:100160000EC0853739F429D08EE10CD084E90AD04D
:1001700086E098CF813511F488E014D01ED080E15C
:1001800001D06ACF982F8091C00085FFFCCF90935B
:10019000C6000895A8958091C00087FFFCCF80918C
:1001A000C6000895E0E6F0E098E19083808308952A
:1001B00080E0F8DFEE27FF270994ECDF803209F0BA
:1001C000F7DF84E1DFCF1F93182FE4DF1150E9F749
:0601D000F4DF1F91089509
:021FFE000204DB
:00000001FF
Logged

Pages: [1] 2   Go Up
Jump to: