Update 2016 May 24:

Executive Summary:  (Linux) Add TauLabs or dRonin udev rules to allow unprivileged users to access the new Sparky2 USB ID.  This post has a bu_sparky2.opfw attached.  Flash this (and run it a few seconds) with your new version LP GCS (next or 16.06 release) just before you start using the new version of LP.  If you are running an older version of LP Sparky2 code, do not flash the new bootloader updater (BU) until you have a new version (GCS and firmware) to use it with.

Instructions for adding the needed udev rules to Linux:
- Download the attached file named 45-uav.rules
- Run a shell / terminal / command prompt and change directories to where ever you downloaded the file
- enter the following commands
Code: [Select]
sudo  cp  45-uav.rules  /etc/udev/rules.d/45-uav.rules
sudo  udevadm  control  --reload-rules
This assumes you are a member of the Linux plugdev permissions group.  If you have problems, refer to this page:
https://github.com/TauLabs/TauLabs/wiki/Development-Linux-setup

The latest Sparky2 code has been changed to have a bootloader that is compatible with the TauLabs bootloader that comes on new Sparky2 boards.  This Sparky2 code is not in next yet.  This new compatible bootloader means that you do not need to do SBL procedure to get a new Sparky2 board working with LP code.  Assuming you have a Sparky2 board with the default TauLabs bootloader that it came with, when this new LP code is released, you will just flash the new LP bootloader updater (bu_sparky2.opfw) using the rescue function of the new LP GCS.  It is important to run the BU for a few seconds after flashing (just press Boot).  After that, use the rescue function of the new LP GCS to flash the new normal firmware (fw_sparky2.opfw) that came with the new GCS.

For those who already flashed the old, incompatible BL onto their Sparky2 boards, there is a way to avoid doing the SBL procedure again.  Don't do this until you have access to the new GCS and firmware.
Do this to avoid doing SBL again on your Sparky2:
- You can uninstall old LP GCS, but it is a good idea to export your settings before you upgrade anything.
- Build or download the new LP sparky2 GCS and firmware (in next right now, soon to be released).
- (Linux) Add new udev rules for the new Sparky2 USB ID (old Sparky2 USB ID was same as Revo).
- Disconnect flight battery power and only use USB for this procedure.
- Leave USB unplugged until instructed to plug it in.
- Use the bu_sparky2.opfw that is attached to this post.  It has the new, TL compatible USB IDs.
- Use your new LP GCS.  Go to the Firmware tab and press Rescue, then immediately plug Sparky2 into USB.
- After a few seconds, the Open button will appear.  Press Open, navigate to and select the bu_sparky2.opfw that you downloaded.
- Ignore the warning about board b01 doesn't match firmware 9201
- Press Flash and wait for the erase and flash to complete.
- When flashing is complete, press Boot to boot the BU.  Let it run for 10 seconds.
- Unplug USB from Sparky2.
- Press Rescue again, then immediately plug Sparky2 into USB.
- It should select the correct firmware, or press the Open button, navigate to and select the correct firmware fw_sparky2.opfw
- Press Flash and wait for the erase and flash to complete.
- DONE
- If you can't find fw_sparky2.opfw because you are running the final release, you can do the following:
- Once bu_sparky2.opfw has been flashed and run, you could disconnect USB and then press the Upgrade or Erase-and-Upgrade button (follow the instructions on screen) to install the firmware that comes with the install.

<End of Update 2016 May 24>

Understand that there are two software levels of being bricked besides bad hardware:
- You have a current, working LP/OP bootloader on your board.  You know the bootloader (current or LP/OP or not) is working if the blue LED comes on and does some kind of blinking, whether that is: blinks once every 7 seconds, fast blinking, or fade from bright to dim to bright every couple seconds.  You know that bootloader is a current LP/OP version if you can start an Emergency Rescue Procedure successfully.  If you have a current, working LP/OP bootloader you do not need to do the SBL procedure (which is a pain to do).
- If the blue LED does not come on or stays solid (no blink or fade bright dim) for more than say 15 seconds, or if you can't successfully start the Emergency Rescue Procedure, then you need to use the SBL procedure to put at least a current LP bootloader on it.

CC3D:  First of all, you need to know that cloners call everything CC3D to get you to look at it.  A "Revo" is a Revo and has nothing to do with CC3D.  The CC3D SBL procedure cannot be done with USB.  Your computer must effectively have a serial port (usually a USB to "ttl level" serial adapter) and the correct cable.  That usually means an "FTDI" USB to serial adapter or similar.  You can use another OP board like Revo or CC3D with USB VCP Function set to ComBridge 57600.  If you have an OP board and a standard 4 pin MainPort / FlexiPort cable, you don't have to make a cable.

If you have a current working LP/OP bootloader on your board already, you can skip over the SBL instructions and just do the "Emergency Rescue Procedure" with the firmware you want to flash.

SBL procdures:

I have not tested this as I don't have a Windows box handy.
The attached dfu-util.exe is one I found on the Internet.  Please scan it for viruses to be safe.
Please post back here if you don't see any posts that say it worked and there were no viruses.
I built the attached bootloaders.

If you have a different bootloader on your board then, before you can even flash it, you need to write the bootloader.
This is the case if you:
- had CleanFlight on your board.
- just bought a new Sparky2 board.
- tried TauLabs on your Revo board.
- etc.

To write a bootloader you must use SBL (System Boot Loader) which is always there and can't be erased.

To use SBL the two tiny tiny tiny SBL pads on the board must be shorted before and during power on.
Sparky2: SBL is located on top side of board close to LEDs and baro chip.
Revo:    SBL is located on bottom side of board close to largest black chip.
CC3D:    SBL is located on top side of board close to corner hole close to ESC/servo outputs (use 3.3v and SBL).

They must be shorted together at least from a little before to a little after connecting power.  Probably the easiest way is to temporarily solder a blob to connect them.  You can leave the blob on until you are done with the flashing command and must remove it after that.

Personally, I do it this way though.  SBL pads must be shorted at the time that power is applied (when plugging in USB).  First, you need a little mound of solder on each pad (but not shorted together).  My new Sparky2 was the first board that had bare copper there and needed solder mounds added.  Second you need a very small "safety pin", the type with a small coil at the bottom.  Leave pin closed, and if you want, you can carefully spread the coil a tiny amount with a knife.  Finally, to use it...  Assume mounds are left and right, hold pin vertically with coil down and so that one coil is in front of both mounds and one coil is behind both mounds.  When done correctly, it tends to self-center and stay in contact when you hold it.  VoilĂ !  If you have three hands, you can hold the safety pin to the SBL pads while you are plugging USB in.

If you did SBL correctly, then only the green LED will be on.  If you have more colors than that, you did something wrong or the SBL pads were not shorted together during the moment of power on.

Be aware that upper/lower case is important in Linux / OSX commands.
Open a command prompt.  "Terminal" in Linux.  Command prompt (cmd.exe or command.com) in Windows.
You need to know where you downloaded the files.  The easiest way to flash this is to start by going to the directory where the downloaded files are stored:
   cd whereever-the-files-are-stored

If you can successfully flash firmware, but it won't boot and run, then flashing and running the resurrection firmware is usually necessary:
This is because for a Revo or Sparky2 that has run TauLabs firmware, there is another hoop to jump through.  After flashing the bootloader, and before flashing the real firmware, you must flash (and run for a few seconds) a resurrection firmware that clears a special place in the settings.  This is not always necessary, and may be related to which TL version you used.  LP/OP uses this area for logging, and fails to start up if it is corrupt.  Use the following instructions to flash the bootloader first, then the resurrection firmware, then run the resurrection firmware till it finally finishes iniitialization (30 seconds) then (using the normal update and erase procedure) the real firmware that comes "built into the GCS" with standard releases.

Do this to use SBL to flash a bootloader via USB for Revo or Sparky2:
In the following, whateverfile.bin is something like bl_revolution.bin
Short SBL and plug the board into USB and type:
   dfu-util  -d  0483:df11  -c  1  -i  0  -a  0  -D  whateverfile.bin  -s  0x08000000
It takes a minute or two if you are using an entire flash image like e.g. ef_revolution.bin, but for the smaller bootloader files (e.g. bl_revolution.bin) it is just a few seconds.
You should see it say some technical stuff, then start printing dots (old version of dfu-util does not print dots, even a large file should finish within 10 minutes and come back to the command prompt).  When it is done, unplug USB and unsolder the solder blob.

Emergency Rescue Procedure:

Flash and run the resurrection firmware:
- Run the GCS
- Unplug the board from power and USB.
- Go to the firmware tab in the GCS and press the Rescue button.
- Plug the board into USB.
- GCS recognizes the board in a few seconds.
- Press the "Open" button to navigate to and select the correct resurrection firmware opfw file that you downloaded.
- Press the Flash button to write the currently built firmware.
- It will start in a few seconds.  First it will erase, then it will write (flash) the firmware.
- When the flash is done, press the Boot button which will cause the resurrection firmware to run
- Let it run for 30 seconds at least.  On Sparky2, I see blue and green LEDs for 10 seconds, then just green for another 10 seconds, then the board boots normally (LEDs do the normal operation colors).  You might also see just 20 seconds of green followed by normal operation LEDs.

Flash the normal flight firmware:
- Run the GCS
- Unplug the board from power and USB.
- Go to the firmware tab in the GCS and press the Rescue button.
- Plug the board into USB.
- GCS recognizes it in a few seconds and selects the correct firmware for you.
- Verify that the firmware is for the correct board.
- Press the Flash button to write the currently built firmware.
- It will start in a few seconds.  First it will erase, then it will write (flash) the firmware.

Be aware that some versions of flashing tools don't print anything and bl files are small and thus fast to flash, but ef files are big and if the flasher looks locked up, you should give it 15 minutes and it will finish.

Edit: 2015 Dec 18
Added tested resurrection firmware for Sparky2 (removed old version) and greatly clarified the instructions.  I got a TL Sparky2 firmware that consistently bricked my LP Sparky2 firmware so I could finally code a proper fix.

Edit 2016 Jan 10
Clarification that a Revo is a Revo and has nothing to do with CC3D.

Edit 2016 Jan 19
Added a Revo 1509 firmware with resurrection.
fw_revolution_resurrect2-1509.opfw

Edit 2016 Jan 22
Added Nano
bl_revonano.bin
ef_revonano_resurrect2_1509.bin
fw_revonano_resurrect2_1509.opfw

Edit 2016 Feb 13
Edited instructions a bit to make it clear when SBL Procedure can be skipped.

Edit 2016 May 24
Put an update about the new Sparky2 USB IDs at the top of the page.

Edit 2016 May 27
Instructions for adding udev rules to allow access for new Sparky2 USB ID

Edit 2016 May 28
Attached final release version (?) of bu_sparky2.opfw that can run on either the old (0b01) or new (9201) device ID.
« Last Edit: May 29, 2016, 02:36:07 am by TheOtherCliff »

f5soh

  • *****
  • 3695
    • LibrePilot
There is also a more short story if you have a build environment setup and a Linux box :
Simply type :
Code: [Select]
make ef_revolution_dfu
You can also use the dfu-util from host :
Code: [Select]
make  DFUUTIL_DIR=/usr  ef_revolution_dfu(This call /usr/bin/dfu-util installed in your host)

I'm pretty sure this can be done the same in windows with the right path to dfu-util binary
« Last Edit: October 25, 2015, 02:14:05 am by f5soh »

That's some good shortcuts for new devs etc.  :)

I started to write about that in another thread, then realized that most users will have a Windows box or at least access to a Windows box.

The current instructions are good for Revo and Sparky2, but I need to write up the serial port stm32flash version for CC3D users that have something else on their CC3D.

Thanks for this, I had flashed raceflight on my revo, and wanted to go back to OP/librepilot, but it wouldn't boot properly. Simply flashed your resurrect firmware using GCS, and it works now. Thanks a million.

To write a bootloader onto a CC3D:
- You can't replace a corrupt bootloader on CC/3D using USB. You must short the CC/3D SBL pins together and use serial (e.g. USB to serial adapter, sometimes called an FTDI) to Mainport (or Flexiport?).
- this assumes you are using a Windows PC
- I found the stm32flash.exe on the Internet.  I don't have a Windows box handy and I can't vouch for it so you should scan it for viruses before using it.  Here is where I got it:  https://github.com/stko/oobd/blob/master/tools/stm32flash/stm32flash.exe
- download the attached files into a directory of your choice (Desktop is fine if you know where it is located on the hard drive)
- connect a USB to serial converter (commonly called an FTDI for the brand of the chip) to mainport (or flexiport?).  You will need to make an adapter cable.  You need 4 wires: ground to ground, +5V to +5V, TxData to RxData, RxData to TxData
- determine which COMport the USB to serial converter is using.  Temporarily plug the USB to serial converter into the PC.  Look in ControlPanel -> System -> DeviceManager (or read the notes at the bottom of this post)
- Unplug the USB to serial converter from the PC.  Connect the CC3D to the USB to serial converter, short the SBL pads on the CC3D together (as described in the first post), then plug the USB to serial converter into the PC
- run the following command from the directory where you downloaded stm32flash.exe and bl_coptercontrol.hex
stm32flash -w bl_coptercontrol.hex -g 0x0 COMwhatevernumberyourcomportis
- unsolder the SBL pads
- make sure that power and USB are unplugged from the CC3D and press GCS -> Firmware -> Rescue
- quickly plug the CC3D into the USB port
- wait a little while for the Upgrade button to become active
- press the Upgrade (or Upgrade & Erase) button and read the information and wait for it to finish

Please post if you use this and tell me if it works.

Supposedly this command will list the Windows Comports:
    wmic path Win32_SerialPort

The Arduino UNO can act as a USB to serial converter if you follow some instructions.
    http://blog.oscarliang.net/use-arduino-as-usb-serial-adapter-converter/

and this will tell you which comport is connected to an Arduino device:
    for /f "usebackq" %%B in (`wmic path Win32_SerialPort Where "Caption LIKE '%%Arduino%%'" Get DeviceID ^| FIND "COM"`) do set comport=%%B
    echo Com Port for Arudino device is detected as %comport%.

ef_coptercontrol.bin is the Entire Flash for Librepilot 15.09 on CC/3D.  That is it contains bootloader and normal (application) flash.  If you flash this you don't need to flash anything else to run 15.09.

Edit 2015 Dec 18:
I added a CC/3D resurrect firmware in case anyone runs across a coptercontrol that has been bricked by running TL etc. firmware.  Note that this is not a problem with the TL etc. firmware, but that LP sees what appears to be corrupted storage to it just because the TL firmware has been run.  The ef bin file can be flashed with stm32flash just like a bootloader.  The fw opfw file can be flashed from GCS if you have a working bootloader (start with CC3D unplugged and press Rescue then plug in CC3D.  Open and select the downloaded resurrect opfw file.  Flash.

Please post if you use this and tell me if it works.
« Last Edit: December 18, 2015, 09:30:13 pm by TheOtherCliff »

i'll do this tonight, I need to get cleanflight off a cc3d so I can dump LP onto it.

done!

I did mine a bit different tho, I use the GUi from ST. Flash Loader Demonstrator http://www.st.com/web/en/catalog/tools/PF257525

solder the sbl pads
connect ftdi minus the VCC
connect external battery pack to servo pins to fire up cc3d
load the app, find my com port erase the chip then load up the new .bin disconnect everything, unsolder the sbl bridge and done.
took pix along the way if anyone wants images.

doing this was pretty easy. I flashed cleanflight onto the board the same way previously.

JaeMelo

  • *
  • 26
Do this to use USB for Revo or Sparky2:
In the following, whateverfile.bin is something like bl_revolution.bin
Short SBL and plug the board into USB and type:
   dfu-util  -d  0483:df11  -c  1  -i  0  -a  0  -D  whateverfile.bin  -s  0x08000000
It takes a minute or two if you are using an entire flash image like e.g. ef_revolution.bin, but for the smaller bootloader files (e.g. bl_revolution.bin) it is very quick.
You should see it say some technical stuff, then start printing dots for a few minutes.  When it is done, unplug USB and unsolder the solder blob, then run the GCS.
If you flashed the EF (entire flash) file which includes both bootloader and firmware you are done flashing.
If you only flashed a bootloader, you still need to use GCS to flash the firmware.
Do the following to flash the firmware:
- Unplug the board from power and USB.
- Go to the firmware tab in the GCS and press the Rescue button.
- Plug the board into USB.
- GCS recognizes it in a few seconds and selects the correct firmware for you.
- Verify that the firmware is for the correct board.
- Press the Flash button to write the currently built firmware.
- It will start in a few seconds.  First it will erase, then it will write (flash) the firmware.

Any idea how this resurrection firmware works?! I just finished building another board managed to get the df until thing to flash the bl to the brand-new chip... the revo took the resurrection firmware in GCS but fails to completely update to the latest firmware.. its like its stuck in a boot loop. I remember having this issue before. I just can't remember what the order in doing this is to stop the boot looping from happening.
« Last Edit: December 05, 2015, 09:27:30 am by JaeMelo »

Boot loop, about 7 seconds per cycle, blue LED on and a quick blip is the symptom of bricked Revo that requires the resurrection firmware.  You do the Rescue procedure, starting with Revo unplugged and pressing the Rescue button and then plugging Revo in.  Flash resurrection, boot it and let it run a few seconds.  Flash normal firmware.

blue LED fading dim to bright to dim is a different thing.  You may not even have firmware on it in that case.  Do the same resurrection procedure, but just use normal firmware (the Update button once you have started Rescue).

anypis

  • *
  • 23
Thanks you, I flashed taulabs as well and board was getting in boot loop. I tried everything. but Simply flashed your resurrect firmware using GCS, and it works now. Thanks a lot :D ;D ;D

To the first post I added working resurrection firmware for Sparky2.  I finally got a TL firmware that consistently bricked my LP Sparky2 firmware and took the time to code a proper fix.

To the CC/3D post, I added resurrection firmware for CC/3D if anyone ever gets a bricked CC/3D.

flachskopp answered my request (german language branch) for help regarding Revo boot problems and after following the c/pasted instruction of yours I finally managed to get my Revo clone to boot at least twice in a row. Thank you for your great work. I already spent 10+ hours to get my clone to boot at all! Now my real question: can I use the resurrection fw to fly? When I flash the LP fw after your resurrection fw the fc does not boot, with yours it does!
LP says this is a shared/LP-72_sparky+-dirty fw though I definitely downloaded the Revo res. fw 2 and 2-1. Currently I do run the 2 version (215KB). Does it matter?
And my GPS still is not recognised or listed in GCS - GPS is assigned to MainPort (7N with twisted TX/RX wires, green solid and blue blinking LED).
Again thanks!

gunslinger
Maker: homebrewed 3D printed multicopters. Polar circle approved!

I was working on a branch that made unbricking for both Sparky2 and Revo.  That is just the name of the branch.  If "revo" is part of the file name, it is the correct firmware for Revo.

Flash the resurrection firmware.  Boot it up and let it run for 60 seconds.  After that, you should be able to put any other firmware on it.  These firmwares have fixed many bricked Revos.  If there is more than one FW for your FC, you might try the other FW.

Thanks for your reply. I am still struggling with my Revo clone to make the GPS work. I tried the following:
resurrecting the fc - check
upgrading & erasing to fw provided by LP - fails to boot afterward. Only rescue & safe boot works. No normal boot with the fw and my board.
resurrecting with res-fw2-1: boots but no sensors reported to LP GCS though it is stated with the red sign as a correct fw.
resurrecting with res-fw2: boots and sensors are reported but reported with an exclamation mark (I do ignore this), so far the only working option for me. The last thing I would like to achieve is to get the NEO-7N GPS to communicate to the Revo.
System GPSPositionSensor claims:
Status NoGPS
SensorType Unknown
AutoConfigStatus DISABLED
BaudRate Unknown
Actually the GPS is connected to the MainPort declared as GPS with 57600bd and UBX protocol.
Is there any way to force the Revo to recognize the GPS?
Thanks for your help
Michi
Maker: homebrewed 3D printed multicopters. Polar circle approved!

It sounds like there is a hardware problem if only the resurrect firmware will run.

Can you save any settings (then power off and back on and settings stay set) using resurrect firmware?  I ask because this is all about reformatting the same storage that holds settings.

Analogy:  If your computer hard drive gets corrupted data, you can reformat the hard drive, write correct data back out, and it will work again, but if the hard drive is broken, reformatting will not help and nothing can be saved to hard drive and seen after reboot.