Design of a FPV STM32F722 Flight Controller

Design of a FPV STM32F722 Flight Controller

This project is still under development and major testing. This hardware is considered unstable.

DISCLAIMER 2024: While I cannot control what people will use it for, I AM NOT INVOLVED, AND I CONDEMN ANY APPLICATIONS OF MY KNOWLEDGE IN BUILDING WEAPONS FOR WARS OR CONFLICTS. This article is for educational and academic purposes ONLY. Please read the license before forking.

Last year I tackled an almost impossible challenge: To develop, alone, a flight controller from zero, to be the core processing power for an FPV drone. Since it requires a lot of different skills, I've immersed myself in the journey of understanding the bottom line of complex hardware to bring the open-source community a reliable flight controller for any peaceful FPV application.

You can find the full project here: https://github.com/tropicalfpv/thunderFC

or get the EasyEDA version at: https://oshwlab.com/anardine.ef/thunder-f722-drone-flight-contro

ThunderF722 ? 2023 by Alessandro M Nardinelli is licensed under CC BY-SA 4.0

Key Words:? FPV Drones, FPV, Flight Controller, FC, STM32, STM32F722, STM, Cortex F7, UART, SPI.


The ThunderF722 Flight Controller

Overview

What is a Flight Controller (FC) and what is it for?

A Flight Controller is the core component of an FPV Drone because it hosts the sensors, software, and calculations so it can be stable and interpret signals while in the air. Long story short, it Is the brain of a drone. Without it, it simply cannot fly.

Objectives of This Project

During this project, I had two main goals:

  1. Learn how to better develop hardware. It was a personal goal since lots of times I questioned what was behind all those small parts (the microchips) and how they act together orchestrating electricity. I've seen them inside my computers, inside my drones, and during my entire life. While being able to admire them working by checking if LEDs were blinking somewhere, now I felt I truly had the skills needed to develop them, so I began this learning journey.
  2. To develop a completely open-source flight controller, so smarter people than me can perfect it so it becomes state of the art. The FPV community, mainly in Brazil, needs cheaper hardware because the import restrictions simply make everything way too costly and slow, which impacts the hobby and learning curve of those who want to develop the machines of the future.

The Overall Capabilities of this Flight Controller

This is a STM32F722RET6 Cortex-based flight controller that uses an ICM-20689 and operates using Betaflight 4.4.3. It also has a W25Q128JVSIQTR, providing enough space for BlackBox storage (you can also use it to transfer files if you are more of the homing pigeon style). I chose the STM32F722RET6 since it provides enough UARTs for the normal pilots and it's way faster than the F405, while the layout and routing are not that hardcore to do in a 6-layer board.

It does not include an OSD chip because I really feel you don't need one since most of the alarms you can set in your radio using EdgeTX or whatever, and it also keeps the layout one-sided only (so assembly does not cost a kidney, but more on that later).

It also has two power rails (LIPO to 9V and 5V) using the MP9943GQ-Z with 10uH inductors and a bunch of filtering caps.

The Schematics

Selecting the Cortex (And Why I Chose the STM32F722RET6)

I had to stick with the STMFXX family because I did not want to adapt Betaflight's code and capabilities (too much of a challenge). Since now there is also support for some STMHXX chips, those come out too costly and in my opinion are not worth it, since most pilots do not require tons of UARTs and core CPU use rarely passes the 50% mark on an F722.

Using an F4XX was an option but is slowly getting out of the pilot's dictionary because of limited UART ports and also being a past for Betaflight. Those good days of F4s and F3s are long gone!

Talking about cost, the difference between an F4 and an F7 was only $5, and was not relevant at all to the overall cost.

The STM32F722RET6 offers design simplicity and also plenty of UARTs available.

The Gyroscope and Accelerometer

Oh Boy (or Girl). This was a tough choice. I LOVE the MPUs and I simply cannot explain why. I cannot look away, however, from the fact that it has been discontinued for new builds. Betaflight offers support for the Bosch BMI270 but I saw that a lot of Issues were being raised, and it does get some confusion while handling frequencies updates. To be honest, I didn't research much here: Issues on the BMI270 and the MPU6000 going out, one guy came into the scene: the ICM-20689.

The ICM-20689 connects using SPI (as both MPU6000 and the BMI270 do) so it's great that it does not consume a UART that I can freely use for DJI or RX later. The connection is pretty simple and available on the datasheet:

Make sure to use the right caps and filter power to the VDD and VDDIO pins.

Power Management & Filtering

It was a long journey to select the Switching regulators. I wanted to use more commercial and cheaper options such as the TPSXXXX and the LMRXXXXX from Texas Instruments but most of them required external diodes. Since my design needed to be on one side only, I had HUGE size constraints.

Because of that, I used the MP9943GQ-Z from Monolithic Power Systems since it is a small 36V regulated DC-DC buck-down converter that requires few components. It is also flexible enough to use on the LIPO regulator (safely up to 6S voltage coming filtered from the ESC) and also on the LIPO-5V line by changing only one resistor.

The same regulator model MP9943GQ-Z can be used for LIPO-9V and LIPO-5V changing only one of the divider resistors (R1 to R30), making the assembly even cheaper.


One important thing I forgot to include in my first design (which burst into flames the first time) was the BAT54C,215. A simple diode that only allows one 5V power to the components (because you can have +5VBAT coming from the battery and +5VBUS coming from the USB at the same time powered on!).

This is key to the design since not having this component can backfire on one of the rails and damage the components.

Essential to the design, this BAT54C Power Diode helps the final 5V rail to be stable when connecting power to different resources


For the 3.3V power, an LDO on the 5V line does the task well. For this design, I've used the RICHTEK RT9013-33GB.

3.3V LDO after the +5V rail to power the F7, ICM and Flash.


It's also important to filter everything well. It is key to power design and is not in the scope of this article, but you should be extremely careful when deciding the caps and filters for your design.

Besides the filters on the above power rails, I've also included some decoupling on the 3.3V rail for the sensitive components:

Filter your power well!

USB Connection

USB (Type C. We are in 2024) connection is required for the configuration, boot, and flash of the FC. It enables us to communicate with the external world with ease. Betaflight accepts USB communication in MSP1 by default and the rails should be connected to the STM32F722 USB D+ and D- ports.

It is key for the stability of the F7 two resistors of 5.1kΩ (R19 and R13) directed on the CC1 and CC2 lines and two 22Ω (R8 and R9) on the USB_D- and USB_D+ lines.

I've also included a USBLC6-2P6 protective diode on the data lines, just because.

USB-C required for external data transfer and FC configuration in Betaflight.


Memory and Flash Storage for Blackbox (and Pidgeon Carriers).

Since the W25Q128JVSIQ also uses the SPI communication protocol, why not? I've added one to register tunning and other files into the drone. It's pretty simple to wire it up and also provides significant benefits at a low cost. You can play correspondence chess or ad a *.mp3 song and fly it to your buddy!

Using flash on the FC allows for data storage and Blackbox logging

Wiring Everything Up

For simplicity, you can check the files and the entire diagram on the GitHub link for the thunderFC

The entire diagram

PCB Layout, Manufacturing & Assembly

Board Layout, Size, and Placement

While dimensioning everything, wiring up, and labeling is a lot of work, it is only 30%. Since in this board I had to make the magic of fitting it all on one side, the task of laying it out was insanely difficult, and took most of my development hours.

The size should not be outside of the boundaries of the frame and also should have a 30.5x30.5 4-hole mounting configuration.

Maximum size of 50x50 to fit most drones without being out too much. Please do not judge the cleanness of my build ;)

The number of layers to fit all traces, don't compromise the performance and minimize cross-talk had to be 6. This was the layer distribution across the board:

The Layer Stackup: Top and Bot to SIG, middle layers for GND and PWR.

The components were placed all facing the top side, with routing using a 5mil for SIG and areas for PWR. All layers were filled with GND.

Top: SIG1
2. GND1


3. PWR1. Central 3.3V, 5V and 9V


4. PWR2: LIPO
5. GND2
6. SIG2. GND not visible for clarity of the rails.

Optimizing for Cost

Optimizing for cost was the rest 30% of all the effort because I had to manage Extend Components assembly fees. Using only Basic Parts was a challenge, and sometimes not possible. By removing items in the assembly process, such as connectors (I don't fly digital so I didn't need the DJI Conn).

Exposed PADs are a must, as well as Basic components such as resistors, capacitors, and inductors that actually have to be classified as "Basic Components" in JLCPCB assembly line so you don't have to pay the extended fee to load up the machines, which comes pretty costly in the end.

Also, using the basic assembly (and not the Standard) allows for WAY CHEAPER manufacturing. 8 Layer boards and two-sided assembly complicate things and make them cost way more than the simple process. This was also a constraint in this project and design.

Below is the cost comparison between the first iteration of my design and the latest one, with the same capabilities. I just had to solder the Inductors myself and short the boot mode button to DFU.

The first iteration went almost to $130, while the last was below $50 which was the target for Brazil. Price for 5 units.

The price point below $50 was critical due to restrictions on importing to Brazil. Hitting this goal was insanely hard, but possible.


Manufacturing in JLCPCB


It's easy to manufacture and order a board to JLCPCB using the EasyEDA software, all you have to do is to make sure that all the components and NETs are done and validated, and all the components are marked correctly on the Schematic Sheet. Once that is done, you can just select "Fabrication" -> "One-click Order PCB/SMT" from the PCB view.

Manufacturing was on the limits of what was possible. The first 2 units of 5 came with solder mask problems, but not placement ones. Although it was possible to do it, for my upcoming iterations I'll try to manage the spacing to be more manufacturable than the ones on this build. On this subject, the team at JLCPCB was super knowledgeable of the facts and took the subject internally. They also came clean by giving me a coupon for the next orders, so no problems there.

A comparison between the bad solder mask with the good one. JLCPCB was right on target and solved the issue.

Target & Configurations

To build the target I've mapped the pins on the schematics with the pins on the .config file that is flashed in DFU mode. Also, it is important that you download from source in betaflight the firmware that you are going to use (in this case betaflight 4.4.3) to load together with the file there.

The main challenge here was to correctly map the Timers and DMAs to the pins and UARTs required. If you are going to change this project, make sure you know how to remap using the tables provided in the documentation of the STM32F7XX Cortex. If you get it wrong, timers and DMAs are going to behave differently and Betaflight will not be able to map the UARTs and SPIs correctly.

If you have any doubts about creating a target, the Betaflight documentation can help to get you started.


Set the timers and DMAs to the channels and Streams according to the STM32F7XX datasheet. Also, set the resources to the correct pins inside the Betalfight .config file.


Conclusion & Next Steps

This project is far from over. It requires additional testing and also tunning in hardware performance & stability. Following the path to share the knowledge and leave the word better than how I find it is the true objective of this article.

If you found this project interesting, consider a donation so I can keep funding the comes-and-goes of testing and manufacturing the boards here.

ThunderF722 ? 2023 by Alessandro M Nardinelli is licensed under CC BY-SA 4.0

Simplify it and sales will be higher.

赞
回复

Hello sir can conect? , telem1,2 and 3/ ETH/ SPI add it controller? ??

赞
回复

Amazing progress! ?? Like Aristotle said, we are what we repeatedly do. Excellence, then, is not an act, but a habit. Your work lights the path for future innovation. Keep shining! ?

赞
回复
Oswaldo Nardinelli Filho

Senior Vice President | General Manager at Tate and Lyle | CEO | Board Member

1 å¹´

That is crazy. Congrats

Zachariah Peterson

Owner, NWES | PCB Design for RF, Mil-Aero, Data Center, AI/ML | That guy in the Altium videos

1 å¹´

Looks very nice, might have to highlight this in a design review!

要查看或添加评论,请登录

Alessandro M Nardinelli的更多文章

社区洞察

其他会员也浏览了