Pages: 1 2 [3]   Go Down
Author Topic: 168 Bootloader Error  (Read 2253 times)
0 Members and 1 Guest are viewing this topic.
Daniel
Guest
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
...Having the STK500 seems to be an advantage but I can't find the what fuses need to be set...

Try this tutorial, and this one too

D
Logged

Lexington, SC
Offline Offline
Jr. Member
**
Karma: 0
Posts: 54
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank alot the first Tutorial was very helpful.

I am having some timing issues with the 168.  is the native speed 8mhz? because it seems that it is not 16Mhz.  I am porting Atmega8 code to a 168

thanks for the help
Logged

"Who left the fridge open?"
-Tugg Speedman
(Scorcher VI - Global Meltdown)

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 9
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If you haven't set the fuses properly, the ATmega168 could be running of its internal clock: either at 1 MHz or 8 MHz.
Logged

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

Hi neuromancer,

I soldered a 20 MHz crystal on an Arduino NG and it works fine.  If you need the .hex file for a 20 MHz bootloader I can send you one or post it here.

Using AVR Studio, all you need to do is:

1.  Set the lock bits to unprotected
2.  The fuses should all be UNPROGRAMMED == 1 except:
Boot flash size = 1024 (BOOTSZ = 0)
Boot reset $0000 (BOOTRST = 0)
Brownown detection disabled (BODLVL = 111)  (unprogrammed == 1)
Clock = external 8- 14CK + 0 (CKSEL = 1111 SUT = 00) - you need to scroll right to see the CKSEL etc...

Program that, then program your bootloader .hex file.

3.  Finally, set the lock bits to 0xCF to protect the bootloader.

This works fine with my Dragon, if you are using serial ISP, I don't know.

The only hiccup I had was I needed to set my frequency to 125 KHz in the "BOARD" menu.  My cable may be too long.

Good luck!

D.
Logged

Lexington, SC
Offline Offline
Jr. Member
**
Karma: 0
Posts: 54
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


I used the fuse setting in the tutorial above.
20Mhz is not really that important to me.

Would this set the Freq to 16Mhz?
Ext. Crystal Osc.; Frequency 8.0 - MHz; Startup time PWRDWN/RESET: 16K CK/14 CK + 0ms; [CKSEL=1111 SUT=0]


It could be something to do with the Timer registers because they are named differently in the 168.  I have not investigated it fully yet.
But if the fuse settings are correct then I can rule that out as the problem.

Thanks
Logged

"Who left the fridge open?"
-Tugg Speedman
(Scorcher VI - Global Meltdown)

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

Yes, the fuse settings are the same for 16 or 20 MHz - only the boot loader is different.  Your CKSEL and SUT are the same as mine.  And yes, the fuses are quite different for ATMega 8 and 168, and there is the extended fuse on the 168.

This stuff was very confusing to me but I finally got it working.  I'm glad to help any way I can.  

Now I'm dreaming of Arduino on the 324, 644 and 128 - wouldn't that be fine?

D.
Logged

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

> I'm glad to help any way I can.  

Write it down in a way that every n00b can understand and post it on the playground.
Logged

Pages: 1 2 [3]   Go Up
Jump to: