Programs do not Run (Orangutan X2)

I bought an Orangutan X2 for a project I’m working on and started to work with the board. I downloaded sample code from Pololu (BlinkLED and Orangutan X2 Melody) and the code compiles fine with AVR Studio 4 (there is one 1 warning about compiler optimization being off). The .hex file gets transferred to the controller but nothing happens. Its as if the controller had no program. Both of the tests I downloaded to it were unsuccessful. Am I doing anything wrong? Any help is greatly appreciated.


The BlinkLED example from the Orangutan USB programmer’s user’s guide is not intended for use with the Orangutan X2 (only for Orangutans, Baby Orangutans, and Orangutan LV-168s). The Orangutan X2’s LEDs are not on the pin the BlinkLED program is trying to pulse, so you will have no visual cues that the program is running.

The melody demo, on the other hand, is designed specifically for the Orangutan X2 and should be working. Did you purchase an LCD with your X2? If you have an LCD connected, you should see instructions/feedback on the LCD as the melody demo runs. If you don’t have an LCD connected, it might appear as if nothing is happening since the melody demo only acts in response to button presses. Have you tried pressing the user buttons after programming your X2 with the melody demo?

- Ben


I have the same problem as well. The upload to the controller was successful
with the melody or the motortest program. After uploading, I pressed the
’reset’ button and even removed the USB cable and powercycled the board.
The program does not run. I pressed the 3 user buttons provided. None of them
activated the program. BTW, I do not have an LCD attached.

When I initially got the board from shipment, I recall one of the buttons seemed
to activate the buzzer briefly and another button seemed to set the Direction LEDs
for the Motors. I did not have the motor connected at that time.

When you program flash with a new program I assume it replaces the existing programs
right? Pardon me, I am new to using the microcontroller.



I wrote a small blinking LED demo for the Orangutan X2 and added the AVR Studio project to the Orangutan X2 web page (under the resources tab).

#include <avr/io.h>

#define F_CPU 20000000		// Orangutan X2 runs at 20 MHz
#include <util/delay.h>		// uses F_CPU to produce delay routines

void delay_ms(unsigned int time_ms)
	while (time_ms != 0)
		_delay_ms(1);		// this function comes from <util/delay.h>

int main()
	// the X2's user LEDs are located on PORTC, pins C0, C2, C3, C5, and C7
	//  so make these pins outputs
	DDRC |= (1 << PC0) | (1 << PC2) | (1 << PC3) | (1 << PC5) | (1 << PC7);

	while (1)
		PORTC = 0x01;		// drive PC0 high, all other PORTC outputs low
		delay_ms(200);		// delay here for 200 ms
		int i;
		for (i = 0; i < 7; i++)
			PORTC = PORTC << 1;		// bit-shift PORTC left one
			delay_ms(200);	// delay here for 200 ms

	return 0;

Please try to program your Orangutan X2 with this. If things are working correctly, you should see the user LEDs along the left side of the board flash in a sequential pattern.

- Ben


Thanks for the prompt response.

I compiled the program through WinAVR studio using ‘Build’ menu option. It seemed to compile fine and creates the hex file correctly. I then used the ‘Program AVR’ menu option under Tools, selected “Program FLASH” check box in 'AVRISP in ISP mode with Atmega644" window. My X2 is in the programming mode ( I pressed the Reset button more than 1/2 sec). When I pressed the “Start” button in the Auto tab, the LED in X2 blinked (next to reset button). I assume that the blinking program got downloaded to the board.

Now, I pressed the reset button once. At this point I expect the board should be running the program. It did not. I removed the USB cable, powered down the board and powered on again. The program does not run.

I do not understand. Aren’t these the right steps? What am I doing wrong? Thanks for your help.


I’m going to suggest you try a slightly different method of programming your X2:

  1. Put the X2 into programming mode by holding down the reset button until it beeps and the yellow LED turns on (~.5 s)
  2. Bring up AVR Studio’s AVRISP dialog (using the “Program AVR” menu option) and go to the Program tab (not the Auto tab)
  3. Click the “…” button next to the Input HEX File textbox in the Flash section and navigate to the file ox2_BlinkLED.hex. This file should be in your project folder, located in an automatically created subdirectory called “default”.
  4. Make sure the path in the Input HEX File textbox is correct and press the Program button (make sure you press the Program button in the Flash section and not the EEPROM section).

I’m hoping your problem was caused by your using the Auto tab for programming without first specifying the hex file you wanted to program. Please let me know if this works!

- Ben

Awesome Ben!

That works. I can see the blinking LEDs working fine. Thanks for your help.

What does ‘Erase Device’ do? I thought the ‘program’ option will erase what ever is in the Flash right?


I’m glad to hear you have everything working now! The “Erase Device” button will clear the flash and any lock bits that have been set. AVR Studio defaults to erasing the device before it programs, but you can configure it to program without first erasing. In general, you don’t need to worry about the “Erase Device” button.

- Ben

I have been playing around with the LED program and it works fine.

I tried the motor test program from ox2m644_test and the program does not seem to work in the board. Program uploaded to the board fine. But when button 4 is pressed, the motor direction LEDs turns on, but nothing happens and my motors connected do not fire up. Need help here. I tried it with both SPI wrappers 1.0 and 1.01

Does the board require a firmware upgrade?. I just received the board. How do I find out what firmware version it has and whether I need an upgrade or not?

Another thing I noticed is that, though my Vin is a 12V source, as soon as I connect it to the terminals Vin and Gnd, the voltage shows as around 6V. Why is it? The power supply is lab quality.


The board should not need a firmware upgrade, and even if you had the original firmware (1.00), it would not explain the problems you are describing. To answer your last question, the test demo code tries to display the firmware version on an LCD. You could modify the code to send the firmware version bytes over the UART to your computer and use a terminal program like hyperterm to get the results. You could also take the firmware version bytes and write them to EEPROM, and then use AVR Studio to read the EEPROM into a file that you can open with notepad. You could even program your X2 to flash its LEDs based on the firmware version bytes.

What are you using for your power supply? Are you connecting it to the VIN and GND on the top (motor-driver) board? Please tell me if my understanding of your situation is correct:

  1. You are using a DC power supply that you have set for 12 V.
  2. When you connect it to your X2, the displayed voltage drops to 6 V

Does your power supply display the current that your X2 is drawing? If so, what is this current when no motors are connected? If you’re experiencing a massive voltage drop in your power supply, it sounds like you have a short somewhere. Does your X2 feel like it’s getting hot at all anywhere?

Please see your other thread for information about motor control demo code, but I think we should first resolve this voltage drop issue before you play around with the motors.

- Ben


Thanks for the prompt response.

Regarding the power supply, I think some thing weird going on with my power supply. I connected it to a different load like a simple computer fan that draws around .43A and the voltage dropped to around 7V when I connected the fan.

I believe the X2 is alright and it does not get hot.

Regarding the motor test, the motor direction LEDs come on but motors do not fire up.