Flashing the OpenPilot bootloader on a CC3D or Flashing Beta/Borisflight Hex on a CC3D!

Flashing the OpenPilot bootloader on a CC3D or Flashing Beta/Borisflight Hex on a CC3D!



I ordered a CC3D clone board from one of the members of RCGroups – needed it in a hurry, and he’s a great seller, so off we go. In the fullness of time and 2 days later it arrives in the post.

Plug it into my PC to have a play, and get the wonderful Windows 7 low level “your USB device is not loved” message. It’s important to realize that this is NOT a driver failure – it’s one level below that in the windows hierarchy – windows knows something was plugged in, but does not even see it as a valid USB hardware device.

"OH NOESSSSS!"

Oh Noessss!

Unhappy CC3D.

I’ve played with enough STM32 based boards to strongly suspect that this means the board does not have working firmware on it. With no firmware or bootloader, the STM32 isn’t even making the USB port a USB device.


A load of googling later, and I find out the following :

  1. Some of the Chinese clone boards were shipped without firmware or more importantly, a bootloader, and yes, the hardware developers think that’s funny cause they are not making money off the clone boards, and no, they are not going to make it easy to solve your problem. I’ll leave off the OpenSource hardware rant – google Bre Pettis if you want to see what happens.
     
  2. There are only two status LED’s on the CC3D board, and if you are only seeing solid green, that means at least one of two things –
    • You are in STM32 “Device Firmware Update mode”
       
    • The board is unable to load firmware. This is important later on, as this makes it a lot more entertaining to recover. Some designers choose to use more than one LED to indicate this status! :P
       
  3. The USB port on the CC3D is connected directly to the STM32, and with windows, you are out of luck trying to recover via USB. Fortunately the “Main” serial port on the CC3D is directly connected to the UART on the STM32, so you can do a serial recovery & load.

So – stop talking and tell me what to do, and what I’ll need.

  1. You will need a FTDI interface. You can use either 3.3v or 5.
     
  2. You will need the JST-M micro cable for the serial port on the CC3D, and a harness to connect this to your FTDI interface. Pinout on the CC3D “Main” port, looking at it from the side(left to right) is:
    • Ground – Connect to Ground on your FTDI
    • Vcc – leave this unconnected
    • TX –Connect to RX on your FTDI
    • RX – Connect to Tx on your FTDI
       
  3. Small flatblade screwdriver or something like this to jump two solder pads on the CC3D.
     
  4. STMicroelectronics Flash loader Demo – available from here
     
  5. CC3D bootloader HEX. I have *no clue* where you are supposed to actually find this file. I found it in an obscure link on the Openpilot developers forum, and can’t find the link anymore. I’ve hosted it here.
     
  6. 5v power supply to power the CC3D. I *suspect* you can power via the USB port, but I had a bench supply, so just used that connected to a servo lead. You could as easily use an ESC with a BEC.
     
  7. Some patience:-)

Now that you have the bits you need, let’s walk through the process.

 

Step One :

Get the CC3D into STM DFU mode. This by far the most frustrating step as the board has one LED (the Green one), and it’s already lit telling you there is no firmware. To put the board into DFU mode, you need to short the SBL pad to 3v when the board is booting.

There are any number of ways to accomplish this – you can solder bridge the two pads, or use a small metal screwdriver.  There is a certain amount of pain here – you will not know if you are in DFU mode as the Green LED is already on – so a solder bridge is the easiest way to guarantee you are in the proper mode.

So bridge the pads, and connect your power.  You do not have to keep the pads bridged after you’ve applied power and the green LED is on.

The bootloader pins on the CC3D Atom are on the reverse side of the board.

 

Get the CC3D into STM DFU mode

Step Two :

Connect the serial cable you made to the “main” port on the CC3d and your FTDI board, and plug this into your computer. I’m assuming you’ve done this before, and have the appropriate drivers loaded. I also map the serial port to a “low” port – in my example COM1 – as some apps don’t like high ports.

Step Three :

Install and run the STM Flash Loader Demo tool. Pretty straight forward – options are highlighted below, and as usual all must be right for this to work.

Step Four :

Here’s the start of your potential Frustration.  Click “Next”.  You should – almost immediately get the screen below.  If you do not, you will get a “unable to connect to device” message after 10 seconds.  This means you either have made a bad FTDI cable (ouch!) or more likely – are not in DFU mode.

The STM Flash app is not smart – if you fail to connect, close the app, remove power from the CC3D, bridge the SBL pads and try again. 

Eventually you’ll get this – hooray!

Step Five :

Click next – you should see “STM32_Med-density_128K”.

Click Next, and select the “Erase” option, and select “All” radio button. 

 

 

You should get a success Message, click “Back” when done to return to the previous screen.

Step 6:

Load the firmware.  Select “Download to Device”, and browse out to the hex file I linked to earlier.  You want to make sure the loadpoint Is 8000000 – I think that’s the default, but check to make sure yours is the same.

​If you are flashing beta/borisflight, use the HEX file you downloaded from https://github.com/borisbstyle/cleanflight/blob/betaflight/obj/betaflight_CC3D.hex Make sure you download the RAW file!!
 

Click Next – you should see your FTDI spitting data to the CC3D, and a progress bar.  You’ll send the file, and then verify the memory load.

Betaflight hex is the full firmware, and is (currently) about ~120k, so will take a minute or so to load and verify.



Step 7:

Ok!  Assuming your firmware verified correctly, you have now completed the hard port of this.  Have a tasty cold beverage of your choice, disconnect everything, and if you have soldered the pads, remove the bridge.

Connect your CC3D to your computer – moment of truth – you should get a driver load message, and a happy windows beep.  Your CC3D should now have a gently pulsing blue LED.  If so, give yourself a high five, and have another tasty cold beverage – it’s all coasting from here.

Happy CC3D!



 

 

 

You have now got a bootloader on the board – and have connected to windows, and hopefully had the driver load.  Go ahead and load OpenPilot, and go to the “Firmware” section.   Press the “Rescue” option, and follow the connect/disconnect instructions.


If all goes well, you should end up back at the firmware screen with a few more options!

Step 8:

Select the “Auto Update” option above. OpenPilot will connect to the intertubes and download the latest and greatest firmware for your board. Follow the instructions, and you should end up with a most happy CC3D and a flashing blue LED!

Step 9:

Config your vehicle and GO FLY!!!!
Posted by John Driggers

comments to "Flashing the OpenPilot bootloader on a CC3D or Flashing Beta/Borisflight Hex on a CC3D!"

Copyright 2015 SouthQuay3D
-->