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).

Views: 8248

Comment by Noth666 on February 10, 2009 at 5:58am
@Reto: cool, mine also shipped 30th Jan, so maybe I have it waiting for me when I get home :).
Comment by Reto on February 10, 2009 at 6:08am
@ Noth666: you got any clue if there's an easy test to check if the fuse in the Attiny is set correctly?
Comment by Saiful Azuwan on February 10, 2009 at 6:23am
Reto, Just solder the Pin 1(out) and CTRL. Connect to ESC and rx channel 5 or 6. Then give a test... Thats all...
Comment by Reto on February 10, 2009 at 9:01am
thanks Saiful. I have done that. The board powers on (red power led). The GPS blue led blinks a pattern. The yellow Stat led blinks the same pattern. The MUX led is off. It lits on only when I unplug the CTRL pigtail from the receiver.
The software is not loaded yet. My question is if the above led description is ok for a board with correct fuse setting. Put another way, is it normal that the Autopilot cannot be switched on/off before the software was uploaded.
Thanks for your inputs on this.
Comment by Saiful Azuwan on February 10, 2009 at 9:14am
Reto, I think your board is loaded with the firmware but the fuse is not set correctly (like mine). You need AVRISP to uncheck the CKDIV8.
Comment by Noth666 on February 10, 2009 at 10:09am
@Reto: I would expect the mux so switch regardless of the arduino code being loaded, since the whole idea of the design is to have the mux separate.
So I would agree with Saiful that you do indeed have the CKDIV8 fuse set...

3D Robotics
Comment by Chris Anderson on February 10, 2009 at 10:17am
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.
Comment by Reto on February 10, 2009 at 11:25am
Thanks guys for the suggestions. I'll get an AVR programmer then!
Comment by Noth666 on February 10, 2009 at 11:29am
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.
Comment by Reto on February 10, 2009 at 11:54am
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?

Comment

You need to be a member of DIY Drones to add comments!

Join DIY Drones

Groups

Season Two of the Trust Time Trial (T3) Contest 
A list of all T3 contests is here. The current round, the Vertical Horizontal one, is here

© 2018   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service