Trouble using bootloader in Atmega168

121 views
Skip to first unread message

swbluto

unread,
Jan 31, 2010, 11:38:43 AM1/31/10
to avrub
I started working with the mini-tutorial detailed at
http://www.scienceprog.com/testing-avr-universal-bootloader-on-atmega128/
in order to use the bootloader.

I configured the configuration file for the atmega168 and diecimila
board with these settings changed to what's coded below:

[code]#define F_CPU 16000000UL // 16 mhz
#define BootStart 0x1C00 //Originally 2 * 0x1C00UL. Should
it still be that given the identical hex code?

//comport number: 0/1/2..
#define COMPORTNo 0

//enable watchdog
#define WDG_En 0
[/code]

I originally used AVR Studio to compile the whole thing, but when I
tried to upload the hex using avrdude (actually, I was using AVR-dude
GUI as detailed here: http://www.geocities.jp/arduino_diecimila/bootloader/index_en.html,
but it's just a GUI wrapper.), the upload completion bar would slowly
progress from 30 to 40 percent within 10 seconds and then it would
suddenly disappear as if it instantly completed. I was a bit
suspicious at first since it seems uploading the Diecimila bootloader
takes much longer, so I used the batch file that came with it to build
the "universal bootloader" and that one actually took a hearty amount
of time to upload and the status bar eventually completed to 100%, so
I think that one was successful.

The chip is in the arduino now and the Arduino settings are

High: DD
Low: FF
Extended: 00

According to the boot options in the tutorial at "http://
www.scienceprog.com/testing-avr-universal-bootloader-on-atmega128/", I
had to "program" the BOOTRST and BOOTSZ0 to the bit 0.


According to this site, http://electrons.psychogenic.com/modules/arms/art/14/AVRFusesHOWTOGuide.php,
it appears that these options corresponded to bit number 0 and bit
number 1 in the high FUSE so I believe I needed to change arduino's
setting from DD (1101 1101) to DC (1100 1100). I left the low fuse and
extended fuse alone. After uploading the fuse settings, I then burned
the bootloader (which took a healthy 2-5 minutes like expected and the
status bar actually went to 100%) and set the lock bit to 0F.

I then started using the program AVRUBD that apparently uploads the
application hex to the bootloader. I believe I followed the tutorial
except I changed the flash size to 16K for the Atmega168, and the com
port is "COM 4". I then pressed the "dN" button(Download?) and pressed
reset on the arduino but the connection failed. It appears that the
bootloader keeps saying "waiting for password" each time I press the
reset button, and the computer keeps sending the connect key value 64
but nothing happens. In the tutorial, it shows that it's supposed to
say "waiting for password" and then after that it's supposed to say
"waiting for data" and then it goes onto complete. Here's my log -
each time I press the reset button, it spits out the "waiting for
password" line that you can see on the right.

[code]> Start download
$ Send reset command: [7E ]
> Start connect
$ <1> Send connect key: 64
$ <2> Send connect key: 64
$ <3> Send connect key: 64
: 77 61 69 74 69 6E 67 20 66 6F 72 20 waiting for
: 70 61 73 73 77 6F 72 64 2E 0D 0A password...
$ <4> Send connect key: 64
$ <5> Send connect key: 64
$ <6> Send connect key: 64
$ <7> Send connect key: 64
: 77 61 69 74 69 waiti
: 6E 67 20 66 6F 72 20 70 61 73 73 77 ng for passw
$ <8> Send connect key: 64
$ <9> Send connect key: 64
$ <10> Send connect key: 64
X Connect fail[/code]

Ideas?

swbluto

unread,
Feb 1, 2010, 12:44:04 AM2/1/10
to avrub
So I downloaded the bootldr configuration file from Yan T C at
http://groups.google.com/group/avrub/browse_thread/thread/e71c26d6ea3acb7b?hl=en#,
and I noticed that the connect key inside was "64" instead of the 5
element connect key in the configuration file that I had (the ubd
program keeps sending out "64"), and I left the 2 x 0x1C00 as is in
the configuration file and then I changed verbose to 1 because I
wanted to see what was happening. :)

After compiling it and uploading it to the arduino, I then tried
uploading the blink.hex that comes with the arduino using the ubd
program and it worked great!

I'll have to add more settings to the configuration file as it appears
to be an older version, but it looks like it started working.


On Jan 31, 8:38 am, swbluto <swbluto4g...@yahoo.com> wrote:
>  I started working with the mini-tutorial detailed athttp://www.scienceprog.com/testing-avr-universal-bootloader-on-atmega...

> According to the boot options in the tutorial at "http://www.scienceprog.com/testing-avr-universal-bootloader-on-atmega128/", I


> had to "program" the BOOTRST and BOOTSZ0 to the bit 0.
>

> According to this site,http://electrons.psychogenic.com/modules/arms/art/14/AVRFusesHOWTOGui...,

shao ziyang

unread,
Feb 1, 2010, 6:42:01 AM2/1/10
to av...@googlegroups.com
Hello,

Avedude is not design for beginer, it is powerful, but there are too many command, and it is not easy to use at beginning. If you use AVR Studio, STK500, AVR Drogon or AVRISP is more easy to use, and speed is faster. 

The last version of avrub is v4.5, you may download it at:
http://sites.google.com/site/shaoziyang/Home (This site have been blocked in China, so I can't update it now)
or




2010/2/1 swbluto <swblut...@yahoo.com>
--
You received this message because you are subscribed to the Google Groups "avrub" group.
To post to this group, send email to av...@googlegroups.com.
To unsubscribe from this group, send email to avrub+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/avrub?hl=en.




--
Best regard

Shaoz...@gmail.com
https://sites.google.com/site/shaoziyang
Reply all
Reply to author
Forward
0 new messages