Step 46: Program the AVR with test code

Picture of Program the AVR with test code
Time to test if your brand new LED cube actually works!

We have prepared a simple test program to check if all the LEDs work and if they are wired correctly.

You can download the firmware test.hex in this step, or download the source code and compile it yourself.

As in the previous step, we use avrdude for programming:
  • avrdude -c usbtiny -p m32 -B 1 -U flash:w:test.hex

-c usbtiny specifies that we are using the USBtinyISP from Ladyada -p m32 specifies that the device is an ATmega32 -B 1 tells avrdude to work at a higher than default speed. -U flash:w:test.hex specifies that we are working on flash memory, in write mode, with the file test.hex.
Remove these adsRemove these ads by Signing Up
Loskeem5 months ago

Does anyone know where the source code for "test.hex" is? The hex file won't run on my cube. Using Windows7 vs Linux?

cenac23110 months ago

ArticW0lf, I have the same problem

erreur test.hex.png

I finally figured out this problem, the whole "save it to where ever you want" is complete BS! You have to save the test.hex file to the same directory as what your command prompt is working off of, in your case save the file to C:\users\"user name" , that should fix your problem. although even though my IC will now run the program I have no lights coming on at all.

ArticW0lf10 months ago

I saved the file to my documents as test.hex and I keep getting the same message in command prompt: input file test.hex auto detected as invalid format.

any ideas?

deba1681 year ago
I follow the instruction to upload the source code..upload the program successfully but the status led blink infinitely..and cube not running...can anybody help..??
jojo_12201 year ago
first of all, thank you chr, for this very good tutorial about this cube, i love it ;)

I have built my own one with a few changes (JTAG-programming; RS232 Port)
Now I'll Test it with your Test Program but i also need a C-Program if it is possible. I had to change some GND-Ports because of using the JTAG-programming insteed of the ISP......

Please help me ;)

Thank you,

Boul1 year ago
Hi everybody,

I have a little problem to programm my ATMega32. When I type:

"avrdude -c usbtiny -p m32"

Everything is OK, but when I type these both instructions:

"avrdude -c usbtiny -p m32 -U lfuse:w:0b11101111:m

avrdude -c usbtiny -p m32 -U hfuse:w:0b11001001:m"

I break my ATMega32 (In fact, after that, I have no more access to the ATMega32). This is my third ATMega32. I don't know if this is the first or second instruction which break my ATMega32. With my new ATMega32, I tried this instruction:

"avrdude -c usbtiny -p m32 -B 1 -U flash:w:test.hex"

But I have an error message which say:

"avrdude: initialization failed, rc=-1

Double check connections and try again, or use -F to override this check."

Do you know what's problem can cause this error message? I verified the routing of my board, but I didn't see anything.

For information, I tried this with Linux and Windows

Thank you very much for your help.
wong12752 years ago

I've successfully set the fuses and flashed my ATMEGA32 with the test.hex code, but when I power on, STATUS2 flashes on and off, then STATUS1 comes on and stays on (or flashes faster than I can see). Does anyone have any idea what this might mean?

I was able to upload and execute the test.hex program, but I had to hit the RS232 button to make it go; however, I am not using an RS232 cable. I uploaded the main.hex code and main.epp code but I got nothing from my cube upon pressing the RS232 button. Anyone have a fix?
berto1473 years ago
when using command - avrdude -c usbtiny -p m32 -B 1 -U flash:w:test.hex
it replies with error opening test.hex: no such file or directory
I have downloaded the test.hex file and saved it , is there a specific location I need to save this file to in order for it to be read
00cwilkr3 years ago
hi mate your link to test.hex doesnt go anywhere?
What you do is right click on test.hex, and select "Save Link As...", then save it to wherever you want.
mnpumar3 years ago
Does anyone know where to put temp.hex in windows or how to specify the path?
What you do is right click on test.hex, and select "Save Link As...", then save it to wherever you want.
natekling4 years ago
Is there a C code example file?

Thank you.