Hello, I’m trying to design a autopilot system with my specific requirement, so I cannot use Pixhawk autopilot and have to design PCB on my own.
Before my PCB is ready I want to try to install PX4 to a homemade STM32F4 system so I brought a STM32F407ZG minimum system like this
There is no peripheral on the minimum system because I only want to check if it is possible to install PX4 to my own system.
I searched the Internet and found some tutorials about installing PX4 to STM32F4 discovery board, so my attemption was basically based on the STM32F4 discovery target. There is a problem that on my minimum system the crystal is 25 MHz while it is 8 MHz for the discovery board.
I first cloned the bootloader repo, edited the TARGET_HW_PX4_DISCOVERY_V1
part, changing OSC_FREQ
from 8 to 25, and changed USBDEVICESTRING
as “PX4 BL DISCOVERY MODIFIED”. I flashed px4discovery_bl/px4discovery_bl.bin
file to 0x08000000
address, and then connected the minimum system to my laptop with the micro USB port on it. Then I can see
Bus 020 Device 013: ID 26ac:0001 26ac PX4 BL DISCOVERY MODIFIED Serial: 0
with lsusb
. So does this mean that I have successfully flashed bootloader to the minimum system?
Then, I have problem compiling and flashing the firmware. The first problem is, I cannot find px4fmu-stm32discovery_default
target in the v1.9.0 tag. So I switched to v1.7.0. Due to the crystal issue, I edited these two files:
firmware/nuttx-configs/px4-stm32discovery/include/board.h
firmware/platforms/nuttx/Nuttx/nuttx/configs/stm32f4discovery/include/board.h
by changing STM32_BOARD_XTAL
from 8000000ul
to 25000000ul
, and changing STM32_PLLCFG_PLLM
to 25.
I tried to use QGroundControl to flash the PX4 firmware. The QGC recognized my minimum system as:
Found device: Omnibus F4 SD
Connected to bootloader:
Version: 5
Board ID: 99
Flash size: 1032192
I selected “Custom firmware file…” and flashed px4-stm32f4discovery_default.px4
. The output seems normal:
Downloading firmware...
From: /Users/*****/WorkSpace/PX4-dev/firmware/build/px4-stm32f4discovery_default/px4-stm32f4discovery_default.px4
Download complete
MAV_AUTOPILOT = 12
Successfully decompressed parameter_xml
Successfully decompressed airframe_xml
Successfully decompressed image
Erasing previous program...
Erase complete
Programming new version...
Program complete
Verifying program...
Verify complete
Upgrade complete
--------------------------
But QGC does not recognize the board after uploading firmware. It does not respond when connecting the minimum system to laptop via USB. And this time, the output of lsusb
is
Bus 020 Device 032: ID 26ac:0001 26ac PX4 DISCOVERY Serial: 0
(remember I changed the device string to “PX4 BL DISCOVERY MODIFIED” in bootloader).
That’s all I have done. What should I do to correctly install PX4 to my homemade hardware system?