Hi guys! I want to configure my Nucleo board to use USB Host for pendrive and HID (keyboard). I'm creating a project using STM32CubeMX. When I set USB_HOST -> Host supporting ALL classes, I can't select FATFS -> USB Stick (checkbox is disabled). I'm attaching a screenshot below. How can I configure this functionality?
:'Developing Applications on STM32Cube with FatFs'provides a description of how to use the STM32Cube firmware components with a generic FAT File System (FatFs).
Host supporting ALL classes you must define the user_diskio.cfile yourself.
1) Generate the project as
USB_HOST ->Mass Storage Host Class &
FATFS -> USB Stick
, then open the project and look at the file usbh_diskio.c in the Middlewares/FatFs folder. Copy/Save the file for later.
2) Regenerate the project as
USB_HOST -> Host supporting ALL classes &FATFS -> User Defined, then open the project and look at the file user_diskio.c in the Application/User folder.
For your information, that bug was fixed in 4.20 release (see in release notes: 409983 [USB Host All classes] : FATFS USB Disk must be available when selecting USB Host All Classes).
It should be ok now if you use CubeMx v4.20 (let us know otherwise if you still face troubles).
The solution suggested by Yonathan is, any way, the workaround to put in place, in case such kind of issue (a mode wrongly disabled on FatFS side) blocks you in your project.