xFlight open source flight control AT32F435 plan

xFlight open source flight control AT32F435 plan

  • 1. Origin
  • 2. Material list
    • 2.1 Structural parts
    • 2.2 Power parts
    • 2.2 Electronic parts
    • 2.3 Antenna
    • 2.4 Accessories
  • 3. Firmware preparation
  • 4. Complete machine
    • 4.1 Wiring diagram
    • 4.2 Appearance
  • 5. Summary of issues
    • 5.1 [Resolved] iNav firmware cannot find Baro chip
    • 5.2 [Solved] Problem with forward and reverse motors
    • 5.3 [Solved] Camera image is blurry
    • 5.4 [Resolved] ESC motor bdshot abnormality
    • 5.5 [Resolved] RPM filter is abnormal and cannot be unlocked
    • 5.6 [Resolved] MSP is abnormal and cannot be unlocked
    • 5.7 [Resolved] RESCURE_SW is abnormal and cannot be unlocked
    • 5.8 [Solved] LED Strip function cannot be used
    • 5.9 [Solved] Tramp switching VTX parameter is invalid
    • 5.10 [Resolved] GPS chip not found
  • 6. Summary & follow-up
  • 7. References

1. Origin

Note: xFlight mainly refers to betaflight/inav, and extends Ardupilot/PX4-Autopilot.

The transplantation of the AT32 chip on betaflight is already in full swing in 2022 and the progress is very good. For details, see: atbetaflight

The inav and betaflight code structures are very similar, so once betaflight is successfully ported, inav will be faster.

Learn about the official branch progress so far:

  • betaflight 2023-1-31 Merged AT32 development, introduction of AT32F435 target #12247
  • iNav 2023-5-23 Merged Add support for AT32 chips #8752

In other words, subsequent flight controllers containing AT32 chips will develop simultaneously with the open source features of inav & betaflight, which is gratifying news. It is reported that the transplantation of PX4 (PX4-AT32) has also begun to show signs, and it is hoped that it can be integrated into the official branch sooner.

It’s time to build an AT32. This time, we plan to build an AT32 F435 Mark4 for inav/betaflight/px4 verification.

2. Material list

2.1 Structural parts

  1. 5-inch rack (Mark4) x 1 (set)
  2. Silicone shock absorber x 8 (pieces)
  3. VTX antenna + 915 antenna + GPS (including compass) printout x 1 (piece)

2.2 Power parts

  1. 2205 – 2300kv motor x 4 (pcs)
  2. 4 in 1 ESC Bluejay, bdshot
  3. 5-inch paddle x 1 (set)
  4. 3S-4S battery x 1 (piece)

2.2 Electronics

  1. F435V2 flight control AocodaRC F405V2 + AT32F435 x 1 (piece)
  2. 915ELRS receiver x 1 (piece)
  3. BZ251 GPS x 1 (piece)
  4. JHEMCU 5.8G 40H 1.6W VTX x 1 (piece)
  5. RunCam 19x19mm camera x 1 (piece)
  6. LED + Buzzer integrated board x 1 (piece)

2.3 Antenna

  1. 915 antenna x 1 (T-shaped antenna)
  2. VTX antenna x 1 (rod antenna)
  3. IPX to SMA antenna adapter cable x 1 (the rod antenna is fixed on the printout)

2.4 Attachments

Note: Mainly some connecting wires, screws, nuts, spare parts, etc.

3. Firmware preparation

Since the current firmware of PX4-AT32 has not yet been merged into the official main branch, this time we will focus on using inav/betaflight.

AocodaRC F405V2 uses the STM32F405RGT6 chip in LQFP64 package. There is almost no difference in view of STM32F405RGT6 vs. AT32F435RGT7 Comparison for Flight Controller.

Therefore, we plan to directly replace the chip, but the firmware must be DIYed by ourselves. There is a lot of information online. Here are the recommendations:

  • BetaFlight flight control AOCODAF435V2MPU6500 firmware compilation
  • BetaFlight flight control AOCODARC-F7MINI firmware compilation
  • iNav flight control AOCODARC-F7MINI firmware compilation

As for the code, we also cloned it accordingly to fix some problems:

  • inav Copter-7.x-AocodaRC
  • betaflight master-AocodaRC
  • betaflight-config


Note: Use the latest related BF configuration tools. If subsequent additions or modifications are required, please refer to: Artery AT32F435/7 DFU and VCP support #3259.

4. Complete machine

4.1 Wiring diagram

4.2 Appearance


5. Problem summary

5.1 [Resolved] iNav firmware cannot find Baro chip

For a detailed discussion, see: Can’t find baro chip, what I have missed? #9399

Final reason: There is a problem with iNav at32 I2C driver code initialization, iNav7.0 will fix #9412.

5.2 [Solved] Problem with forward and reverse motors

After installing it, I suddenly discovered that this set of motors is forward and reverse. Fortunately, the installation order was correct during installation, which is a blessing among misfortunes!

5.3 [Solved] Camera image is blurry

I didn’t know at first, thinking there was something wrong with the camera or image transmission. Finally, I passed junior high school physics: thinking about the principles of optical imaging. It was found that it was necessary to manually rotate the RunCam lens to adjust the clarity.

5.4 [Resolved] ESC motor bdshot exception


Preliminary suspected reasons: Motor #4 has DMA resources and ESC problem.

# resource show all
Currently active IO resource assignments:
(reboot to update)
-------------------
A00: SERIAL_TX 4
A01: FREE
A02: SERIAL_TX 2
A03: SERIAL_RX 2
A04: GYRO_CS 1
A05: SPI_SCK 1
A06: SPI_SDI 1
A07: SPI_SDO 1
A08: FREE
A09: SERIAL_TX 1
A10: SERIAL_RX 1
A11: USB
A12: USB
A13: OSD_CS
A14: SWD
A15: FREE
B00: FREE
B01: LED_STRIP
B02: FREE
B03: SPI_SCK 3
B04: SPI_SDI 3
B05: SPI_SDO 3
B06: I2C_SCL 1
B07: I2C_SDA 1
B08: BEEPER
B09: FREE
B10: FREE
B11: FREE
B12: USB_DETECT
B13: SPI_SCK 2
B14: SPI_SDI 2
B15: SPI_SDO 2
C00: FLASH_CS
C01: ADC_CURR
C02: ADC_BATT
C03: FREE
C04: GYRO_EXTI
C05: FREE
C06: MOTOR 1
C07: MOTOR 2
C08: MOTOR 3
C09: MOTOR 4
C10: FREE
C11: FREE
C12: FREE
C13: LED 1
C14: FREE
C15: FREE
D00: FREE
D01: FREE
D02: FREE
D03: FREE
D04: FREE
D05: FREE
D06: FREE
D07: FREE
D08: FREE
D09: FREE
D10: FREE
D11: FREE
D12: FREE
D13: FREE
D14: FREE
D15: FREE
H00: FREE
H01: FREE
H02: FREE
H03: FREE
H04: FREE
H05: FREE
H06: FREE
H07: FREE
H08: FREE
H09: FREE
H10: FREE
H11: FREE
H12: FREE
H13: FREE
H14: FREE
H15: FREE

Currently active Timers:
-----------------------
TIM1: FREE
TIM2: FREE
TIM3:
    CH4: LED_STRIP
TIM4: FREE
TIM5: FREE
TIM8:
    CH1: MOTOR 1
    CH2: MOTOR 2
    CH3: MOTOR 3
    CH4: MOTOR 4
TIM20: FREE

Currently active DMA:
-------------------
DMA1 Channel 1: MOTOR 1
DMA1 Channel 2: MOTOR 3
DMA1 Channel 3: MOTOR 2
DMA1 Channel 4: MOTOR 4
DMA1 Channel 5: SPI_SDO 1
DMA1 Channel 6: SPI_SDI 1
DMA1 Channel 7: SPI_SDO 2
DMA2 Channel 1: LED_STRIP
DMA2 Channel 2: SPI_SDI 2
DMA2 Channel 3: SPI_SDO 3
DMA2 Channel 4: SPI_SDI 3
DMA2 Channel 5: ADC 1
DMA2 Channel 6: FREE
DMA2 Channel 7: FREE

Actual measurement: ATbetaflight 4.3.2 bdshot normal

# resource show all
Currently active IO resource assignments:
(reboot to update)
-------------------
A00: SERIAL_TX 4
A01: FREE
A02: SERIAL_TX 2
A03: SERIAL_RX 2
A04: GYRO_CS 1
A05: SPI_SCK 1
A06: SPI_MISO 1
A07: SPI_MOSI 1
A08: FREE
A09: SERIAL_TX 1
A10: SERIAL_RX 1
A11: USB
A12: USB
A13: OSD_CS
A14: SWD
A15: FREE
B00: FREE
B01: LED_STRIP
B02: FREE
B03: SPI_SCK 3
B04: SPI_MISO 3
B05: SPI_MOSI 3
B06: I2C_SCL 1
B07: I2C_SDA 1
B08: BEEPER
B09: FREE
B10: FREE
B11: FREE
B12: FREE
B13: SPI_SCK 2
B14: SPI_MISO 2
B15: SPI_MOSI 2
C00: FLASH_CS
C01: ADC_CURR
C02: ADC_BATT
C03: FREE
C04: GYRO_EXTI
C05: FREE
C06: MOTOR 1
C07: MOTOR 2
C08: MOTOR 3
C09: MOTOR 4
C10: FREE
C11: FREE
C12: FREE
C13: LED 2
C14: FREE
C15: FREE
D00: FREE
D01: FREE
D02: FREE
D03: FREE
D04: FREE
D05: FREE
D06: FREE
D07: FREE
D08: FREE
D09: FREE
D10: FREE
D11: FREE
D12: FREE
D13: FREE
D14: FREE
D15: FREE
E02: FREE

Currently active Timers:
-----------------------
TIM1: FREE
TIM2: FREE
TIM3:
    CH4:LED_STRIP
TIM4: FREE
TIM5: FREE
TIM8:
    CH1: DSHOT_BITBANG 3
TIM20: FREE

Currently active DMA:
-------------------
DMA1 Channel 1: DSHOT_BITBANG 3
DMA1 Channel 2: ADC 1
DMA1 Channel 3: SPI_MOSI 1
DMA1 Channel 4: SPI_MISO 1
DMA1 Channel 5: SPI_MOSI 2
DMA1 Channel 6: SPI_MISO 2
DMA1 Channel 7: SPI_MOSI 3
DMA2 Channel 1: LED_STRIP
DMA2 Channel 2: SPI_MISO 3
DMA2 Channel 3: FREE
DMA2 Channel 4: FREE
DMA2 Channel 5: FREE
DMA2 Channel 6: FREE
DMA2 Channel 7: FREE

Note: There is also this problem on the official website: VCP hangs on AT32 while getting dma list of valid resource #13138.

5.5 [Resolved] RPM filter is abnormal and cannot be unlocked

After sorting out the ideas, it is the bdshot setting previously, and the configuration turns on the RPM filter function. However, the RPM acquisition #4 motor is abnormal and RPM-based filtering cannot be used. As a result, unlocking cannot be successful.

5.6 [Resolved] MSP is abnormal and cannot be unlocked

In the past, the USB cable was connected to the computer and the remote control could unlock the aircraft. The current version 4.5, when connected to the computer via USB, cannot be unlocked by default and prompts an MSP exception.

5.7 [Resolved] RESCURE_SW is abnormal and cannot be unlocked

If the GPS RTL function is configured, but the remote control is unlocked when the switch is switched to the RTL function, this exception will be reported. The GPS RTL function needs to be turned off by default and then unlocked.

5.8 [Resolved] LED Strip function cannot be used

Reason: Testing and using the LED stripe function.
Actual measurement: I don’t know how to operate it. After guidance, I just follow the following sequence to operate and set it up.
Official link: betaflight

5.9 [Resolved] Tramp switching VTX parameter is invalid

Perform BF configuration according to the following table provided by the official website JHEMCU RuiBet Tran-3016W 5.8GHZ 1.6W

  • Download JHEMCU RuiBet Tran-3016W 5.8GHZ 1.6W json file


The actual effect is that it is impossible to accurately switch to the option specified in the OSD menu. For example: when switching to the R8 frequency point, the signal is actually strongest at F7; and the R8 image distortion is not abnormal; but the R8 frequency point is displayed on the OSD; after restarting BF, enter The menu does not display any frequency band or channel information; R8 is generally displayed at the top of the menu, while the actual signal is at F7.

Feedback from the manufacturer’s technical support:

  • Short press to adjust the channel (corresponding to the blue light, 1-8, 8 times in total)
  • Press and hold for 2 seconds to adjust the group (corresponding to the green light, A-B-E-F-R, 5 times in total)
  • Press and hold for 5 seconds to adjust the power (corresponding to the red light, 25-200-400-800-1.6W, 5 times in total)
  • Press and hold for more than 10 seconds to open 11 banned USA channels.
  • By default, prohibited USA channels are not output: 5705, 5685, 5665, 5885, 5905, 5880, 5658, 5695, 5732, 5880, 5917

5.10 [Resolved] GPS chip not found

Upon inspection

  1. The magnetometer was found, proving that the 5V power supply is normal.
  2. The serial port connection is correct: GPS_TX ==> FC_RX, GPS_RX? FC_TX

But the BF configuration software cannot display GPS related information.

Tear it down and finally locate the problem. There is a problem with the GPS module configuration and the GPS configuration needs to be reset.

6. Summary & amp; follow-up

At present, only the entire machine has been installed and initially configured. After two consecutive days of debugging, the above 10 problems have been relatively well solved.

The follow-up work mainly includes:

1) betaflight test flight
2) inav test flight
3) Try PX4 for test flight

Friends who are interested, please comment and like! ! !

【1】Betaflight 4.5 + Aocoda-RC F405V2 + AT32F435 Mark4 preliminary test flight summary
【2】ATFlight 4.3.2 + Aocoda-RC F405V2 + AT32F435 Mark4 test flight follow-up

7. Reference materials

【1】A brief introduction to four-axis flight control DIY
【2】Four-axis flight control DIY debugging and take-off concise steps
【3】Four-axis flight control DIY Mark4 – shock absorption
【4】Four-axis flight control DIY Mark4 – RTH/GPS Rescue
【5】Four-axis flight control DIY Mark4 – finishing & parameter optimization