Hello community! I'm working on a project with the LPCXpresso55S16 microcontroller and I'm using the Littelfs project for managing data storage in the flash memory. I would like to know if anyone has experience with creating, writing, and reading data using Littelfs on this specific microcontroller. Could you share an example or provide any guidance on how to accomplish this? Any help would be greatly appreciated. Thank you!
Ahmed,
@ahmed007, you are welcome, and thanks for your kind words :-).
Just in case: I wrote up an article explaining how to use LittleFS with the internal FLASH memory, using an example project (LPC55S16 in that case):
https://mcuoneclipse.com/2023/07/04/littlefs-file-system-with-mcu-internal-flash-memory/
Dear @ErichStyger ,
I wanted to express my sincere gratitude for your support. I read the article showcasing your impressive work, and I must say, your value is truly remarkable. Thank you for your exceptional contributions.
Best regards,
Ahmed Bouzid
Hi @ahmed007 ,
yes, we used LittleFS with the LPC55S16 in different projects (one I have described in https://mcuoneclipse.com/2021/12/30/lorawan-with-nxp-lpc55s16-and-arm-cortex-m33/). For space (data amount) reasons we mostly used an external flash device (Winbond in that case) with it, but we used as well MinINI and LittleFS usint the internal FLASH memory for others.
The Flash memory of the LPC55x is somewhat 'special', but we have covered that with the McuFlash module in these projects which works for other devices too. The McuFlash module implements the block device used by all the different file systems (MinINI, LittleFS, FatFS (https://mcuoneclipse.com/2021/05/15/using-fatfs-and-minini-with-the-nxp-lpc55s16-evk/)) we are using.
I recommend you have a look at the above article/projects (link to Github is in the article).
I hope this helps,
Erich
Hi @ErichStyger ,
I want to express my gratitude for your tremendous support. After carefully studying and attempting the example you provided, I regret to inform you that the code did not successfully mount the LittleFS on the LPCXpresso55S16. Unfortunately, I encountered the same error as in my previous code.
The issue arises when the lfs_mount function returns a result of -84. This particular result is derived from the following line of code:
lfs_stag_t tag = lfs_dir_fetchmatch(lfs, &dir, dir.tail, LFS_MKTAG(0x7ff, 0x3ff, 0), LFS_MKTAG(LFS_TYPE_SUPERBLOCK, 0, 8), NULL, lfs_dir_find_match, &(struct lfs_dir_find_match){ lfs, "littlefs", 8});
Upon debugging, I discovered that the generated tag inside the above function is considered invalid, leading to the function returning -84. This invalidity is caused by a corrupted directory pair.
To provide further context, I have shared my code at the following GitHub link: https://github.com/ahmedbouzid07/littlefs_lpcxpresso55s16/tree/master/lpcxpresso55s16_flashiap1
I have removed multiple configuration files from your code, as I will solely be working with LPCXpresso55S16. Consequently, there is no need to utilize preprocessors, and I have also omitted the shell part.
If you have the time and willingness, I would greatly appreciate your assistance in finding a solution to this predicament.
Thank you very much for your valuable support.
Hi @ahmed007 ,
Just to check: have you tried my example 'as is' without modifications, as that works fine on my side.
Did you format your storage area first, as outlined in my terminal screenshot? Do not remove or change anything, unless you know what you are doing. The Shell support is there for a reason.
Just in case, I have attached you the binary files I'm using with my board/system.
I hope this helps,
Erich
Hi @ErichStyger
Another question, Could you give me how to open an interactive terminal with the board? Since I know how to open a serial terminal with the MCUXpresso IDE terminal feature. I tried to open a serial terminal with Putty and I choose the right COM but didn't succeed.
The LPC55S16 LinkServer debug firmware comes with a VCOM port. The application is using that UART to VCOM.
Hi @ErichStyger,
Are you talking about this example: https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples/MCUXpresso/LPC55S16-EVK/LPC55S16_Bl...
If so I think it uses FatFs and minINI and use LittleFS to program the SD card, not the on-chip flash.
Should I try first as it is?
Ahmed.
Hi @ahmed007 ,
short answer: yes.
longer answer: that example includes both FatFS (with SD card) and littleFS (using on-chip Flash). And yes, it supports as well MinINI for both.
Erich
Hi @ErichStyger ,
Thank you for being so supportive. I kindly request your guidance in locating the section where the short names of commands are defined and assigned to their respective functions.
Thank you in advance for your assistance.
Best regards, Ahmed
Hi @ahmed007 ,
I'm sorry, but I think I don't understand what you are talking about?
But just in case: you have all the source files and code, so you should be able to see how it works?
Erich
Hi @ErichStyger ,
For example, to list directory files or to write binaries to a file we used short commands like ls, or bincat, but these names are not function names, so I thought that we are assigned to this abbreviation like ls the function McuLFS_FileList. I make a small search if there is a file where you assign command names to function but I didn't find anything, that's what I am asking about.
Hello, Erich Styger!
I want to express my gratitude for your valuable support. I'm pleased to inform you that the example you provided is functioning smoothly on the board. The littlefs has been successfully mounted, allowing us to both write and read files.
I would like to inquire whether you suggest making modifications to your example to align with my specific requirements. In my project, I intend to automate the tasks and refrain from opening a UART terminal on the LPCXpresso. Therefore, it is essential for the file system to be mounted automatically.
Thank you once again for your assistance.
Best regards, Ahmed
Hi @ErichStyger
Actually, I did but I got multiple errors and one of them is in the McuLib.h returns that I have these files missed. I tried to locate them but I didn't find them.