2022-05-16 08:47 AM
/* USER CODE END Header */
/* Includes ------------------------------------------------------------------*/
#include "usb_host.h"
#include "usbh_core.h"
#include "usbh_msc.h"
/* USER CODE BEGIN Includes */
#include "ff.h"
/* USER CODE END Includes */
/* USER CODE BEGIN PV */
/* Private variables ----------------------------
* -----------------------------*/
FATFS USBH_fatfs;
FIL MyFile;
FRESULT res;
uint8_t oktext = "USB mounted !";
uint8_t text = "USB not mounted !";
extern char USBHpath[];
extern UART_HandleTypeDef huart3;
/* USER CODE END PV */
/* USER CODE BEGIN PFP */
/* Private function prototypes -----------------------------------------------*/
/* USER CODE END PFP */
/* USB Host core handle declaration */
USBH_HandleTypeDef hUsbHostFS;
ApplicationTypeDef Appli_state = APPLICATION_IDLE;
/*
* -- Insert your variables declaration here --
*/
/* USER CODE BEGIN 0 */
void UserPr(void)
{
if(f_mount(&USBH_fatfs, USBHpath, 1) != FR_OK)
{
HAL_UART_Transmit(&huart3, text, sizeof(text), 100);
}
else
{
HAL_UART_Transmit(&huart3, oktext, sizeof(oktext), 100);
}
}
/* USER CODE END 0 */
Hii there, I am using STM32g0c1 and I am trying to mount USB pendrive. I followed some online tutorials but still I am not able to mount USB pendrive.
When I try to mount USB device it shows FR_DISK_ERR. Also, when I use f_mkfs it shows FR_NOT_ENABLED.
Can I get example code/project ?? It will be a good help.
Solved! Go to Solution.
2022-05-16 08:58 AM
Hello @jsoda.1
You can refer to the following example provided under the G0 Firmware Package:
I hope this helps.
BeST Regards,
Walid
2022-05-16 08:57 AM
Have you checked the USB host /MSC class example https://github.com/STMicroelectronics/STM32CubeG0/tree/master/Projects/STM32G0C1E-EV/Applications/USB_Host/MSC_Standalone ?
hth
KnarfB
2022-05-16 08:58 AM
Hello @jsoda.1
You can refer to the following example provided under the G0 Firmware Package:
I hope this helps.
BeST Regards,
Walid