FatFs in LFN Mode: I get always FR_NOT_ENOUGH_CORE on f_open()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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
- Labels:
-
FatFS
-
STM32CubeMX
-
STM32F7 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2020-09-03 11:37 PM
Check heap size, especially Keil.
Still failing, track malloc() usage.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2020-09-04 12:15 AM
Hi @Community member
Heap size looks ok. I have 22 kBytes left.
Regards
Dejan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2020-09-04 12:19 AM
Probably want the breakpoint code if ff.c throwing the error, or instrument malloc/free calls.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2020-09-04 1: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; }
