Go Down

Topic: Bootloading the Atmega168. (Read 1 time) previous topic - next topic

grimreaper

I have a arduino dumilanalov, which I'm using to re-bootload my Atmega168.

I ran the atmega board detector script by Nick Gammon, http://www.gammon.com.au/forum/?id=11637, and got the following results.
Quote
Atmega chip detector.
Entered programming mode OK.
Signature = 1E 94 06
Unrecogized signature.
LFuse = FF
HFuse = DF
EFuse = F8
Lock byte = FC
Clock calibration = 90

First 256 bytes of program memory:

0: 00 00 01 01 00 00 03 03 00 00 01 01 04 04 07 07
10: 00 00 01 01 00 00 03 03 08 08 09 09 0C 0C 0F 0F
20: 00 00 01 01 00 00 03 03 00 00 01 01 04 04 07 07
30: 10 10 11 11 10 10 13 13 18 18 19 19 1C 1C 1F 1F
40: 00 00 01 01 02 02 03 03 00 00 01 01 04 04 07 07
50: 00 00 01 01 00 00 03 03 08 08 09 09 0C 0C 0F 0F
60: 20 20 21 21 20 20 23 23 20 20 21 21 24 24 27 27
70: 30 30 31 31 30 30 33 33 38 38 39 39 3C 3C 3F 3F
80: 00 00 01 01 00 00 03 03 00 00 01 01 04 04 07 07
90: 00 00 01 01 00 00 03 03 08 08 09 09 0C 0C 0F 0F
A0: 00 00 01 01 00 00 03 03 00 00 01 01 04 04 07 07
B0: 10 10 11 11 10 10 13 13 18 18 19 19 1C 1C 1F 1F
C0: 40 40 41 41 40 40 43 43 40 40 41 41 44 44 47 47
D0: 40 40 41 41 40 40 43 43 48 48 49 49 4C 4C 4F 4F
E0: 60 60 61 61 60 60 63 63 60 60 61 61 64 64 67 67
F0: 70 70 71 71 70 70 73 73 78 78 79 79 7C 7C 7F 7F




And when i proceeded to burn my bootloader using, atmega board programmer sketch, i got the following message.

Quote
Atmega chip programmer.
Written by Nick Gammon.
Entered programming mode OK.
Signature = 0x1E 0x94 0x06
Unrecogized signature.
LFuse = 0xFF
HFuse = 0xDF
EFuse = 0xF8
Lock byte = 0xFC
Clock calibration = 0x90
Type 'C' when ready to continue with another chip ...


Is my chip dead?

DirtBiker

That looks like the right signature for a 168.  Maybe Nick can help resolve this.
Dirt Biker

retrolefty

Nick's program is looking for the following signature bytes to identify the chip as a mega168:

Code: [Select]
{ { 0x1E, 0x94, 0x0B }, "ATmega168PA", 16 * kb,       256,

So maybe there are different 'flavors' of 168 chip. You might just try and edit nick's sketch for that line and see if will then attempt to load the bootloader:

Quote
{ { 0x1E, 0x94, 0x06 }, "ATmega168PA", 16 * kb,       256,


Lefty

grimreaper

Thanks a lot retrolefty  :D THe bootloading worked....


But the chip, still wouldn't let me upload new programs. :/

retrolefty


Thanks a lot retrolefty  :D THe bootloading worked....


But the chip, still wouldn't let me upload new programs. :/


So what is your 168 based 'board', does it run the chip at the correct crystal speed? Does it support auto-reset that the IDE requires? Have you run a loopback test on your 168 based setup to see if your communication link works?

Lefty

I didn't actually test that signature but added it for someone else.

The fact that you uploaded OK shows the chip is good. I can't remember right now which bootloader I used for that chip*, but the clock speed would need to match and you would need to select the correct bootloader in the IDE so that the protocol matches.

* Looks like it is optiboot_atmega168.hex
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

westfw

Did you modify the boards.txt file and select the appropriate board type so that the IDE knows about the new connection speed used for uploads (and also the new space available?)

The ATmega168PA vs ATmega168 is like the 328P vs 328; the chips are very close to identical, but have different signatures.  (The difference is that Arduino supports the 168 and 328P without effort, while the 168PA and 328 require hacking.)  The 168 and 168PA can use the same bootloader, and once that happens the Arduino IDE will treat the chips exactly the same.

Nick's program (and Optiloader) are especially useful for putting bootloaders into these "odd signature" chips, because they have their own idea about the translation of signature to "matching" bootloader code.

grimreaper

Quote
So what is your 168 based 'board', does it run the chip at the correct crystal speed? Does it support auto-reset that the IDE requires? Have you run a loopback test on your 168 based setup to see if your communication link works?


I actually have a duemilanove clone board, which i used to program both my atmega328P( selecting the 'arduino duemilanove w/ atmega328' board), and my Atmega168 (selecting the 'arduino diecimila or duemilanove w/ Atmega168). Both had bootloaders. And i haven't done the loopback test. Will it confirm if my chip is dead or working?
Some time back, my 168 stopped working( always failed while programming it). After i read Nick Gammon's page, i thought i'd try re-uploading the bootloader.

Quote
The fact that you uploaded OK shows the chip is good. I can't remember right now which bootloader I used for that chip*, but the clock speed would need to match and you would need to select the correct bootloader in the IDE so that the protocol matches.


Thanks for your reply. I actually burned the bootloader after making the changes Retrolefty told in the above comments. I'm sorry i didn't really get, what you meant by select the correct bootloader in the IDE?

Quote
Did you modify the boards.txt file and select the appropriate board type so that the IDE knows about the new connection speed used for uploads (and also the new space available?)


Thanks for you reply. I haven't modified the file. What board should i be selecting?

westfw

Quote
What board should i be selecting?

You need to either modify the Duemilanove w 168 entry (in which case you won't be able to program regular duemilanoves any more), or add a new entry:

Code: [Select]
uno168.name=Arduino Uno168 - Any Arduino with ATmega168 CPU and Optiboot bootloader
uno168.upload.protocol=arduino
uno168.upload.maximum_size=15872
uno168.upload.speed=115200
uno168.bootloader.low_fuses=0xff
uno168.bootloader.high_fuses=0xde
uno168.bootloader.extended_fuses=0x05
uno168.bootloader.path=optiboot
uno168.bootloader.file=optiboot_atmega168.hex
uno168.bootloader.unlock_bits=0x3F
uno168.bootloader.lock_bits=0x0F
uno168.build.mcu=atmega168
uno168.build.f_cpu=16000000L
uno168.build.core=arduino
uno168.build.variant=standard



I'm sorry i didn't really get, what you meant by select the correct bootloader in the IDE?


There are various uploading protocols, and also baud rates for uploading. When you select a board in the IDE it uses the relevant section of the boards.txt file to choose a protocol and baud rate. If you choose the wrong one, the wrong protocol/baud rate will be used and you will get some sort of error.

You don't literally have to have the selected board, but the chip being programmed has to:


  • Have the bootloader that the board is "configured" for (eg. 32 Kb Optiboot)

  • Be running at the clock speed that makes the baud rate correct



For example, I program a Duemilanove with "Uno" selected as the board type, because I uploaded the Uno "Optiboot" bootloader. What is written on the board doesn't count, it is the factors above. I also select Uno with "bare bones" (breadboard) chips once I put the Optiboot bootloader on them.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

grimreaper

Sorry for the late reply...

As Westfw, told, i added the entry to my boards.txt, but it isn't appearing in the boards menu in the IDE o.O. I'm attaching the boards.txt.

westfw

Did you restart the IDE?  It only reads boards.txt at startup.

grimreaper

Quote
Did you restart the IDE?  It only reads boards.txt at startup.


Yes. I did try restarting the IDE, it isn't coming in the menu.Is there anything wrong with my entry into the boards.txt?


boards.txt (13.02 KB - downloaded 32 times.)


I get:

Code: [Select]

Error 503 Service Unavailable

Service Unavailable

Guru Meditation:

XID: 1077305799

Varnish cache server


However I can read other posts.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

grimreaper

#14
Jan 12, 2013, 09:37 am Last Edit: Jan 12, 2013, 09:55 am by grimreaper Reason: 1


Quote

I get:

Code:
Error 503 Service Unavailable

Service Unavailable

Guru Meditation:

XID: 1077305799

Varnish cache server


Sorry about that..I've added a screenshot, if that doesn't help could you pm me your id. I'll mail it to you. There seems to be some problem while opening the boards.txt attachment. Not quite sure, why.

Go Up