SD card memory use
-
- Posts: 58
- Joined: Mon Mar 26, 2018 7:57 pm
SD card memory use
Is it possible to cut the 27K required for the SD card to function to a more reasonable level when all you need is one file open!
I wrote a FAT32 driver years back that handled many files and used under 2K, a couple 512 byte buffers and some overhead....
Thanks!
RichardS
I wrote a FAT32 driver years back that handled many files and used under 2K, a couple 512 byte buffers and some overhead....
Thanks!
RichardS
Re: SD card memory use
By default, sd_card example in IDF uses 27K as you have mentioned.
First of all, if you only need 1 file and not 5 files open at the same time, you can modify ".max_files = 5" to ".max_files = 1" in the example source code.
Next, if you are not using wear_levelling library in your application, you can go into menuconfig > Component config > Wear levelling and change sector size from 4096 bytes to 512 bytes. Then FATFS will only support 512-byte sectors, which will reduce size of scratch buffers in FATFS library.
With these two changes the example will use around 3K or heap.
First of all, if you only need 1 file and not 5 files open at the same time, you can modify ".max_files = 5" to ".max_files = 1" in the example source code.
Next, if you are not using wear_levelling library in your application, you can go into menuconfig > Component config > Wear levelling and change sector size from 4096 bytes to 512 bytes. Then FATFS will only support 512-byte sectors, which will reduce size of scratch buffers in FATFS library.
With these two changes the example will use around 3K or heap.
-
- Posts: 58
- Joined: Mon Mar 26, 2018 7:57 pm
Re: SD card memory use
I think this does not work if its Arduino IDE related, I find no reference in any files to change.... I will keep looking, let me know if this does work with Arduino IDE.ESP_igrr wrote:By default, sd_card example in IDF uses 27K as you have mentioned.
First of all, if you only need 1 file and not 5 files open at the same time, you can modify ".max_files = 5" to ".max_files = 1" in the example source code.
Next, if you are not using wear_levelling library in your application, you can go into menuconfig > Component config > Wear levelling and change sector size from 4096 bytes to 512 bytes. Then FATFS will only support 512-byte sectors, which will reduce size of scratch buffers in FATFS library.
With these two changes the example will use around 3K or heap.
RichardS
Re: SD card memory use
Sorry, i didn't notice that this was posted on Arduino forum. Number of files seems to be hardcoded in Arduino: https://github.com/espressif/arduino-es ... MC.cpp#L56. Suggest opening an issue in arduino-esp32 repository, requesting to make the number of files parameter configurable.
-
- Posts: 58
- Joined: Mon Mar 26, 2018 7:57 pm
Re: SD card memory use
And that seems to only be in the SD_MMC lib, I am using SD lib and accessing over SPI....
I have a large project and am out of memory, hence the issue....
Whats the status of WROVER and the extra PSRAM?? Has that been worked into Arduino IDE?
RichardS
I have a large project and am out of memory, hence the issue....
Whats the status of WROVER and the extra PSRAM?? Has that been worked into Arduino IDE?
RichardS
Re: SD card memory use
Yes, AFAIK the upcoming Arduino update should include PSRAM support.
-
- Posts: 58
- Joined: Mon Mar 26, 2018 7:57 pm
Re: SD card memory use
When might that be ??
Re: SD card memory use
There is no firm date set for that, as there are still a few moving parts which need to be fixed before the release. But this is likely a matter of a few weeks.
-
- Posts: 58
- Joined: Mon Mar 26, 2018 7:57 pm
Re: SD card memory use
OK let me know, I could test for you guys also, I have a fairly large project right now running out of RAM!
I need to get my hands on some WROVERS however, I should use the also the 16MBytes versions, Arduino supports the larger flash too?
RichardS
I need to get my hands on some WROVERS however, I should use the also the 16MBytes versions, Arduino supports the larger flash too?
RichardS
Re: SD card memory use
This example
https://github.com/espressif/esp-idf/bl ... ple_main.c
uses allocation_unit_size . Does this allocation happens using malloc on internal RAM.
How can I configure SD card to use external RAM for allocation?
https://github.com/espressif/esp-idf/bl ... ple_main.c
uses allocation_unit_size . Does this allocation happens using malloc on internal RAM.
How can I configure SD card to use external RAM for allocation?
Who is online
Users browsing this forum: Bing [Bot] and 68 guests