Posted by Chris Anderson on December 22, 2008 at 11:30am
To load the failsafe firmware on ArduPilot's Attiny chip, you need to do the following.
1) You'll need an ICSP AVR programmer. We recommend AVRSIP2. Connect the cable to the correct ICSP port on your board, as shown above. The red stripe on the cable should be on the same side of the connector as the square solder pad on the back of the board. (On our boards that means that the red strip is on the side closest to the processor)
2) Now you'll need to change (turn off) one of the default "fuse" settings in the Attiny45, which divides the internal clock by 8 so it only runs at 1 Mhz. (Explanation of all that and more about fuses are in the excellent Sparkfun tutorial here). Run the AVR Studio program that came with the AVRSIP2 programmer. Ensure that the board is powered on by connecting it to an ESC or other power source! The red LED on the board should be on.
3) To change the fuse with AVR Studio, connect the programmer and go to Tools/Program AVR/Connect. Choose AVRISP mkII. You may get an error (choose cancel). On the "Main" tab of the dialog, click the "Settings" button and pick 125khz and click "Write". Then make sure "Device" is Attiny45 and "Read signature". At the bottom it should say that all's okay. If so, switch to "Fuses" tab and uncheck CKDIV8. Press "Progam", then "Verify" to make sure it's woking. [Note for those who are curious: the AVR programmer can only work at 1/4 of the clock speed of the chip. The Attiny ships with a 8Mhz internal clock, but when that DIV8 fuse is set it's only running at 1Mhz, so the programmer must be running at less than 250khz. Once you clear that fuse and the chip is running at full speed, the programmer can run at 2Mhz, which is 1/4 of 8Mhz]. Your processor is working fine and ready to program.
4) Now you'll need to burn the firmware. Still in the AVR Studio dialog box you used above, go to the Program tab. Where it says "Flash", input our firmware hex file. If you've already downloaded it in some folder, you can select that here. If not, switch to your browser and download this file. Click "Program". All should go well and you'll see the OKs below. If you want to make sure it's working, you can click "Verify". Now you can go back to the "Main" tab and change the Settings to 2Mhz.
That's it! The failsafe should be working now. Connect the CTRL lead to channel 5 or 6 of your RC receiver and power on the ArduPilot board. When you toggle that channel a red LED should go on and off on the ArduPilot board, indicating that control of the output channels is being switched from the RC receiver to the autopilot or vice versa. For extra fun, toggle it back and forth fast five times. That should reset the autopilot (for in-air recovery).
Can you try to power on the LED (connected to pin 12), maybe is inverted... and will never turn on!
If not, can you tell a bit more, i have no idea what could be the problem, please? Also when you upload the sketch be sure you have selected Arduino Diecimila as a board (in tools tab)...
Well, I am powering the board with 5.0 +/- .1 Volts already and no luck. The GPS locks and works separately but no LED lock on either ardupilot board no matter what. I have flashed the attiny 45 and now it correctly turns on and off with a spektrum ar5000 and DX 6.i on the gear channel.I've even tried loading all of the different versions of ardupilot. Should I flash the atmega 168? Maybe ill try that, its just the ardupilot.hex, right? The only info that comes up when connected to the command prompt is the "Ardupilot!", nothing else.Any hints?
John, check the serial monitor in the Arduino IDE when the FTDI is connected (make sure the baud rate is set at 4800). Are you getting info from ArduPilot when it's running?
[QUOTE] Have two boards and both arent registering the GPS lock from the 406-a,[/QUOTE]
hi
my lock light was working fine , until i installed the unit in my superstar , i had been bench testing with a 4 cell NIMH battery , but in the superstar it was being run off the Hobico ESC , when i checked the ESC it was pushing 5.7 volts , compared to the batteries 5.2 volts , and at the higher voltage the LOCK LED would not come on , i installed a diode in the power line from the ESC , lowering the voltage to 5.1 volts , and the LOCK LED is working fine with the ESC now , HTH
A question came to my mind: can the FTDI basic breackout board I have available be of any use as a replacement of an AVR programmer cable? Probably not as is, but maybe there's some simple hack to use such a device. Am I completely wrong with this?
I think I'll go ahead and order myself an AVR progger already :) my board shipped the same day as Reto's and even though I don't have it yet I think it'll have the same issue.
Reto: The other comments are correct. There is no connection between the Attiny firmware and the Atmega code. The MUX should work regardless of whether you've loaded the ArduPilot code with Arduino. I'm afraid it is indeed that CKDIV8 fuse demon, which you'll need to clear with an AVR programmer. Many apologies for that, but you will find the AVR programmer useful in the future and it's good to have a familiarity with that level of programming chips.
Comments
Can you try to power on the LED (connected to pin 12), maybe is inverted... and will never turn on!
If not, can you tell a bit more, i have no idea what could be the problem, please? Also when you upload the sketch be sure you have selected Arduino Diecimila as a board (in tools tab)...
hi
my lock light was working fine , until i installed the unit in my superstar , i had been bench testing with a 4 cell NIMH battery , but in the superstar it was being run off the Hobico ESC , when i checked the ESC it was pushing 5.7 volts , compared to the batteries 5.2 volts , and at the higher voltage the LOCK LED would not come on , i installed a diode in the power line from the ESC , lowering the voltage to 5.1 volts , and the LOCK LED is working fine with the ESC now , HTH