Large logs in the sd are deleted , after turning off and on the drone again

Hello everyone , I’ve been experiencing a specific problem for a while now and I don’t know if this might be due to a set of parameters I have to set or limitations of ardupilot . You can also try my setup to see your results.

My test was done by activating only these two values in the LOG_BITMASK: IMU , PID
Flying for about 15 minutes , the log reached a size of about 20 mb . By connecting with the usb to the drone WITHOUT turning it off , I can see the log and download it .
After I turn off the drone and turn it back on and reconnect with Mission Planner , the log size became (0) .

When instead I generate a low log size 1-9 mb this event does not happen .

What could be ?

Thanks all for the help

What flight controller are you using ?

I am using a drone that is based on a STM32 FC ,
i am using a 32 gb sd card

There are more than three dozen stm32 based FC’s. Exactly what FC are you using ?

STM32H743 That’s the one i’m using

CubeOrange? CUAV ? MatekSys ?

Did you tried remove the sd card and check if the files are indeed there ?

It’s a custom drone ,
I am using a solid state SD , so I cannot remove it and verify the file , unfortunately .

What happens very simply , is that logs between 10 and 20mb in size , and I assume even larger than 20mb , are deleted from the sd card after turning the drone off and on again .
The sd card works perfectly , since the logs are saved normally and remain saved after turning off and on the drone , but only if under a certain size

This is a screenshot i made while ago

after the flight with the drone still on , I connected it to Mission Planner and checked the log , the log is present:

After turning the drone off and on again , a log is present but of size 0

That is unfortunate, if it is a custom drone with a custom firmware, there are no way to find out remotely what happening.

AP deletes the last log if there are less than LOG_FILE_MB_FREE megabytes free space is on the storage.
Either this parameter is wrong or your solid state storage wrongly report free space…

Thank you very much for the help I appreciate it , you are absolutely right with a custom drone , it is complicated to understand the problem .
For the record the LOG_FILE_MB_FREE parameter is set to 500

try to set log_file_free_mb it to zero this will disable free space based file deletion at bootup.

1 Like

If it seemingly works, then note that this will not solve the problem, just mask it.
In this case the root cause is that the storage wrongly reports free space.

The drone is collecting the log ,as soon as it is finished I will report the result to you .
I understand what you mean ,
the AP believes that the sd card has less available space than the LOG_FILE_MB_FREE parameter and therefore deletes the last log

Mm , now with a log of 11mb , it seems to have remained in the sd card even after shutting down . Now I will try to get a log of at least 20mb to confirm .

Yep , seems to have solved the problem . With a 20mb log , it remained even after turning the drone off and on again .
So somehow the sd incorrectly reports its total size to the AP