Issue retrieving data flash logs from pixhawk (arduplane)

I have been trying to get data flash logs off my pixhawk and am encountering issues. If I flash the default arduplane onto the pixhawk from mission planner-initial setup-install firmware, when I connect the pixhawk to mission planner and go to retrieve the data flash logs they do appear and are able to be downloaded. As soon as I load my code onto the pixhawk (using GIT Bash and px4 console) I run into problems. I turn on the pixhawk (unconnected to mission planner) and get the pixy camera to respond to a red ball I move in and out of sight. I then turn off the pixhawk and connect it to mission planner. When I go to retrieve the data flash logs I get an error saying:

Error:System.TimeoutException: Timeout on read - GetLogEntry at MissionPlanner.MAVLinkInterface.GetLogEntry(UInt16 startno, UInt16 endno) in C:\Users\michael\Source\Repos\MissionPlanner\Mavlink\MAVLinkInterface.cs:line 4565
at MissionPlanner.MAVLinkInterface.GetLogList() in C:\Users\michael\Source\Repos\MissionPlanner\Mavlink\MAVLinkInterface.cs:line 4505
at MissionPlanner.Log.LogDownloadMavLink.b__12_0() in C:\Users\michael\Source\Repos\MissionPlanner\Log\LogDownloadMavLink.cs:line 9

How do I avoid this error and get data flash logs from the board when it is using my code. I am carrying on a project and I know that the code works fine, I am able to upload it etc, but I need to be able to log it to move forward.

Thank you

If anyone knows a more exact cause for this error, please post below and ignore my info.

[My recommendation]

It seems to me that the error could come from two possible areas:

  1. Your code doesn’t generate proper logs, or
  2. Something about uploading the firmware via GIT Bash + px4 console is causing a problem.

To determine which it is, could you try uploading the same firmware that is known to work (via Mission Planner) using your GIT Bash + px4 console and see the error is observed?

[My thinking is that:]
If the error is seen, then we need to figure out what’s wrong with the upload procedure. If the error is not seen, then there’s something wrong with how your code generates logs, and we can’t help unless we have your code. Does this make sense?

I’m going out on a limb here but I’m going to say your code broke it. However, we’re all totally guessing unless you show us your code changes.

Hi hi,
Thanks for getting back to me. It took a while to compile the other code the way that I’ve been uploading mine. News is that it does work so it must be a problem with my code. Unfortunately it’s a project that has been passed on between groups for the last few years, so I have pretty much no way of knowing where the bug is but I seem to have found a hack, where if I collect data while using my code, then flash the clean version onto the pixhawk the logs from my code do appear as previous logs. Unless there is a likely cause of this issue I imagine I will have to proceed like this.
Thank you!

Is your plane armed when you try to retrieve the logs? I saw the same error message when I tried downloading logs and found that once I disarm the plane I am able to download logs.