STM32Cube framework provides very similar interface for FatFS as USB MSC we have seen before. Again the same argument applies to this case about the basic unit of read/write operation on a flash memory. In this case, the sector size and the cluster size should be equal to the sector size of flash memory, namely 4KB. This can be set in the file ffconf.h , in which a lot of customization can be done by changing the definitions. In particular, following definitions should be set. In the file user_diskio.c, USER_read and USER_write functions can be implemented as the same way as before. Here we assume that the count is always one for the simplicity. In reality this can be bigger than one if you call f_read() with the buffer size larger than the sector size (4096). However given the limited memory capacity, that is not realistic. By similar token, pdrv variable can be ignored. If ioctl is to be used, then FatFs allows users to not only read and write files but also to crea