We are having problems getting started with our orangutanX2 microcontroller. We already installed all the progams including the avrstudio and winavr. We trying to run the test code. Can you please give us the steps and some ideas on how to get this started…
The first step is to install WinAVR and AVR Studio, which it seems you’ve already done. AVR Studio will automatically use WinAVR, so you shouldn’t need do any special configuration to make the two work together. You also need to install the USB-to-serial adapter drivers so that your computer can see your X2 as a standard serial port. If the green LED below the reset button is lit when your X2 is connected to your computer via the USB cable, your connection should be up and running correctly.
The next step is to use AVR Studio to program your X2. You can use one of the two sample AVR Studio projects we link from the X2 page. As an example of how to get started, download our melody demo project and unzip it. You also need to download the files SPI.c, SPI.h, LCD.c, and LCD.h. These can be found in the archives ox2_spi_wrappers_v1_01.zip and ox2m644_LCD.zip. Unzip the files directly into the directory containing your melody project (the one containing the file “ox2m644_melodies.c”).
Double-click on the file “ox2m644_melodies.aps” to open the AVR Studio project. Here you can take a look at the code and make any changes if you want. As a first step, you should just try loading the program onto your X2 to see what it does. First, place your X2 into programming mode by pressing and holding the reset button for half a second (until the yellow LED beneath the reset button turns on and the X2 beeps). You can then follow Using AVR Studio steps 4-7 from our Orangutan USB Programmer user guide. Note that for the X2, step 7 will be slightly different: your device should read ATmega644 and your input hex file will be /default/ox2m644_melodies.hex. Once your X2 is programmed, press the reset button to get out of programming mode (i.e. make the yellow LED turn off). User instructions should then appear on your LCD. If you got an X2 package that didn’t come with an LCD, you can still play the demo melodies by pressing the user buttons on the left side of the board. Also, it’s good for you to note that the first time you run the melody demo, it will need to load the melodies into EEPROM, which can take around a second. Once the melodies are loaded, you can remove from main() the section of code that stores the melodies:
// The following five lines only need to be executed once. After the
// after the melodies have been stored in the mega168's EEPROM, these five
// lines can be removed as there is no need to store the melodies again.
// The next 5 lines will take approximately 970ms to store the melodies.
// Once the melodies are stored, the file "melodies.c" can be removed from
// your project to free up program memory.
LCDString( "Storing Melodies..." );
// ----- through storing melodies
You can perform these same steps with the test code project in place of the melody demo. Once you get these sample projects running on your X2, I encourage you to try to understand how they work. Then you should take a look at the files SPI.c and SPI.h to see all the commands you can use to control the auxilliary mega168 microcontroller (and hence most of the X2’s onboard hardware such as the motor drivers, buzzer, and UART). These commands are detailed in greater detail here. If you have any problems getting this to work or any other more specific questions, please ask.
We are having trouble connecting the X2 to the program. We follow the instruction from USB programmer user guide which you showed us and we have the correct port and set up but we keep on getting connection failed at select AVR programmer window. Another thing weve notice is that when we press the reset, we hear a buzz, but the yellow LED doesnt stay lit while in programming mode. Thank you for helping us.
If the yellow LED isn’t on, it means your X2 isn’t in programming mode and you’re not going to be able to connect to it using AVR Studio. Once the yellow LED turns on, it should stay on until you either program the X2 or until you press the reset button again.
Can you provide more details about what’s happening? It sounds like you hold the reset button down until you hear a beep and see the yellow LED light (~.5 seconds). Then, when you release the reset button, the yellow LED turns off? Is this accurate? If you just press and quickly release the reset button, you would hear the reset chirp, which sounds different from the programming mode beep, and the yellow LED wouldn’t light at all.
If my description of what you’re experiencing is accurate, the only potential cause I can think of is that the reset button on your X2 is defective. I could imagine that if it were exceedingly noisy (i.e. noisy enough to exceed debounce tolerances), it could trigger a reset when you release, which would knock you out of programming mode. I would suggest that once the yellow LED turns on, you should try to release the reset button as cleanly as possible. If this fails, repeat the process multiple times to see if you can get the yellow LED to stay on after you release the button. Please let me know in as much detail as possible what you observe. If you have access to an oscilloscope, I suggest you take a look at the reset button signal as you press it and release it.
If you can get the X2 into programming mode, you can program it to be in permanent programming mode. This lets you program it without having to press and hold the reset button first.
We have tried to reset it multiple times, the buzzer does goes off, and the yellow LED turns on, but does not stays on once we let go of the switch and we never heard of any chirp of some of sort once it resets.
We also connected the oscilloscope to the reset button, and the yellow LED stays lit, once its disconnected it turns off. Is there something wrong with our X2?
Is it possible to call you?
You can reach me by calling Pololu at 1-877-7-POLOLU (1-877-776-5658). The best times to reach me would be M-F between 10am and 6pm PDT. Give me a call tomorrow if you can and we’ll see if we can get to the bottom of this.
Is there anyway to talk to you today?
Do we ask for you or is this your direct line?
We will call you at about 2pm if it is ok.
Thank you and hopefully we could get to the bottum of the problem. THANK YOU AGAIN especially replying on a Sunday.
Unfortunately I’m not in a good position to help you until I get into the office tomorrow, so it’d be best if you called then. Just ask for me when you call.
For anyone following this discussion, it seems there were two problems:
The reset button was indeed abnormally noisy and the X2’s button debouncer was not able to handle this. Today I released a firmware upgrade (v1.02) that lets the X2 handle noisier reset/program buttons. It’s really a very minor change, so if your reset/program button is working just fine, there’s probably no need for you to download the new firmware. If you find you don’t reliably stay in programming mode when you release the reset button, you might way to try out the new firmware.
Some of the much older versions of AVR studio seem to have problems programming the X2. This is solved by upgrading to the newest versions of WinAVR and AVR Studio.