2026-05-13 11:48 PM
I am using STM32CubeMX 6.16.1 to configure a project for STM32F415.
I use the FATFS on SD card and set it up as:
According to FATFS documentation (https://elm-chan.org/fsw/ff/doc/config.html#lfn_unicode), the data type TCHAR should translate to char in this case. However, CubeMX generates Middlewares/Third_Party/FatFs/src/ff.h in which TCHAR is defined as WCHAR, i.e. a 16-bit type:
The _STRF_ENCODE is correctly defined as 3 in FATFS/Target/ffconf.h, which corresponds to UTF-8:
Is this a bug? How can I ensure that UTF-8 uses the 8-bit data type correctly?