Developer

ArduPilot: How to re-flash Attiny45

This is a quick video tutorial to explain how to re-flash the attiny45 in ardupilot boards. You can also tweak the attiny code if you wish...But first you need to fallow this steps:1.-Buy an AVRISP MKII programmer, you can buy one in DIGIKEY, MOUSER and FARNELL (for Europeans)2.-Download and install AVR Studio from here, if the link don't work try this one (you must register). When your are installing it, when it ask about "Jungo Drivers", say always "Yes, yes and yes!" (are AVRISP drivers).3.-Now AVR studio will only let you program ATMEGAS in assembler (yeah, sure). For C/C++ you must install the WINAVR (AVR GCC). It will automatically fuse with AVR Studio, so don't worry about anything else... The main page is here, and the direct download here. After download, install it please.4.-Now plug you AVRISP programmer and make sure the drivers are well installed, if you want to know more about AVR studio and AVRISP please read here (very suggested).5.-Download the Fail Safe firmware (or code), to download the one i'm using in the video click here. Lasted updates will be published here. You can also download the HEX directly here, if you want... ;-)6.-Watch my quick-made video:
E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • Thanks Chris for this better image of the fuse settings.
    I don't know for sure, but something probably went wrong with my last try: since I had no risky SPIEN modifiable fuse visible in my programmer, I tried to program with all fuses off, including my SUTs, CKSELs, BODLEVELs and RSTDISBL. But after that, my programmer did not recognize the ATTiny45 anymore!!! I suspect I have now a locked device on which I cannot change anything anymore and which could only be saved through a high voltage programming. Could this be in yur opinion? If so, is it possible to do it with the chip on board by powering the RESET ISP pin with 12V? Or in doing so am I risking something bad for the board or components?
    With my way of trying out things too fast, it is certainly not the last time I'll need some help. Sorry for that. But I felt I was almost on the right path resolving the MUX issue. anyhow, thanks for all your support.
  • 3D Robotics
    The fuses should look like this:

  • I have following fuses which can be set in my AVR program.
    CKDIV8, CKOUT, SUT1, SUT0, CKSEL3, CKSEL2, CKSEL1, CKSEL0
    RSTDISBL, DWEN, WDTON, EESAVE, BODLEVEL2, BODLEVEL1, BODLEVEL0
    SELFPRGEN
    I tried to figure out from the movie which has to set off, but I could not read it from the movie nor find a complete list for fuse settings for the Attiny45 on ArduPilot. Could someone please tell me which of the above fuses I should set to 1.
    I would greatly appreciate this information.
  • Developer
    You welcome Jonny!
  • Jordi,

    Nice, this is more like it, very well explained and I'm sure quite a number of people will find it usefull also. I have located an AVR programmer and it is on its way, so if anyone else would like a lend of it and dont mind paying the postage I will pass it round as soon as I have programmed my boards. Once again thanks for the tutorial Jodi you have saved me a lot of time!
  • 3D Robotics
    For those of you who want a shortcut and don't want to modify the C code or otherwise use the compiler function in AVR Studio, you can actually skip several of these steps and just upload the HEX file directly.

    In that case, you don't have to install WINAVR, and you can skip some of the AVR Studio steps in the video. Instead, once you've got the AVR programmer connected and you're in AVR Studio, just go to Tools/Program AVR/Connect, then press connect (you may get an error, which doesn't matter; click cancel). You'll need to select the Attiny45, and check that it's reading the right signature. Now go to the Program tab. Where it says "Flash", input our firmware hex file, which you can download here.

    That's it! The new firmware should be working.
This reply was deleted.