Thread Tools
Jan 16, 2016, 04:06 PM
Registered User
MGeo's Avatar
Thread OP
Mini-HowTo

Breadboard STM32F3 FCs, 8Khz Betaflight with ESP8266 WiFi Telemetry



I. Working ESP-8266 Wi-Fi Telemetry and Configurator link

See post #52 for the working ESP8266 WiFi link to STM32F303CC based SPRacingF3Mini breadboard here -->
https://www.rcgroups.com/forums/show...5&postcount=52


II. Working Micro SD Card Blackbox data logger

See post #47: https://www.rcgroups.com/forums/show...3&postcount=47


III. 4/8KHz Colibri Race breadboard near equivalent (MPU-9250 over SPI)

See post #54 for the working STM32F303CC based 8KHz Colibri Race breadboard here -->
4KHz gyro/acc https://www.rcgroups.com/forums/show...3&postcount=54
8KHz gyro only https://www.rcgroups.com/forums/show...1&postcount=55
Wiring https://www.rcgroups.com/forums/show...4&postcount=56



IV. SPRacingF3Mini breadboard near equivalent (MPU-9250 over I2C, no baro)

See post #41 for the working STM32F303CC based SPRacingF3Mini breadboard here -->
https://www.rcgroups.com/forums/show...5&postcount=41

$3.29 Modified (swapped processor from F1 to F3) eBay STM32 mini dev board (http://www.ebay.com/itm/STM32F103C8T...QAAOSwosFUVEEU)
$5.10 MPU-9250 9 DOF Gyro+Accel+Magnetometer Sensor Module http://www.ebay.com/itm/SPI-IIC-MPU-...RnD&rmvSB=true


V. SPRacingF3 breadboard equivalent (MPU-6050+MS5611+HMC5883L over I2C)

See post #40 for the working STM32F303CC based SPRacingF3 breadboard here -->
https://www.rcgroups.com/forums/show...6&postcount=40

$3.29 Modified (swapped processor from F1 to F3) eBay STM32 mini dev board (http://www.ebay.com/itm/STM32F103C8T...QAAOSwosFUVEEU)
$14.50 eBay GY-86 10DOF-MS5611-HMC5883L-MPU6050 (Gyro+Accel+Magnetometer+Baro) sensor board http://www.ebay.com/itm/GY-86-10DOF-...kAAOSwrklVeUpI


VI. MotoLab TornadoFC breadboard equivalent (MPU-6050 over I2C)

See post #24 for the final working STM32F303CC based breadboard MotoLab TornadoFC with hardware debugger here --> https://www.rcgroups.com/forums/show...2&postcount=24

$3.29 Modified (swapped processor from F1 to F3) eBay STM32 mini dev board (http://www.ebay.com/itm/STM32F103C8T...QAAOSwosFUVEEU)
$1.93 sensor board (http://www.ebay.com/itm/GY-521-6-DOF...UAAOSwnH1Wap1G)

--------------------------------

History:

I've had success programming an STM32F103CB small form factor dev board with Betaflight NAZE 2.3.1, using a GY-86 wired per the "red board" wiring diagram in post 2 here (https://www.rcgroups.com/forums/show...30&postcount=2). I followed the Naze32 Rev 4 schematic as a reference (https://code.google.com/p/afrodevice...aze32_rev4.pdf).

Board: http://www.ebay.com/itm/STM32F103C8T...QAAOSwosFUVEEU
Sensor: http://www.ebay.com/itm/MS5611-MPU60...AAAOSw3ydVpIgC

Configurator: running Ubuntu 14.04, Chrome, Version: 1.1.0 is now talking to the board using an FTDI USB converter.

Even though the processor on my board is marked as an STM32F103C8, I program it via Configurator as a Naze32 or CC3D (STM32F103CB) with no errors. This is an ST curiosity in how they produce, sort and mark chips. So your results may be different from mine on that.

I first tried connecting Configurator with the board programmed via FTDI but before the GY-86 was connected. The Configurator would not connect without working sensors. With GY-86 connected everything came right up and looks to work fine. It turns out I made a rookie mistake here not connecting the MPU-6050 INTA line (see the NAZE32 rev 4 schematic, but even then it worked fine.

But of course I want more...
Last edited by MGeo; Apr 17, 2016 at 06:49 PM. Reason: Moved from here: http://www.rcgroups.com/forums/showpost.php?p=33740001&postcount=14620
Sign up now
to remove ads between posts
Jan 16, 2016, 04:06 PM
Registered User
MGeo's Avatar
Thread OP

STM32F303CC DIY board for Clean/Betaflight


...what I really want is an STM32F303CC DIY board and sensors that works in the Cleanflight/Betaflight ecosystem . I scoured Ebay trying to find an STM32F303CC version of the cheap and tiny STM32 dev boards but no luck.

>>> HINT:HINT to you better ShenZhen eBay board vendors out there, with just a simple $0.50 more expensive processor BOM change you can be the only one selling a much more powerful ARM Cortex-M4 based product with floating point power. <<<

So DIY to the rescue. A while ago I came across ChipQuik as an SMD rework technique. This stuff works as advertised. Follow the video and in a minute you have one cheap dev board minus it's STM32F103C8.

SMD Removal using a Chip Quik kit (3 min 30 sec)

SMD Removal using a Chip Quik kit (3 min 30 sec)


So now ready for the STM32F303CC (from Mouser) transplant. This was way (way, way) harder than I anticipated. The pins are so fine pitch that chip alignment was very difficult. I hacked up a clothes pin as a clamp, put on my magnifying glasses, and soldered it up with a fine tip soldering iron. I used de-solder braid to remove the excess solder. I managed to bend one pin with the braid during the clean-up operation. Under magnification it looks soldered down ok with a tiny gap from the next pin. I used an ohm meter to make sure that there was no bridging there. But everything is so fine pitch it is difficult to fully inspect.

Now to the even harder part for me. I have some GY-86 boards (same sensor set as SPRacingF3/Dodo I think, and an MPU-9150 breakout board both are I2C. I have the published Sparky 1.1 schematic to follow (https://github.com/TauLabs/TauLabs/b...parky_v1.1.pdf) so I am leaning toward the MPU-9150 as a first attempt. I've used dfu-util to load the Sparky bin file onto the board and dfu-util reports success.

Also, MPU-9150 can be had cheaper: http://www.ebay.com/itm/MPU-9150-9-A...sAAOSwpDdVTfKm

I know from my experience in the previous post that the sensors need to work to get something up and running. This makes it fairly hard to debug. So far I have been unable to get the STM32F303CC dev board to connect to the configurator.

So a question for anyone familiar with the low level startup code:
- Is there an easy way (serial CLI connection, debug switches) to get diagnostic info from the processor during startup to tell if I have everything connected proper? If so, which port would I connect my FTDI TX/RX to to get at the diagnostic info? Or can I use VCP USB connection?
- Will the fact that I have no pressure sensor (compared to Sparky V1.1 which does) create a problem that will hang my start up?

Thanks in advance,
George
Last edited by MGeo; Feb 01, 2016 at 04:54 AM.
Jan 16, 2016, 09:26 PM
Registered User
For the future, a Nucleo STM32F303 board is available from Mouser or Digi-Key for ~$11 http://www.mouser.com/search/Product...yNUCLEO-F303RE http://www.digikey.com/product-detai...105-ND/5052640

Seems much easier than replacing the STM32...
Jan 17, 2016, 03:44 AM
Registered User
Seems too big, from the pictures, not finding size anywhere... but surely more than even the older 5x5cm standard.
Jan 17, 2016, 06:25 AM
Registered User
MGeo's Avatar
Thread OP
Quote:
Originally Posted by robca
For the future, a Nucleo STM32F303 board is available from Mouser or Digi-Key for ~$11 http://www.mouser.com/search/Product...yNUCLEO-F303RE http://www.digikey.com/product-detai...105-ND/5052640

Seems much easier than replacing the STM32...
Thanks for the suggestion. But who wants DIY easy anyway I honestly thought it would be a 5 minute job. I've upgraded my processors previous as part of Er9X Tx project (http://openrcforums.com/forum/viewtopic.php?t=2477) and using ChipQuik it was just that easy. This F303CC chip is that much finer pitch that it was a good bit harder. I need to up my game on soldering tools and technique for this job.

I have one of these (rather heavy) STM32F303RE Nucleo boards, they are nice and cost effective (no free shipping though). It does have a built-in V2.1 St-Link you can break off (on left side in picture below, Note the perforation slits in the board). Maybe if you strip that and all the header pins off you could get the weight down. I also have a couple flavors of F4 Nucleo so maybe later.

In this project I am going after a DIY solution that fits into an existing (Cleanflight/Betaflight) ecosystem and so is binary compatible with a few of the STM32F303CC flight controller boards out there. A 303RE board would be a new platform for Cleanflight/Betaflight. Minor changes but I doubt I could interest those devs in supporting yet another platform. I wouldn't if I was them.

So I am attempting to reverse engineer a solution. There are some hints that people have swapped the '103CB for a '303CC on their CC3D board (https://groups.google.com/forum/#!to...ot/IzKiEY3t9a0), but I can't find any published details on it.

I was hoping someone familiar with the software would give me a quick pointer. No luck yet so for my next step I will get a Segger or a DIY Black Magic Probe SWD debugger running against compiled code so I can step through to answer my questions in post #2 above.

DIY Black Magic Probe Sources:
http://nuft.github.io/arm/2015/08/24...ic-stlink.html
http://www.blacksphere.co.nz/main/blackmagic
http://wiki.paparazziuav.org/wiki/STLink
http://embdev.net/articles/STM_Disco...ck_Magic_Probe
http://www.micromouseonline.com/2014...v2-programmer/

George
Last edited by MGeo; Jan 24, 2016 at 02:09 PM.
Jan 17, 2016, 07:16 AM
Registered User
MGeo's Avatar
Thread OP

Some background


I should have started off explaining that for me this is to a large extent a learning project. Like many folks here I started off on 8 bit AVRs and Arduino IDE.

Now along comes cheap, available and wicked powerful ARM chips (M4s like the F303 and F4 have hardware multiply and divide) from multiple sources. On chip debugger that works with free and open tools. The chips support free preemptive RTOS available if you want it...etc. We can now do some serious controls work on a single chip. Cool.

But climbing the learning curve on tools and chip at the same time has been tough. Documentation is scattered across the Internet in Tower of Babel fashion, with much of it outdated. Eclipse is particularly bad. Every major revision changes menu options and structure, so a tutorial for Luna release does not line up for more recent Mars revision in some areas for example. Documentation does not keep pace with revisions. It takes a while to sort the new and relevant from the obsolete dead ends.

So nothing like a project with a goal to drive the learning. I plan to document as I go to help others if there ends up being interest. If nothing else it gives me a place to stash my web links to relevant info so I have a hope of finding it later.

Finally, I recognize that in the end you can buy some of the existing small form factor F3 boards for not much more money than I have spent here. But I already had all the pieces minus the F303CC chip, so for me the outlay is next to nothing and the learning is the objective.

DIY help welcome.
Last edited by MGeo; Jan 24, 2016 at 05:04 PM.
Jan 17, 2016, 11:55 AM
Registered User
MGeo's Avatar
Thread OP

Windows Toolchain Install: Eclipse based


Good but slightly out of date instructions for installing an Eclipse/GCC based toolchain for STM32 can be found here: http://www.carminenoviello.com/en/20...nucleo-part-1/ There are also installation details here http://gnuarmeclipse.github.io/install/. I ended up using a hybrid of the two per below:

Java
Make sure you have Java installed on your machine before you get started with Eclipse. Eclipse is based on Java.

Eclipse
Install the Eclipse IDE version for C/C++ developers using the Eclipse Windows installer for your system (32 or 64 bit). The latest version is Mars, it can be downloaded from the official download page here http://www.eclipse.org/downloads/ind...tructions=TRUE Be sure to pick the "Eclipse IDE for C/C++ Developers" package.

Create a folder in your root directory such as C:\STM32Toolchain. Create a projects folder within C:\STM32Toolchain to get C:\STM32Toolchain\projects and select this as the workspace folder when you start Eclipse for the first time.

Eclipse CDT Plug-In
An Eclipse plug-in is a software module that extends Eclipse. Eclipse has a built in mechanism to manage plug-in installation. Install the C/C++ Development Tools SDK, aka Eclipse CDT. To install CDT go to Help->Install new software and activate the CDT checkbox. Once CDT is made visible, you can select it and install the plug-in.

GNU ARM plug-ins for Eclipse
This plug-in adds features to Eclipse CDT to interface and integrate a GCC ARM tool-chain. Also included are the key plug-ins to integrate OpenOCD and Segger J-Link debuggers into Eclipse. Follow the instructions found here http://www.carminenoviello.com/en/20...nucleo-part-1/, and here http://gnuarmeclipse.github.io/plugins/install/

Install GCC Toolchain
From here https://launchpad.net/gcc-arm-embedded

Cygwin build tools and GIT
Using Windows means you have to bring your own build tools and GIT, and worry about properly integrating them into Eclipse so they can be found properly. I followed these instructions: https://github.com/cleanflight/clean...n%20Windows.md

OpenOCD or Segger debug
Depending on your debugger / loader hardware, install OpenOCD or Segger per http://gnuarmeclipse.github.io/debug/install/

Eclipse ARM Packs Manager
Install the Pack Manager package for the ST Microelectronics STM32F3 (I also install the F1 and F4 packs for the other boards I've been working with) by following instructions here http://gnuarmeclipse.github.io/plugins/packs-manager/
Last edited by MGeo; Apr 16, 2016 at 05:31 AM.
Jan 17, 2016, 11:55 AM
Registered User
MGeo's Avatar
Thread OP

Linux Toolchain Install: Eclipse based


Java
Make sure you have Java (or alternately OpenJDK) installed on your machine before you get started with Eclipse. Eclipse is based on Java.

Eclipse
Install the Eclipse IDE version for C/C++ developers. The latest version is Mars, it can be downloaded from the official download page here https://eclipse.org/downloads/?osType=linux. 64 bit is here https://eclipse.org/downloads/downlo...-x86_64.tar.gz and 32 bit can be found here https://eclipse.org/downloads/downlo...nux-gtk.tar.gz.

The Eclipse IDE is downloaded as a .tar.gz archive. Extract the archive into a folder in your home directory such as ∼/STM32Toolchain . At the end of the extract you will find the folder ∼/Toolchain/eclipse containing the Eclipse IDE. Go inside the /STM32Toolchain/eclipse folder and run the eclipse executable. Eclipse will ask you for the folder where Eclipse projects are stored (known as the workspace). Create a /projects folder within ∼/STM32Toolchain and select this as the workspace folder.
-OR-
Linux folks like to know where things get installed so they follow instructions like those in the proceeding paragraph. But it is not a requirement. To make life easier there is an Eclipse installer for Linux you can use here http://www.eclipse.org/downloads/ind...tructions=TRUE. Be sure to pick the "Eclipse IDE for C/C++ Developers" package.

Create a folder in your root directory such as C:\STM32Toolchain. Create a projects folder within C:\STM32Toolchain to get C:\STM32Toolchain\project and select this as the workspace folder when you start Eclipse for the first time.

Eclipse CDT Plug-In
An Eclipse plug-in is a software module that extends Eclipse. Eclipse has a built in mechanism to manage plug-in installation. Install the C/C++ Development Tools SDK, aka Eclipse CDT. To install CDT go to Help->Install new software and activate the CDT checkbox. Once CDT is made visible, you can select it and install the plug-in.

GNU ARM plug-ins for Eclipse
This plug-in adds features to Eclipse CDT to interface and integrate a GCC ARM tool-chain. Also included are the key plug-ins to integrate OpenOCD and Segger J-Link debuggers into Eclipse. Follow the instructions found here http://www.carminenoviello.com/en/20...nucleo-part-1/, and here http://gnuarmeclipse.github.io/plugins/install/

Install GCC Toolchain
Follow the instructions from here to install and test your GCC toolchain installation. https://github.com/cleanflight/clean...in%20Ubuntu.md

OpenOCD or Segger debug
Depending on your debugger / loader hardware, install OpenOCD or Segger per http://gnuarmeclipse.github.io/debug/install/

Eclipse ARM Packs Manager
Install the Pack Manager package for the ST Microelectronics STM32F3 (I also install the F1 and F4 packs for the other boards I've been working with) by following instructions here http://gnuarmeclipse.github.io/plugins/packs-manager/
Last edited by MGeo; Jan 24, 2016 at 02:12 PM.
Jan 17, 2016, 02:48 PM
Registered User
MGeo's Avatar
Thread OP

SWD based Debugger / Loader hardware


This page has a list of hardware debuggers https://github.com/cleanflight/clean...20Debugging.md. I'm starting with the Segger J-Link EDU debugger shown below. Later I'd like to work out Black Magic Probe instructions as well.
Last edited by MGeo; Jan 23, 2016 at 06:26 PM.
Jan 17, 2016, 02:48 PM
Registered User
MGeo's Avatar
Thread OP

JLink as hardware debugger


Connect the Segger J-Link EDU to the mini-dev board over the 4 wire SWD connection. Segger SWD pinout can be found here: https://www.segger.com/interface-description.html. The four wire debug connection to the board is VTref, SWDIO, SWCLK, and Gnd. Note that VTref is the target reference voltage used to sense the logic level. This means you must also somehow provide power to the board. The easiest way to do this is to connect the microUSB connector to a powered USB port on your computer.

The attached picture shows the Segger-EDU with the modified SMT32F303CC mini-dev board. The other connection to the mini-dev board is an FTDI serial to USB on USART1, to stand in for the CP2102/CP2104 on the SPRacingF3 and Dodo boards.

At this point you should now ready to test your J-Link connection to the processor. Remembering I have swapped out the STM32F103C8 chip for an STM32F303CC device, the command line is:

Windows:
Code:
$ JLinkGDBServerCL -if swd -device STM32F303CC
Linux:
Code:
$ JLinkGDBServer -if swd -device STM32F303CC
Last edited by MGeo; Apr 16, 2016 at 08:34 AM.
Jan 17, 2016, 02:49 PM
Registered User
MGeo's Avatar
Thread OP

Testing the SWD debug connection


Terminal snip of a successful SWD connection to the modified STM32F303CC dev board via JLinkGDBServer below.

Linux:
Code:
[email protected]:~$ JLinkGDBServer -if swd -device STM32F303CC
SEGGER J-Link GDB Server V5.10h Command Line Version

JLinkARM.dll V5.10h (DLL compiled Jan 21 2016 19:26:03)

-----GDB Server start settings-----
GDBInit file:                  none
GDB Server Listening port:     2331
SWO raw output listening port: 2332
Terminal I/O port:             2333
Accept remote connection:      yes
Generate logfile:              off
Verify download:               off
Init regs on start:            off
Silent mode:                   off
Single run mode:               off
Target connection timeout:     0 ms
------J-Link related settings------
J-Link Host interface:         USB
J-Link script:                 none
J-Link settings file:          none
------Target related settings------
Target device:                 STM32F303CC
Target interface:              SWD
Target interface speed:        1000kHz
Target endian:                 little

Connecting to J-Link...
J-Link is connected.
Firmware: J-Link V9 compiled Jan 21 2016 18:49:33
Hardware: V9.30
S/N: 269303969
OEM: SEGGER-EDU
Feature(s): FlashBP, GDB
Checking target voltage...
Target voltage: 3.30 V
Listening on TCP/IP port 2331
Connecting to target...Connected to target
Waiting for GDB connection...
Last edited by MGeo; Jan 24, 2016 at 07:10 AM.
Jan 18, 2016, 02:10 AM
Registered User
I'm working on my own F3-based FC so I'm happy to give you pointers. I've figured out a number of things along the way. I'll open source it as I get further into it too.

I'd suggest you start with an STM32F3Discovery actually because it has an STLink built in and there is also a Cleanflight target for it already.

I also have a pull request to Cleanflight documenting my GDB process that is separate from Eclipse. https://github.com/cleanflight/cleanflight/pull/1652

As far as soldering the MCU you should look up drag soldering. Its the bee's knees.
Jan 18, 2016, 05:26 AM
Registered User
MGeo's Avatar
Thread OP
Hi tannewt

Thanks for your advice. I have an STM32F3DISCOVERY I will dig out. I will still want to get the mini-dev board going as a goal but starting with an existing target makes sense.

I read your GDB instructions DOC, I will try it out.

Thanks!
George
Jan 22, 2016, 10:22 PM
Registered User
Quote:
Originally Posted by renatoa
Seems too big, from the pictures, not finding size anywhere... but surely more than even the older 5x5cm standard.
There's a version of the F3 nucleo that is the same size as the arduino micro. You'd have to check if it has enough pins for your purposes, but I'd think you'd be able to get SPI for a 2.4 GHz radio chip, I2C for a gyro and four PWM motors/ESCs at the least. If you can use ESCs on an addressable bus rather than individual PWMs that means even fewer.

Of course you'd be flying around the mass of the header pins, micro USB connector, and the on-board ST-Link micro.
Jan 23, 2016, 05:26 AM
Registered User
MGeo's Avatar
Thread OP
Quote:
Originally Posted by cstratton
There's a version of the F3 nucleo that is the same size as the arduino micro.
Hi cstratton. Thanks for the pointer to Nucleo-32s. The form factor looks nice.

The only version I find (http://www.st.com/web/catalog/tools/.../SS1532/LN1847) for F3 is the STM32F303K8T6, which is too small with only 64KB FLASH in a 32LQFP. 64KB will not fit the base non-debug code much less the GDB elf file. The 32LQFP does not support the goal of code compatibility with existing Cleanflight/Betaflight target, as the small form factor boards all use the 48 pin F303CC chip. Sigh.
Last edited by MGeo; Jan 24, 2016 at 07:05 AM.


Quick Reply
Message:

Thread Tools