Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for logging via NAND flash #22490

Open
j-chen-opteran opened this issue Dec 5, 2023 · 11 comments
Open

Support for logging via NAND flash #22490

j-chen-opteran opened this issue Dec 5, 2023 · 11 comments

Comments

@j-chen-opteran
Copy link
Contributor

j-chen-opteran commented Dec 5, 2023

Describe problem solved by the proposed feature

  • Boards such as the KakuteH7 V2/H7 Mini have a Winbond W25N01GV NAND flash chip instead of a SD card slot
  • The small size of the H7 Mini as well as the beefy H743 MCU make it well suited for visual odometry and SLAM experimentation on micro-sized aircraft
  • PX4 currently has no provision to log flight data on these boards at all.
  • An alternative is MAVLink log streaming, however it struggles with high rate topics such as IMU data.
  • Doing some digging into the codebase shows that the logger uses Nuttx libraries to write to a SD card, and the version of NuttX PX4 uses doesn't seem to have an easy way to interface with NAND flash memory, nor is there any scope in future NuttX development to include this.

Describe your preferred solution

  • Not entirely sure of PX4's relationship with NuttX, but to do it elegantly I assume the RTOS needs a bit of work to have NAND memory IO implemented
  • This would be clean and separate duties between the flight control software and the RTOS, but unfortunately I lack the expertise to start working on this

Describe possible alternatives

Ardupilot contains a driver that uses the NAND flash chip over SPI:
https://github.com/ArduPilot/ardupilot/blob/c5b9f5051f997ec3f0f223380f912f5f51de641f/libraries/AP_Logger/AP_Logger_W25N01GV.cpp#L8
Something like this could be feasible.

Additional context

No response

@julianoes
Copy link
Contributor

First step would be to add it to NuttX, I think.

Right @davids5?

@davids5
Copy link
Member

davids5 commented Dec 6, 2023

@j-chen-opteran have a look at https://lists.apache.org/thread/kh5t6fn24q97d3qxzthksld4l3jtw27c and see if this offers any indication it has been worked on, or added.

@j-chen-opteran
Copy link
Contributor Author

j-chen-opteran commented Dec 6, 2023

Appreciate the quick replies! Did some digging in the direction @davids5 pointed. It appears NuttX itself has partial support for NAND flash and I'm happy to have a crack at implementing this.

However I see that PX4 submodules NuttX - this is a bit new to me and I'd like to start the right way. I assume code changes has to be done in the NuttX repo first?

Thanks

@davids5
Copy link
Member

davids5 commented Dec 7, 2023

@j-chen-opteran - the process can be done 2 ways, really in 2 differing orders.

  1. Do the work in PX4's NuttX, backporting to your branch what you might need from upstream and then upstreaming your work to NuttX and then Backporting all the commits needed to add the feature.

  2. Do the work in upstream and backport to PX4's NuttX then do your PX4 work on top of it.

In the end all the works should go upstream and get back ported.

@github-actions github-actions bot added the stale label Jan 7, 2024
@iftahnaf
Copy link

Hi @j-chen-opteran, are you working on this? I can try to help. I don't have a lot of experience in that field, but I'm eager to learn.

@sstroobants
Copy link

sstroobants commented Jul 4, 2024

Is anyone working on this? If I understand correctly, V1.3 of the KakuteH7 mini even has 1GBit/128Mb of NAND Flash, would be a shame to let that go to waste.

@julianoes
Copy link
Contributor

@sstroobants contributions welcome.

@sstroobants
Copy link

I would love to, but I'm afraid I lack the skills to develop something as embedded as this. If I find time I might try to see what is possible, but a first glance in the NuttX documentation makes me believe it has to be built from the ground up.

@sstroobants
Copy link

Again, I'd love for this to work and would want to spend some time on this. I do lack the skills to start on this however so if there is anyone that wants to help me with this, that'd be much appreciated.

@dagar
Copy link
Member

dagar commented Oct 1, 2024

@sstroobants it depends what actual hardware you're talking about, but potentially everything you need should be in place as of #23424.

@sstroobants
Copy link

@dagar thanks for the response. I am not exactly sure what you mean. The problem (I think), is support for NAND flash in NuttX and LittleFS which are both not (fully) implemented. Again, my knowledge on these low-level things is very limited so correct me if I'm wrong.
From what I understand, there needs to be a driver for the W25N01GV and also support on NuttX side to do this nicely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants