Closed CCarito closed 1 month ago
Looks good, thanks!
Have you tested if this works? It looks like esp_vfs_fat_nand.h does not exist and there is no function called esp_vfs_fat_nand_mount. The closest thing I could find is esp_vfs_fat_spiflash_mount.
I have reverted the changes for now, but file_basepath is implemented in log.c now and used everywhere. That should make it easier to implement this driver if you want to give it another try.
My sincerest apologies for having omitted the instructions for adding dependencies to the project. The Espressif spi_nand_flash
library was recently created and should be added to the project using the following command:
idf.py add-dependency "espressif/spi_nand_flash^0.1.0"
Additionally, this library uses another dependency that should also be added:
idf.py add-dependency "espressif/dhara^0.1.0"
When adding these dependencies before building the project, a idf_component.yml
file will be automatically generated inside the main
folder, indicating that the project requires these dependencies. After this, the build
folder should be deleted and the following command should be executed:
idf.py build
Upon completing the build, you will see that a new folder called managed_components
has been generated in the project, containing the necessary .h
and .c
files for the library to function correctly.
NOTE: It is important not to omit the step of deleting the build
folder for everything to work correctly.
Ah, I had no idea about the ESP component registry :-) I will give it a try in the next days, looks very useful. The flash-chips seem quite convenient to use on custom hardware compared to SD-cards.
I have added the code back as well as the dependencies: https://github.com/vedderb/vesc_express/commit/6038762e04cdd5c04ccaf3994079d363233c4cc7
There is also an lbm-extension f-connect-nand that lets you load the driver on any pins on any hardware. Everything compiles, but I do not have any way to test it at the moment. Please let me know if it works!
Hi Benjamin,
First of all, I'd like to apologize for the delay.
Thank you for accepting the changes I made. I tested the new code, and everything works well except for the f-connect-nand function. After running it, the firmware hangs, and I need to erase and re-flash it.
Please let me know if you have any suggestions or if there's anything else you'd like me to check.
SPI NAND Flash
This pull request introduces code to the project to enable the use of NAND flash memory, providing non-volatile data storage. This addition is particularly beneficial for users looking for:
SPI Interface
The communication between the NAND flash memory and the microcontroller is carried out through the SPI protocol, which facilitates fast read and write operations and seamless integration.
Espressif
spi_nand_flash
LibraryThe presented code is based on the Espressif
spi_nand_flash
library and has been rigorously tested with read and write algorithms to ensure robust error handling. It offers functionalities equivalent to those of the SD card, with the exception of a minor issue related to thef-fatinfo
function.Compatibility with SPI NAND Flash Chips
The
spi_nand_flash
component is compatible with chips from the following manufacturers and models:A memory was used to verify the library: W25N01GVZ
Definition of spi pins
To use the functions, it is necessary to define the SPI pins and frequency in the device's .h file using the following predefined names, as they are used in the code:
// NAND-memory
define NAND_PIN_MOSI
define NAND_PIN_MISO
define NAND_PIN_SCK
define NAND_PIN_CS
define FLASH_FREQ_KHZ
Note
It is important to clarify that currently, both file systems cannot be used simultaneously; you must choose between the SD card or the NAND flash memory.