Porting px4 to system without sd card

I’m porting px4 to stm32f4-based board without sd card.
(the reason I exclude sd card is price and small size of my drone)

Is it possible run px4 in the system withoug sd card.
I read before that NuttX has pseudo-file system,
so I’m curious px4 can save parameter or log data(at least parameter to be needed to fly) in flash memory which also contains firmware.

Yes this can work fine. The main annoyance is not having on board logging or saving missions to the sdcard. If you have a companion computer you can still log over mavlink. Take a look at the intel aero in code base to see the differences.

1 Like

@elton-choi: I am not sure how you will set up the parameter system. Are you using an external flash chip to store the parameters and waypoints like on the Pixhawk, or will you be saving parameters in the STM32F4 flash?

The defconfig file for Nuttx (found in the nuttx-configs directory) is where you will need to configure the system to not have an SD card. It is also where you configure what initialisation rcS file should be run on startup.


You can change this line to whatever your individual rcS file is called.

1 Like

I will be saving parameters in the STM32F4 flash.

I’m not yet familiar with the px4 or NuttX concept, I’m quite confused.
I will ask a few questions to help myself.

In the host pc, there is ($px4_root)/ROMFS/px4fmu_common/init.d/rcS file.

If I edit this file and compile/upload, then parameters in this rcS file uploaded into STM32F4 flash with firmware?

But, while running fc board, if I change some parameter such as tuning value, just the value in rom flash changed? What about original value in rcS file on host pc?
When I compile and upload again, Original value in rcS file on host pc overwrites changed value?

But, When I tested above with pixracer, changed value always remained(not overwritten) after I compile and upload again.

I’m curious how parameters init.d/rcS uploaded into flash and synchronized the scripts on the host pc.

We support operation just in flash, but its not recommended. It locks the CPU while the flash is being written. This is a HW limitation of the F4. Have you considered using a cheap EEPROM instead?

1 Like

I haven’t.

Ok, I’ll consider using a EEPROM or I can use sd card only while development.

@elton-choi: The files in the ROMFS/px4fmu_common directory are compiled into a pseudo-file system in the firmware that will show up in the ‘/etc/’ directory in this pseudo file system. From the Pixhawk console, run ls and it will list the directories in the pseudo file system.

nsh> ls

You can cd into the etc/ directory. This is where you will find all of the files that were in ROMFS.px4fmu_common.

There is a module on the Pixhawk called mtd. If you run mtd start, it will start a driver for the EEPROM chip on the Pixhawk. This driver allows “file system access” to the “params” and “waypoints” stored on the EEPROM chip. After starting mtd, you can run ls /fs/. You will see the file system entries for the params and waypoints that have been created in the psuedo file system.

nsh> ls

The reason why you still have old parameters on your Pixhawk, despite the fact that you have changed the values in the rcS file, might be because the old parameters have been written to the external flash chip and are being reloaded each time you start the Pixhawk. If you look at the rcS file, you will find the following lines, which start the EEPROM driver and load the stored parameters from it

	# Load parameters
	set PARAM_FILE /fs/microsd/params
	if mtd start
		set PARAM_FILE /fs/mtd_params

	param select $PARAM_FILE
	if param load
		if param reset
1 Like

Thank you for your detail explanation.

I didn’t know pixhawk has a EEPROM chip.
I reviewed rcS file and I found it reads params from sd card first, and then read params from EEPROM(using mtd driver), as you told.

In summary, there are three options.

  1. use a sd card
  2. use a cheap eeprom (using mtd driver)
  3. use an internal flash memory with firmware. but it can be locked when params changed. (HW limitation of F4, not recommended)

Thank you all guys.

The schematics for the Pixhawk can be found here. The FRAM (EEPROM chip) is a FM25V01 which can be found on the first page of the schematics.

1 Like

I´m searching for years … using PX4 on a very small controller (20 mm) but they never offer SD slots micro OmnibusF4 boots PX4 but without saving settings like airframe. Is there an easy way to change the SD location to the fc´s eeprom within the source (most fc have a 8 mb eeprom)?
Further an additional way to store custom boot parameters to this eeprom would be needed as well.

or could there be already a PX4 supported 20 x 20mm fc with sd slot and baro/mag available ?
I wasn´t able to find it yet.

Hello i have stm32f7 and i don’t have problem with flash locking . but how can i do that how can i save configuration only in internal flash i don’t want logs or anything other than configurations in internal flash