Pages: [1] 2   Go Down
Author Topic: Bootloading the Atmega168.  (Read 1649 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 66
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

 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?
Logged

Windy City
Offline Offline
Jr. Member
**
Karma: 0
Posts: 90
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Dirt Biker

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17294
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Code:
{ { 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
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 66
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks a lot retrolefty  smiley-grin THe bootloading worked....


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

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17294
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks a lot retrolefty  smiley-grin 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
Logged

Global Moderator
Online Online
Brattain Member
*****
Karma: 485
Posts: 18810
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged


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

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.
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 66
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

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

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:
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
Logged

Global Moderator
Online Online
Brattain Member
*****
Karma: 485
Posts: 18810
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged


Offline Offline
Jr. Member
**
Karma: 0
Posts: 66
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

* boards.txt (13.02 KB - downloaded 55 times.)
Logged

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

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

Offline Offline
Jr. Member
**
Karma: 0
Posts: 66
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Global Moderator
Online Online
Brattain Member
*****
Karma: 485
Posts: 18810
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

I get:

Code:
Error 503 Service Unavailable

Service Unavailable

Guru Meditation:

XID: 1077305799

Varnish cache server

However I can read other posts.
Logged


Offline Offline
Jr. Member
**
Karma: 0
Posts: 66
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset



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.


* boards screenshot.png (423.53 KB, 1920x1080 - viewed 28 times.)
« Last Edit: January 12, 2013, 03:55:26 am by grimreaper » Logged

Pages: [1] 2   Go Up
Jump to: