cancel
Showing results for 
Search instead for 
Did you mean: 

FatFs in LFN Mode: I get always FR_NOT_ENOUGH_CORE on f_open()

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

4 REPLIES 4

Check heap size, especially Keil.

Still failing, track malloc() usage.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Hi @Community member​ 

Heap size looks ok. I have 22 kBytes left.

Regards

Dejan

Probably want the breakpoint code if ff.c throwing the error, or instrument malloc/free calls.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

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; }