Pages: [1]   Go Down
Author Topic: Flashing Atmega168 with uisp and dapa failed.  (Read 1290 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

I started a new thread, because my problem is a different one than before. (I gave up on the AVR-ISP arduino programmer.)

Yesterday I built a parallel programmer cable and wired it up to a USB-Arduino and flashed it with the Atmega8 bootloader. Everything worked perfectly and I was able upload programs with the arduino 0007er afterwards.

Then I tried the same for the atmega168 on the mini. I wired up everything (using the atmega168 datasheet) and flashed the 168er bootloader into the chip (see below) - and as you can see below I got several error-messages. (*argh*)
So I tried to burn again, and I got the same errors at the same addresses.

The good news is that the old program is gone. The bad news is that I cannot upload anything to the board using 0007, because I get the message that the programmer is not responding.

Now my question: Shall I throw the chip away? Are parts of the flash-memory broken?

Thank you for helping a newbie.

lg, Mr.M

-----------
-----------

C:\Documents and Settings\mahrm\Desktop\arduino-0007\bootloader168>burn

C:\Documents and Settings\mahrm\Desktop\arduino-0007\bootloader168>REM unlock bo
otloader segment

C:\Documents and Settings\mahrm\Desktop\arduino-0007\bootloader168>cd ..

C:\Documents and Settings\mahrm\Desktop\arduino-0007>tools\avr\bin\uisp -dprog=d
apa -dlpt=0x378 -dpart=ATmega168 --wr_lock=0x3F
Atmel AVR ATmega168 is found.
Writing lock bits ...
Reinitializing device
Atmel AVR ATmega168 is found.
Warning: lock bits write=0x3F read=0xCF

Lock Bits set to 0x3f

C:\Documents and Settings\mahrm\Desktop\arduino-0007>REM set fuses

C:\Documents and Settings\mahrm\Desktop\arduino-0007>REM bootloader size of 512
words; from 0xE00-0xFFF

C:\Documents and Settings\mahrm\Desktop\arduino-0007>REM clock speed of 16 MHz,
external quartz

C:\Documents and Settings\mahrm\Desktop\arduino-0007>tools\avr\bin\uisp -dprog=d
apa -dlpt=0x378 -dpart=ATmega168 --wr_fuse_h=0xDF --wr_fuse_l=0xC7 --wr_fuse_e=0
xF8
Atmel AVR ATmega168 is found.

Fuse Low Byte set to 0xc7

Fuse High Byte set to 0xdf

Fuse Extended Byte set to 0xf8

C:\Documents and Settings\mahrm\Desktop\arduino-0007>REM upload bootloader

C:\Documents and Settings\mahrm\Desktop\arduino-0007>tools\avr\bin\uisp -dprog=d
apa -dlpt=0x378 -dpart=ATmega168 --upload --verify if=bootloader168\ATMegaBOOT_1
68.hex -v
AVR Direct Parallel Access succeeded after 0 retries.
Atmel AVR ATmega168 is found.
Uploading: flash
##################################################
(total 1580 bytes transferred in 0.92 s (1716 bytes/s)
Polling: count = 13, min/avg/max = 0.00/3.69/16.00 ms
Verifying: flash
#####flash error at address 0x3880: file=0x05, mem=0x00
flash error at address 0x3881: file=0x90, mem=0x80
####flash error at address 0x3900: file=0xc0, mem=0x80
flash error at address 0x3902: file=0x87, mem=0x80
####flash error at address 0x3980: file=0xa4, mem=0x04
flash error at address 0x3981: file=0x1c, mem=0x14
####flash error at address 0x3a04: file=0x82, mem=0x80
####flash error at address 0x3a80: file=0x0e, mem=0x0c
flash error at address 0x3a81: file=0x94, mem=0x84
flash error at address 0x3a84: file=0x86, mem=0x84
####flash error at address 0x3b01: file=0x93, mem=0x13
####flash error at address 0x3b80: file=0x1f, mem=0x0f
####flash error at address 0x3c00: file=0xf9, mem=0x19
flash error at address 0x3c01: file=0x99, mem=0x80
flash error at address 0x3c04: file=0xf2, mem=0x12
####flash error at address 0x3c80: file=0x81, mem=0x01
####flash error at address 0x3d04: file=0xe8, mem=0x00
####flash error at address 0x3d80: file=0x0e, mem=0x04
flash error at address 0x3d81: file=0x94, mem=0x90
####flash error at address 0x3e00: file=0x3c, mem=0x08
flash error at address 0x3e01: file=0xf0, mem=0x30
#
(total 1580 bytes transferred in 0.86 s (1837 bytes/s)

C:\Documents and Settings\mahrm\Desktop\arduino-0007>REM lock bootloader segment


C:\Documents and Settings\mahrm\Desktop\arduino-0007>tools\avr\bin\uisp -dprog=d
apa -dlpt=0x378 -dpart=ATmega168 --wr_lock=0xCF
Atmel AVR ATmega168 is found.
Writing lock bits ...
Reinitializing device
Atmel AVR ATmega168 is found.

Lock Bits set to 0xcf

C:\Documents and Settings\mahrm\Desktop\arduino-0007>cd bootloader168
Logged

FR
Offline Offline
Full Member
***
Karma: 0
Posts: 105
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

There was a bug in the dapa defintion for the atmega168 (extended fuse not supported => disable bootloader) in uisp.
I send a patch on the uisp forum http://savannah.nongnu.org/file/uisp-20050207-m168-stk500-extendedFuseSupport.patch?file_id=11573

So you will have to recompile (or I can send you a compiled version for windows).

Anyway, try to burn a "hello world" sketch (blink led) with the dapa and the buggy uisp version you have, this will work (because you do not use the bootloader this way).

Nicolas
Logged

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

Also, apparently Windows sometimes polls the parallel port, which interrupts the process.  See this thread: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1142106610 for more information a registry patch to fix the problem.
Logged

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

Thank you very much for your replies.
(I do not yet know what a fuse on a microcontroller is, but I will find out some time smiley  )

@ mellis: The parallel port isn't the problem. I searched the forum before flashing, found out about this windows "feature" and fixed it.

@ nrolland: Yes, please send me a compiled version for Windows. This would help me a lot.

I will try to burn the led blink hex directly onto the chip in the meantime.

lg, Mr.M
Logged

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

Hi again,

Success! - more or less.

Well, the led-blink did not upload either - not with the old UISP.exe and not with the new UISP.exe nrolland sent me.

So I did what I should have done looong before: use Linux for sophisticated tasks.

I connected the mini-arduino to the parallel-port, modified the batch-file to run unter Linux, created a parport special device (ubuntu), pressed the enter key and the bootloader was successfully uploaded. Uploading sketches via 0007 works again!

--

I don't know why it didn't work on Windows...

* have Windows XP SP2 running on a Fujitsu-Siemens Scenic
* Parallel Port is set to "ECP" in the bios
* giveio installed properly
* pached the registry (and _tripple_ checked it to be correct) (and rebooted)
* tried UISP from 0007 and the one nrolland sent me

still it didn't work...


The commands I used to flash on Linux were:

../tools/uisp -dprog=dapa -dlpt=/dev/parport0 -dpart=ATmega168 --wr_lock=0x3F

../tools/uisp -dprog=dapa -dlpt=/dev/parport0 -dpart=ATmega168 --wr_fuse_h=0xDF --wr_fuse_l=0xC7 --wr_fuse_e=0xF8

../tools/uisp -dprog=dapa -dlpt=/dev/parport0 -dpart=ATmega168 --erase --upload --verify if=ATmegaBOOT_168.hex -v

../tools/uisp -dprog=dapa -dlpt=/dev/parport0 -dpart=ATmega168 --wr_lock=0xCF

thank you very much for your help. If you want me to try something out on my Windows OS, just tell my.
And thank you, mbanzi for writing the burn.command script.

lg, Mr.M
Logged

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

Hi,

I ran into the same troubles like mr.m. It seems like I can not burn the mega168 bootloader on Windows.
I also got the error messages. Burning mega8 works fine.

Could somebody upload the windows binary of the bugfixed (thanks to nrolland) binary file or tell me where to download it? This would be cool!

Best,
macbastian
Logged

Daniel
Guest
 Bigger Bigger  Smaller Smaller  Reset Reset

hey

while it is not open-source, AVR Studio 4 and the AVRISP do a good job of burning the booloader on Atmega8's and 168's. This is what Gianluca, the manufacturer of the Arduino uses to burn the retail version.  I was having problems with a mishmash of some of the methods described above,  until I just ordered an AVR-ISP mkII from digikey for about $40.. now it is a snap. Just my 2¢...

Here's a tutorial outlining the above process...

D
Logged

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

Hi,

FYI:
I found http://www.arduino.cc/playground/uploads/Linux/uisp-20050207-m168.zip
It seems to have the extended flags bugfix implemented. But it's for Linux.

If anybody knows a location where I can find a build for windows, please let me know!

Thanks!
Logged

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

Success!

I got flash errors while burning the m168 (not the m8! smiley).
First I replaced the uisp binary with a binary that has the extended flag bugfix. But nothing changed.

Then I removed the LED connected to pin 19 and succeeded!

(It is useful to set parameter -v to see the real error. It was an error while accessing the parallelport.)

Best,
Sebastian
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 25
Arduino HN -EV
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

OK bingo is done, first what I do was build the parallel programmer the one from Aduino page>>http://www.arduino.cc/en/Hacking/ParallelProgrammer, next y flash and bootload a virgin atmega8 and all was fine, later y try to burn the bootloader to Atmega168 and got some troubles first get the bootloader hex file, got this one>>http://rob.faludi.com/itp/arduino/bootloader168.zip, I made some changes and works for me, don't forget to connect the Arduino to computer USB this provide the necessary voltage to burn both the Atmega8 and Atmega168, whit out this you will get the flash errors. Hope this help.

PS

Sorry for my English.

This are the changes for the burn.bat file:

#!/bin/sh
@REM parametre >>-dprog stk500 -dserial=$PORT << default

cd ..

tools\avr\bin\uisp -dpart=ATmega168 -dprog=dapa -dlpt=0x378 --wr_lock=0x3F
tools\avr\bin\uisp -dpart=ATmega168 -dprog=dapa -dlpt=0x378 --wr_fuse_h=0xDF --wr_fuse_l=0xC7 --wr_fuse_e=0xF8
tools\avr\bin\uisp -dpart=ATmega168 -dprog=dapa -dlpt=0x378 --erase --upload if=bootloader\ATMegaBOOT_168.hex -v
tools\avr\bin\uisp -dpart=ATmega168 -dprog=dapa -dlpt=0x378 --wr_lock=0xCF

pause


The pause is for check erros because the bat file close the window once this ends.

PosPS

dont forget unzip the bootloader168.zip file to bootloader folder of the arduino007 folder program.
Logged


0
Offline Offline
Full Member
***
Karma: 1
Posts: 223
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks macbastian!

That seems to have worked for me too. Took me 3 hours, nothing worked until I saw you post! I would never have thought of that!

-Z-


Logged

Pages: [1]   Go Up
Jump to: