2016-12-09 04:47 AM
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?
#stm32 #hid #usb-host #stm32cubemx2016-12-09 06:56 AM
Dear
yellowbit
USB Disk is based on USB Host Mass Storage Class (MSC).
S
et USB_HOST to
Mass Storage Host Class, this will enable FATFS: USBDisk.
These user manualshelp you inthis topicto havemoreideaabout
which
functions FatFS needs integrating for USB Disk:-
:'Developing Applications on STM32Cube with FatFs'provides a description of how to use the STM32Cube firmware components with a generic FAT File System (FatFs).-
User manual STM32Cube USB host library-
http://www.st.com/en/embedded-software/stsw-stm32html
User manual STM32F105xx, STM32F107xx, STM32F2xx and STM32F4xx USB On-The-Go host and device library.I suggest you have a look to the
FatFs
example within your firmware package to develop yourapplication using most of the functions offered by FatFs.Hope this help you.
Best Regards
-Imen-
2017-03-31 10:44 AM
Hey
Pociecha.Marcin
,When in USB_HOST->
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.
3) Finally modify the functions in user_diskio.c:
DSTATUS USER_initialize (BYTE pdrv);
DSTATUS USER_status (BYTE pdrv); DRESULT USER_read (BYTE pdrv, BYTE *buff, DWORD sector, UINT count);so that they work the same way the functions in usbh_diskio.c:
DSTATUS USBH_initialize (BYTE);
DSTATUS USBH_status (BYTE); DRESULT USBH_read (BYTE, BYTE*, DWORD, UINT);2017-04-03 05:13 AM
Hi Marcin,
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.
Regards
Fred