SD card read/write on Pixhawk 4

Hello everyone,

I am trying to provide my own startup config to Pixhawk 4. For that I have created a file on SD card in etc/rc.txt .
The problem I am having is, when I list /fs/microsd in nsh I can’t see the folder ‘etc’.
Simillally I don’t see any px4 files in PC, when I plug in the SD card externally.

Is there any way to check if SD card is mounted or not?

Thanks for the help.

1 Like

Are you starting the Pixhawk with SD card already inserted? Is it FAT32 formatted?

To check in nsh make sure to check the NuttX commands.

And note that the “PX4 files” won’t show up as they are baked into the binary as ROMFS and they are not on the MicroSD card.

First of all. Thank you for answering.
Yes, the microSD card is already inserted and has FAT32 format.

What I don’t understand is, why I don’t I see neither the created folder ‘etc’ nor the copied file ‘etc/rc.txt’ when use ls /fs/microsd.
However I do see them on the PC. That’s why I think, that I am missing some steps to include newly created folders and files on the SDcard on the nuttx file system.

And are you sure the card is mounted correctly? You should be able to check it using mount and df.

you are right. It is not mounted automatically on boot. But now if I try to mount it with '“mount -t vfat /dev/mmcsd0 /fs/microsd”.Reply:No such device.!!!

Check your available devices using ls /dev. Have you done any changes to the firmware? And what version have you flashed? Have you tried latest master?

I am able to see mmcsd0 in the list of /dev. As for firmware I am using version 1.6.5 not the latest master. As we need to port our own control algoritham from matlab(with the help of support package PSP). And test it on a VTOL UAV.

My guess is that 1.6.5 doesn’t properly support Pixhawk 4 yet and you need to move to a newer release.

could you point me in the direction, what would be the steps if I want to add microSD support on old firmware?
Another question off topic , I can’t seem to find any kind of serial mapping(ttySx->Port name/HW lable) for Pixhawk4 on the website.
Do you know where I could find it?for example for pixhawk fmu2:see photo.

You would have to go throught the merged pull requests or diff, I wouldn’t know.

I don’t know where to find these mappings. @david_s5 could you help?

@aman.kothari

Can you capture the boot test from the console? That will help diagnose this but I do not recall when the F7 support was added, I do know it became functional in later releases.

There are many changes from 1.9 (master) back 1.6.5 to nuttx and the PX4 system. I would advise that porting the application code to 1.9 is correct approach and less effort than backporting the FMUv5 and Nuttx changes.

1 Like