2020-09-03 11:06 PM
Hi
I've configured FatFs for SD 4Bit Bus and using FreeRTOS. I've set USE_LFN = 3 (dynamic working buffer on the HEAP)
When I call f_open() it always returns FR_NOT_ENOUGH_CORE.
The SD card calls are made in a seperate Task.
When USE_LFN = 0 then all works well.
Did I forget to set something?
Regards
Dejan
2020-09-03 11:37 PM
Check heap size, especially Keil.
Still failing, track malloc() usage.
2020-09-04 12:15 AM
Hi @Community member
Heap size looks ok. I have 22 kBytes left.
Regards
Dejan
2020-09-04 12:19 AM
Probably want the breakpoint code if ff.c throwing the error, or instrument malloc/free calls.
2020-09-04 01:08 AM
It looks like the returned pointer to the allocated memory block of ff_memalloc is NULL.
INIT_NAMBUF(fs) is called in the f_open function.
It's defined in ff.c:
#define INIT_NAMBUF(fs) { lfn = ff_memalloc((_MAX_LFN+1)*2); if (!lfn) LEAVE_FF(fs, FR_NOT_ENOUGH_CORE); (fs)->lfnbuf = lfn; }