3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

LED Cube 8x8x8

Step 46Program the AVR with test code

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.
« Previous StepDownload PDFView All StepsNext Step »
15 comments
Feb 14, 2012. 6:42 PMstroodlemuffin says:
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?
Feb 15, 2012. 5:17 AMtriumphtotty says:
The source code for text.hex wasn't released, but possibly it runs if EITHER button is pressed.  My best guess is that the wiring for your start button is incorrect.  Check SV1 and SV2.  Do both status LEDs flicker at startup?  Check BTN1 thoroughly by following the wiring from GND to the microcontroller.  One side of BTN1 should go to GND, the other to Pin 16 on SV1.  Pin 16 on SV2 should go to Pin5 (PB4) on the ATmega32.  Check that out.
Feb 15, 2012. 6:25 AMstroodlemuffin says:
I'll try that asap. What is the value of the resistor that goes from pin 9 (reset) of the Atmega32 to VCC? I currently have a 100 ohm resistor placed there as I could not get a definite value from this tutorial.
Feb 15, 2012. 7:02 AMtriumphtotty says:
100 Ohm is far, far too low I think. 10K is recommended. I think I used 3K3 because I had them lying around, but 100Ohms dropping 5V will draw 50mA from Vcc when the programmer is trying to bring the system into _RESET_. It's only a signal wire, not a current carrier. Try something a bit bigger, and hopefully that will help!
Feb 16, 2012. 3:32 PMstroodlemuffin says:
It works great now, thanks! Was the cube set up so that you have to press button 1 to make it start? Because I hit restart and nothing happens but then when I hit button 1 the program starts. Don't really care, but just curious.
Feb 17, 2012. 12:04 AMtriumphtotty says:
Yes! When you power the cube up the two status LEDs should flash. You either press BTN1 to start the internal effects, or BTN_RS232 to switch into RS232 "slave" mode. So glad it's all working now. Well done!
Jan 11, 2011. 12:52 AMnatekling says:
Is there a C code example file?

Thank you.
Jan 10, 2012. 5:52 PMfluetke says:
(removed by author or community request)
Jan 11, 2012. 6:09 AMtriumphtotty says:
The full C source code is available in Step 49: Software Introduction. Most of the hard work is done by draw.c, and effect.c has some great code in it. main.c has the interrupts and startup code in it.
Jan 8, 2012. 7:38 AMberto147 says:
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
Jan 9, 2012. 4:15 AMtriumphtotty says:
It should be in the current folder as you type the command. Are you working in Linux or Windows?
Jan 9, 2012. 4:39 AMberto147 says:
i am working in windows
Jan 9, 2012. 5:15 AMtriumphtotty says:
Depending on where the file is, you'll need to "cd" into the directory.

e.g. if it is on your Desktop in a folder called 8x8x8 then type:
cd Desktop\8x8x8

then type your command.

If it's somewhere messy, e.g, just create a new folder in C:\ called 8x8x8 and move/copy the test.hex file into it, then type

cd \8x8x8

before typing the avrdude command.

Hope this helps.
Jan 9, 2012. 6:33 AMberto147 says:
i will try this on friday , i have had to go to scotland to work for a week , many thanks for your help
Jul 6, 2011. 6:17 AM00cwilkr says:
hi mate your link to test.hex doesnt go anywhere?
Aug 12, 2011. 1:14 PMTechNotes says:
What you do is right click on test.hex, and select "Save Link As...", then save it to wherever you want.
Aug 8, 2011. 6:41 PMmnpumar says:
Does anyone know where to put temp.hex in windows or how to specify the path?
Aug 9, 2011. 5:58 AMTechNotes says:
What you do is right click on test.hex, and select "Save Link As...", then save it to wherever you want.

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
651
Followers
7
Author:chr
I like microcontrollers and LEDs :D