cancel
Showing results for 
Search instead for 
Did you mean: 

Fatfs Unicode

jdcowpland
Associate II
Posted on January 19, 2015 at 10:57

Hi Guys,

I previously had code working with Fatfs and I had LFN enabled but LFN_Unicode disabled. I now want to start using Unicode, but after enabling it in the ffconf.h file, my fat functions return FR_NOT_READY after mounting. Is there anything else I need to enable?
3 REPLIES 3
Posted on January 19, 2015 at 11:21

Hi,

Enabling LFN feature and set _LFN_UNICODE to 1 in order to switch the character encoding on the FatFs API (TCHAR) to Unicode, may affect the behavior of string I/O.

Thus, Unicode handling functions ff_convert() and ff_wtoupper() functions must be added to the project.

Note that, the LFN working buffer occupies (_MAX_LFN + 1) * 2 bytes. When use stack for the working buffer, take care on stack overflow. When use heap memory for the working buffer, memory management functions, ff_memalloc() and ff_memfree(), must be added to the project. 

Please consider if you have a stack issue.

Regards,

Heisenberg.

jdcowpland
Associate II
Posted on January 19, 2015 at 11:38

Already got both wtoupper and convert functions in, and my stack is pretty big so don't think that is the issue. I noticed the fatfs documentation makes mention of putting an L before the filename string, or a _T(), but I don't quite understand the circumstances for using them. Could that be the issue?

jdcowpland
Associate II
Posted on January 20, 2015 at 10:59

I've managed to get rid of the FR_NOT_READY error by using the first of my fat volumes instead of the second one. I'm trying to create a folder called CONFIG on my SD card now, but the characters are coming out in Chinese or something. I've got the code page set to 1252 so I don't understand why it's happening. Anyone got any ideas?