SD card read/write on Pixhawk 4

#1

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.

#2

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.

#3

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.

#4

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

#5

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.!!!

#6

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?

#7

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.

#8

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

#9

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.

#10

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?

#11

@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