Getting px4fmu firmware onto discovery board

Hi all,

I am new to this whole embedded systems thing, but have been more or less thrown into a uni project which is aimed towards the miniaturisation of the PixHawk. I have a discovery board with the STM32 m4 processor for the purpose of testing hardware modifications, and I am attempting to upload the px4fmu onto it. I was successfully able to flash the discovery bootloader and upload the discovery firmware - however I am now attempting to do the same with the px4fmu bootloader/firmware but to no avail.

I realise the answer might be obvious, but I would like to know whether it is possible to get the px4fmu firmware working on a discovery board, and how I should approach it.

@Tug_Goat: What Discovery board are you using? Is it the Discovery board with the STM32F407 chip on it? Did you do the following?

  • For the bootloader (I assume you have downloaded the Px4/Bootloader repository):
make px4discovery_bl
  • And for the main firmware (Px4/Firmware repository):
make px4-stm32f4discovery_default
  • The NSH console is set up on UART2 (PA2 and PA3) by default (no USB console for the STM32F4Discovery compilation, although you can set that up if you want).

Are you now just trying to compile the Px4FMU bootloader (make px4fmu_bl) and flash that onto the board? This won’t work, because you will have a clock configuration problem. The STM32F4Discovery board uses an 8MHz crystal and the Px4FMUs (all versions thereof) use a 24MHz crystal. If you flash the Px4FMU bootloader onto the discovery board, it will try and configure its peripherals thinking it is running off of a 24MHz crystal, when it actually has an 8MHz crystal. The USB will definitely not work, because that needs a fairly accurate 48MHz peripheral clock to be running. So if you are running the whole system off of an 8MHz crystal, your USB will be ticking over at +/-16MHz. You should also notice that the LED is flashing much slower than usual.

You will have the same problem if you flash the Px4FMU firmware directly onto the Discovery board using the ST-Link. When the main firmware starts up it will try and configure its clock thinking it is running off of a 24MHz crystal.

If you want to compile in the modules that are running on the Px4FMU on the on the discovery board, then you can simply add them to the CMake file for the STM32Discovery compilation: Firmware/cmake/configs/nuttx_px4-stm32f4discovery_default.cmake.

Please be aware that if you are going to be setting up external sensors to run on your Discovery board, you will have to set up the pins correctly in the STM32F4Discovery compilation, so that the NuttX OS knows how to configure them on start up. If you need to do this, let me know and I can give you some pointers.

Okay that makes sense, thanks so much for the explanation! Yeah it is the STM32F407, I had no issues with uploading the discovery firmware, just with the Px4FMU firmware - but by the sounds of it this is to be expected.

I will have a try at getting an external IMU working through the discovery board / firmware as you suggested, but any pointers would be much appreciated. This is my first time working with a RTOS and make files and such, so there’s a steep learning curve involved :sweat_smile:

Thanks!