USB Disk with CubeMX and STM32F4-Discovery
I have been struggling to set up CubeMX to be able to read and write to a USB memory stick for STM32F4-Discovery board, similarly to what is done in the example from the repository (Repository\STM32Cube_FW_F4_V1.13.0\Projects\STM32F4-Discovery\Applications\FatFs\FatFs_USBDisk). This example from ST is working perfectly.
My setup procedure is as follows:- Set RCC to High Speed Clock (HSE) with Crystal/Ceramic resonator
- Change the clock configuration to HSE, M=4,N=x168,P=2, Q=7, so that PLL clock is 48 MHz
- Set USB_OTG_FS to Host_Only with Activate_VBUS
- Set USB_Host to Mass Storage Host Class
- Set FATFS to USB Disc
- Set USB_Host configuration, Platform settings MSC_FS, Drive_VBUS_FS to GPIO:Output through PC0.
After generating the code I &sharpinclude the fatfs.h in usb_host.c in order to be able to use the functions defined, similarly to what is done in main.c for the original example. Next the private variables (FATFS USBDISKFatFs etc) and the ''MSC_Application'' function is added to the code. I call this function in USBH_UserProcess for the case HOST_USER_CONNECTION. Last I add the red LED to be activated in USB_Error_Handler.
What am I doing wrong? Am I missing any additional settings or code? Please help, as I would like to base most of my upcoming work on the use of CubeMX. #!cubemx #!usb-msc #!stm32f4discovery