Setting up Mac for Orangutan

Wondering how much interest there is “out there” in getting your Mac set up to code and program your Orangutan(s)? I decided to take the plunge and set up my MacBook for a newly acquired LV-168 and USB programmer.

EDIT: Since originally posting this, I’ve updated the tutorial for OS X 10.5 and 10.6, with the new Pololu Library (libpololu-avr) and using the new CrossPack-AVR toolchain from Objective Development. It has additional info on tweaking Makefiles, and setting up Xcode and GNU Emacs as IDEs. Also included are steps for tweaking avrdude to work with the ATmega328P (featured on the newer Orangutans)

Here’s the latest version of the tutorial.

If someone with a 328P could verify that all works and let me know that’d be swell… :slight_smile:


EDIT to remove old content
See updates added to the post above:

Hello, Michael.

Thanks for the information! It’s great to hear you were able to get this working on the Mac. Would it be alright if we link to the step-by-step guide on your site from our resources page?

- Ben

It’d be my pleasure!

Excellent info! I was up and running in no time. Thank you!

Very cool, glad to hear it! :mrgreen:

Hi all,

I have a problem in programming the OrangutanX2.
I have followed the step in this tutorial but when I execute the code for flashing I receive the follow message:

Aquarius-1:pwm0-only luca$ avrdude -p m168 -P /dev/tty.Pololu -c avrispv2 -e -U flash:w:pwm0-only.hex 

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9609
avrdude: Expected signature for ATMEGA168 is 1E 94 06
         Double check chip, or use -F to override this check.

avrdude done.  Thank you.

What is wrong?


The main controller on the Orangutan X2 is a mega644, not a mega168, so you need to change your command line (and probably also your source code!) to use the mega644.



thanks…yes I have wrong the mcu type. It is m644!

Anyway I have a little problem because after the first flash with the default firmware, that I have done for test the programming sequence, now I can’t reenter in programming mode by pressing the relative button.

What’s happening…?
Is it possibile to do an hard reset?

I can’t find a solution…


I’m not sure I follow. Are you saying you tried to upload new firmware to the auxilliary mega168 microcontroller and now you can’t enter programming mode? If so, was there a reason why you did this?

- Ben

Hi Ben,

my upload operations refers to m644 non to m168. I have done it after have changed the command for flashing the X2.
I have maked some flashing test with the “blinking led” test program and everythings gone well, but when I have flashed the X2 with the “ox2m644_test” firmware then my X2 can’t reenter in programming node.

My idea, if possibile, is an hard reset of the X2.
What think you about it?



When you say it can’t enter programming mode, do you mean that holding the reset button down for 0.5s doesn’t put you in programming mode? Do you have any signs of life from your X2?

You’re not giving me many details about your problem, which is making it very difficult to help you.

- Ben

Hi ben,

I am sorry, you are right I don’t have submitted many details about the problem so I have done some test to check the problem and I find that:

if I shut down the X2 and links off the battery then wait for a long time before press the on button my X2 start correctly and I can enter in programming mode by pressing the relative button for 0.5 sec.
In this case the X2 behaviour seems to be stable but when I attach the usb link to my mac the X2 exit from programming mode and press the programming button cause no effect.

I still don’t have a good understanding of what you’re trying to explain, so I have a number of questions for you:

  1. What do you mean by “links off the battery”? How long is “a long time”?
  2. What else is connected to your X2 while you are conducting these tests?
  3. Have you modified the SMT solder jumpers on the X2 (such as by adding the bridge to connect USB power to Vcc)?
  4. Do you have another computer you can test your X2 on?
  5. If you hold the reset button for, does it enter programming mode (yellow LED on, buzzer beeps) after 0.5s and then exit programming mode as soon as you release the reset button? Or does holding the reset button down do nothing?
  6. If you hold the reset button down for 6 seconds, do you see the red LED turn on and stay on?

- Ben

Hi Ben,

this morning I have tried again and the first time I power on the x2 it seems to load the firmware well and if I press the programming button for 0.5 sec it enters in programming mode (yellow led on and buzzer beeps) and I if press the button for 6 sec the red led turn on and stay on.

Then I tried to power off the x2 and it goes off but when I press the power on button and it loads the firmware the buzzer don’t beeps but the test led are on and now the programming button do not works.

For “links off the battery” I mean disconnect, I am sorry my english is not very good…
Actually I have nothing attached to the x2. Yes I can use an another computer to test the x2.
I am sorry…I wrote “long time” because I re-tested it the day after…


If using a different computer doesn’t fix things, can you try reinstalling the mega168 firmware? Firmware update instructions are located under the resources tab of the Orangutan X2 product page. Please follow these instructions using firmware version 1.2.

- Ben

Thanks for your guide to getting started. It seems like just what I need, but I’ve been unable to get it working.
First problem was the Pololu library was missing, so I downloaded and installed that by hand.
Now the process appears to work, but the result is:
David-Gustavsons-Mac-Pro:OrangutanSV168Demo dbg$ make
/opt/local/bin/avr-gcc -mmcu=atmega168 -Wall -Os -std=gnu99 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -MD -MP -MT OrangutanSV168Demo.o -MF dep/OrangutanSV168Demo.o.d -c OrangutanSV168Demo.c
/opt/local/bin/avr-gcc -mmcu=atmega168 -Wl,-gc-sections -Wl, OrangutanSV168Demo.o -lpololu -o OrangutanSV168Demo.elf
avr-objcopy -O ihex -R .eeprom OrangutanSV168Demo.elf OrangutanSV168Demo.hex
avr-objcopy -j .eeprom --set-section-flags=.eeprom=“alloc,load” --change-section-lma .eeprom=0 --no-change-warnings -O ihex OrangutanSV168Demo.elf OrangutanSV168Demo.eep || exit 0
avr-objdump -h -S OrangutanSV168Demo.elf > OrangutanSV168Demo.lss

text data bss dec hex filename
0 0 0 0 0 OrangutanSV168Demo.elf

and not surprizingly the hex file has only one byte in it or perhaps it means zero, not sure, and loading it into the OrangutanSV disables the Orangutan.

For kicks I loaded the hex provided in the demo program onto the chip, and it seems to run fine.

I installed in Windows XP using Parallels, and was able to compile there and get a good hex file, but was unable to get AVR Studio to use the Pololu USB programming device, so have to copy the hex file to the Mac side and program the Orangutan there! So it’s a pretty awkward tool chain.

What could be causing the Mac problems? Several of the files are undersized compared to the default ones provided, but I don’t see any error messages, so it’s not clear to me what might be wrong!

I’d love to get it working without using Windows…


I’m not sure if Michael browses this forum regularly, so you might want to try shooting him an email if you haven’t already. If you do get it working, could you explain what the problem is and how you fixed it for any other Mac users out there? Good luck getting your SV-168 running on your Mac!

- Ben

Hi Ben,

I have tried to update firmware but I have noted that when I connect the usb cable to the computer my X2 exit form programming mode and the red led goes off.
Then if I shutdown and restart the X2 the buzzer do not beep and it do not enter in program mode if I press the relative button for the required time.

What could I try to do?

Thanks for your help.

Have you modified the SMT solder jumpers on the X2 (such as by adding the bridge to connect USB power to Vcc)?

- Ben