Can't program firmware

Hello!

I have very big problem, I can't programm boot code using uisp! I have tried many things, changed seetings in BIOS, installed giveio, tryed diffrent sch for ISP like http://www.ncfreak.com/cecilia/elec/usbavrw/sch/dapa.pdf
and Arduino Starter Kit kaufen [verschiedene Ausführungen]
tryed in linux nothing works. For programming i use this batch

cd ..
tools\avr\bin\uisp -dpart=ATmega8 -dprog=dapa -dlpt=0x378 --download of=log.txt
tools\avr\bin\uisp -dpart=ATmega8 -dprog=dapa -dlpt=0x378 --wr_lock=0xFF
tools\avr\bin\uisp -dpart=ATmega8 -dprog=dapa -dlpt=0x378 --wr_fuse_l=0xdf --wr_fuse_h=0xca
pause
tools\avr\bin\uisp -dpart=ATmega8 -dprog=dapa -dlpt=0x378 --erase
pause
tools\avr\bin\uisp -dpart=ATmega8 -dprog=dapa -dlpt=0x378 --upload if=bootloader\ATMegaBOOT.hex
pause
tools\avr\bin\uisp -dpart=ATmega8 -dprog=dapa -dlpt=0x378 --verify if=bootloader\ATMegaBOOT.hex
pause
tools\avr\bin\uisp -dpart=ATmega8 -dprog=dapa -dlpt=0x378 --wr_lock=0xCF
cd bootloader
pause

and this is what I get out

20:18:03,10 - XPize

E:\arduino\arduino-0003\bootloade

E:\arduino\arduino-0003|> tools\a
x378 --download of=log.txt
Atmel AVR ATmega8 is found.
Downloading: flash

S0080000666C617368E9
S1130000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC
S1130010FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEC
S1130020FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDC
S1130030FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCC
S1130040FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBC
..... and so on
S5030200FA
S9030000FC

E:\arduino\arduino-0003|> tools\a
x378 --wr_lock=0xFF
Atmel AVR ATmega8 is found.
Writing lock bits ...
Reinitializing device
Atmel AVR ATmega8 is found.

Lock Bits set to 0xff

E:\arduino\arduino-0003|> tools\a
x378 --wr_fuse_l=0xdf --wr_fuse_h=
Atmel AVR ATmega8 is found.

Fuse Low Byte set to 0xdf

Fuse High Byte set to 0xca

E:\arduino\arduino-0003|> pause

E:\arduino\arduino-0003|> tools\avr\bin\uisp -dpart=ATmega8 -dprog=dapa -dlpt=0
x378 --erase
Atmel AVR ATmega8 is found.
Erasing device ...
Reinitializing device
Atmel AVR ATmega8 is found.

E:\arduino\arduino-0003|> tools
x378 --upload if=bootloader\ATMeg
Atmel AVR ATmega8 is found.
Uploading: flash

E:\arduino\arduino-0003|> pause

flash error at address 0x1ece: file=0x10, mem=0xff
flash error at address 0x1ecf: file=0x32, mem=0xff
flash error at address 0x1ed0: file=0x58, mem=0xff
flash error at address 0x1ed1: file=0xf0, mem=0xff
... and so on

E:\arduino\arduino-0003|> pause

E:\arduino\arduino-0003|> tools\avr\bin\uisp -dpart=ATmega8 -dprog=dapa -dlpt=0
x378 --wr_lock=0xCF
Atmel AVR ATmega8 is found.
Writing lock bits ...
Reinitializing device
Atmel AVR ATmega8 is found.
Warning: lock bits write=0xCF read=0xFF

Lock Bits set to 0xcf

E:\arduino\arduino-0003|> cd bootloader

E:\arduino\arduino-0003\bootloader|> pause

I'am using Serial version of Arduino board v2.0s. I have discoverd that when i connect isp header on lpt port but no power to the board the power led slightly lights and led betwen output 13 and gnd is blinking while programming!

PLEASE HELP!

Anyone?

Use avrdude! AVR Downloader/UploaDEr - Summary [Savannah]
At first I tried uisp, too. It allways pretended to find the hardware, when it actually wasn't! I think I turned on the debug/verbose messages to notice that...

When you have avrdude installed, you just need to execude the following 2 lines:
avrdude -c dapa -p m8 -P LPT1 -U hfuse:w:0xca:m -U lfuse:w:0xdf:m
avrdude -c dapa -p m8 -P LPT1 -U flash:w:ATMegaBOOT.hex

That are the settings for standard 16Mhz board clock and the simple parallel programmer from ardunio webpage, called "dapa" in avrdude since version 5. I you want to use the older binary version for windows, I can give you the additional settings for the avrdude config file.

One other thing, I had to do on Windows XP (my mac has no LPT :), was to disable the "LPT autocheck" windows "feature". There's a registry file (.reg, use google) which simply disables regular polling of the printer ports, what would interrupt and brake up the programming event!
This problem really drove me nuts! Stupid, f***ing M$ :wink: - who needs LPT autocheck every some seconds?
Maybe that's the reason why uisp didn't work for me, but I didn't verify it, I just went with avrdude and I'm happy.
This is something important for the FAQ and bootloader instructions, I think! Are any arduino developers listening?

While we're at it: Why is no avrdude instead of uisp in the arduino package? Avrdude is much more actively developed and mature than uisp. And there are actually rumors, that the uisp developer recommends avrdude over uisp himself...

Oli

Hey, we're listening.

There's no great reason why Arduino currently uses uisp instead of avrdude. That's what we got working first, we haven't had any complaints about it (until now), and we've been too busy fixing other more important things to worry about it.

We may look at switching to avrdude soon. It definitely has some advantages (e.g. supporting stk500-2). The use of a configuration file instead of command line options makes it a little more difficult to invoke from another program, however.

I'm going to try to incorporate a menu item for burning the bootloader into the IDE. Maybe I'll use that as a chance to try out avrdude.

well, I only had to edit the config file because I had to add a certain programmer type. (I think that it's actually a big pro for avrdude, that you can do that so easily...)
the flashing parameters itself are assignable on commandline, just like with uisp! see my commands above.

I didn't look at arduinos internal IDE structure so far, So, if you aren't allready using this approach, you could invoke the whole flashing process via a makefile. Thus one could change the actuall flash procedure inside there. (I think only advanced users would want to do that anyways)

One more thing: :wink:
I would be very happy, if the arduino IDE could be used as all full avr-gcc IDE, too.
For example, I tried to compile the ATmegaBOOT.c bootloader source inside arduino IDE and it didn't work. (it complained about the "union" statement beeing unknown etc..) I've a board with a different clock, so I had to do this. I ended up instaling the whole avr-gcc and avr-binutils by hand, which was anoying (under mac OS X) - just to compile a new bootloader.

I really like arduinos approach of doing things simple (setup(), loop() etc.), but as avr-gcc is behind it, I think it would be a big benefit to offer the wohle power inside the smart arduino IDE.
Maybe someone could document the way arduino/wiring works. So far I think of it like a wrapper for avr-gcc, but I'd like to have more insight or some tips where to look at and start to understand the backend. (e.g. im still wondering how I could add a real library)

Ciao,
Oli

First, thanks for the good feedback. It's good to get opinions from people who are pushing the limits of what the Arduino software can do, as it encourages us to get more features working.

We originally, in fact, controlled the upload process with an external makefile, but it had a lot of problems. Some versions of Windows required forward slashes as the path separator, some required double backslashes. We had issues with the working directory of the make command. We had difficulty getting error messages back from the commands launched by the makefile. Etc, etc.

In any case, we're trying to offer as much flexibility as possible in the compilation and upload processes through the use of the preferences.txt file.

Being able to use Arduino with the full power of C is also a good goal. Currently, you can use extra C files by creating extra tabs in a sketch and naming them with a C extension. They should be able to use the full range of C syntax (including union, etc). There's currently no way to prevent linking of the Arduino core, though, but it's a good idea.

In the future we're going to try to support multiple platforms, configurations, etc. It would be a good time to make sure that standalone C programs work too. You're right, it would be really nice to compile and burn the bootloader from within the IDE.

In summary, we're working on it.

As to how the backend works, right now Arduino will compile and link everything in the ARDUINO/lib/targets/arduino directory with each of your sketches. Each sketch gets the WProgram.h file included automatically, so you can add additional #include's there.

There are a bunch of options in the preferences.txt file (see the FAQ for directions on finding the preferences.txt file) for controlling the compilation and upload process. For example, you can set your clock speed, mcu, upload rate, whether or not to erase before uploading, etc.

many thanks for the insights!

I allready visited preferences.txt to set the clock speed of my board :slight_smile: I'm currently using this board: Microcontroller Modules, Boards, Tools and Accessories for Atmel AVR ATmega Xmega Processors.
But it's so tiny and well done that I will post a whole thread about it :slight_smile:
Somehow I didn't really notice build.mcu=atmega8. That's great! I mean, can we allready just use other AVRs? Well, I guess, only if one won't use timers etc. I will check this with my atmega128 board as soon as I get it back from a friend.

Just the next feaure request: To use different boards with different hardware side by side, it would be required to store hardware preferences like the board clock etc. in the sketch file itself...

I mailed massimo some weeks ago about helping with developing, as he called for it on the webpage. I'm still interested in taking part of arduino development.
I noticed F_CPU is not really beeing used everywhere (delaymicrseconds() etc.). I'll focus on getting arduino clock indepent for a start, as I need it anyways (I'm running on 14,7456Mhz)

Oli

Awesome! A clock-independent Arduino core would be great. There are a few other clock-dependent routines in there. One is the analog read configuration: the prescaler value should depend on the clock speed but currently doesn't.

We are planning to support different hardware configurations (maybe even non-AVRs). Probably not in the sketch itself, but by providing a menu with a list of options like Arduino, stand-alone ATmega8, Wiring, Crumb, whatever. Those menu items would be defined by configuration files in a directory somewhere, in a format easy enough for someone to define their own.

Thanks for help! I'am gouing to try it when i get home! :slight_smile:

http://www.melabs.com/downloads/XP_stop_polling.reg here is link to reg file which disables port polling. And if some day this link will not work again there is code:

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Parport\Parameters]
"DisableWarmPoll"=dword:00000001

this fix is also included in avrdude package! And about that config file can you send it to janez(at)tegleda(dot)com

you just need this in your avrdude.conf, for the "dapa" programmer (the one from adruino webpage)
Since avrdude version 5, it's allready included.

programmer
  id = "dapa";
  desc = "Direct AVR Parallel Access cable";
  type = par;
  vcc   = 3;
  reset = 16;
  sck = 1;
  mosi = 2;
  miso = 11;
;

did uisp finally work with the XP_stop_polling.reg patch?

Yes, it did work! Thanks for help!

If for someone still doesn't work check http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=36591&highlight=programmer this page! All in detail information for common problems with PPP or DAPA!

i have exactly same problem!

i have tried all.... no luck...

try http://www.amwaw.edu.pl/~adybkows/elka/ispprog.html download the program, under options select uisp and thats it. Select hex and try to upload file, if it does click reset and wait! if nothig heppens with LED try changing cksel bits 3to0 to 0100 this is 8Ghz if it works thats it, if stil not working try changing capaticors near crystal. Write what error it gives

it is mandatory to connect the AC adaptor (9, 12v) ??? or only the isp to parallel... ??

now i'm going to try with this programmer (ispprog)...

it's strange...

i had tested all cases... plug the power supply and try uisp and avrdude... without power supply... etc, and no luck...

yesterday, i tested the ispprog... and it works! but later i tested the uisp one more time (for test) and the error "flash error at...xxx) not showed!!!!!

now i have my arduino board working!

thanks!

:slight_smile: happy programming