Can't program my orangutang

I have tried to program my orangutang with the simple blinking light led program tro no avail. I contacted pololu and they sent me the default code for testing the board and it worked, but when i try any other program, i get nothing. Can anybody help?

I forgot to add my code:

#include <avr/io.h> 
#define looptime 110000 

int main(void) 
{ 
long int i; 
DDRD |= _BV(1); //set PORTD.1 = output 

while(1) { 
PORTD &= ~(_BV(1)); //led off 
for(i=1;i<looptime;i++); //waste time 
PORTD |= _BV(1); //led on 
for(i=1;i<looptime;i++); //waste more time 
} 
return 0; 
} 

I got this from from a posting response by Jim Remmington.

Are you using AVR Studio 4 to do the compiling and loading?

'Cause what you are describing sounds a lot like what happened to me last night. Could be it’s building code for the wrong device. I think it defaults to an ATMega128. Be sure to change what device you’re compiling for (same dialog box that has the compiler optimization flags in it) and also set what device is being emulated (if you wind up using the emulator to test your code.)

No gurantees this is it, but it’s worth checking out, especially if the code you got from Pololu came with all the AVR Studio 4 files. Chances are that one’s building for the right device.

Hope this helps.

Tom

P.S. I stumbled around with this for way too long before I figured it out.

avrisp mkii

program page:
Device
ATmega168
programming mode:
ISP mode
flash:
Input HEX file - file to run
EEPROM
Input HEX file - Nothing here

Fuses Page:
Boot Flash section size = 1028 -Default
Brownout detection disabled
Int. RC Osc. 8Mhz -Default

Lock bits page:
mode 1
aplication protection mode 1
boot loader protection mode 1

advanced page:
signature not read ( when I try to get it to read the signature and i get an error - isp mode error)
calibrate for
8MHz
flash selected

Board Page:
Voltage
VT - 4.9
isp freq
1MHz

Auto page:
Nothing selected

on the current configurations page I have:

active config - Defualt
output file directory - defualt
device - atmega 168
freq - 8000000
optimization - -O0

Am I missing something???
Please someone help!

Sorry I didn’t reply earlier.

I don’t have my AVRISP MkII on me, so I can’t look at those dialog boxes, but from everything you’ve got it looks like it should work.

What does it say when you try to load the program?

I know you already know this, but in the dialog box for the AVRISP MkII, you need to tell it what .hex file to load. It won’t automatically select the right file for the project you have open. (At least on mine it won’t.) That needs to be set each time.

I just went through that last weekend. Load after load after load, and each time it’s like it didn’t load anything at all! That’s 'cause it kept loading the previous program, so the new behavior never showed up.

If no one else hops in with any advice, I’ll give your code and settings a try tonight when I get home.

Tom

How do you know that programming the “default code” supplied by Pololu actually worked? If the Orangutan is still programmed as supplied, a programming failure might result in no change in behavior.

You still haven’t told us what error messages you get when you try to compile and program the “blink” program.

Jim

I got my Orangutang from Pololu, and my isp from didgikey. The programer was bad so digikey sent me a new isp. On thurs (1 feb) I could press connect in studio 4 and i would get the two green leds on the isp in studio4 all the messages would come back ok but no new program would run on the O. Fri (2 feb) I called pololu and the service guy sent me the test code they use. I ran it and it worked. But, still no other code would work. I spent the weekend with my kids. so on Mon when I tried to program my O, studio 4 would tell me setting parameters: ok
entering program mode: failed
leaving program: ok

and I get a mismatch clock error (ensure isp frq < 1/4 target freq)

But my isp is set for 1MHz and my O is set for 8MHz.

I have this same senerio posted on avrfreaks and someone suggested that maybe i selected an external clock by mistake on the fuses page and now I have to figure out how to wire an external clock to “unlock” my O. But, I dont know what freq clock to buy and so forth.

I’m having a very similar problem with one of the old Mega8 Orangutan’s and an AVRISP mkII, but I am able to program it just fine with the old serial AVRISP. I’ve been reading your thread and thought (until your most recent post) that our problems were separate, so I started a new thread. Now it sounds like they might be the same.

I just noticed by your e-mail address that you are at the University of Michigan as well. I’m a graduate student in Mechanical Engineering, and I currently have both programmers set up in my office, 3944 CSE building on north campus. It would be great if you wanted to bring your Orangutan over and we could try to debug it, and maybe solve both our problems.

I’ll be in and out of my office Tomorrow (my normal weekly schedule is at: umich.edu/~aborrell/) and I have a long meeting most of Friday morning. At the very least (unless you were specifically playing with the fuses) I suspect we’ll be able to write it with the old serial programmer, and I can save you the trouble of buying a bunch of external clocks!

-Adam

Sorry, @umd.umich.edu probably means at the Dearborn campus, not the Ann Arbor campus, right? Well my offer still stands if it’s worth the 1.5 hour round trip to you!

I just heard back from a (new) friend from AVR Freaks about this exact problem:

Maybe the solution is to wait it out, until they offer a patch for the mkII firmware…or up the clock speed of the orangutan using an old/different programmer.

-Adam

I regained contact w/my O. The advice i got from avrfreaks was right I had to connect an external clock to rest the fuses. I then set the defualt settings on the fuse page.

I don’t think i will be going back to the fuse page any time soon.