cancel
Showing results for 
Search instead for 
Did you mean: 

Read file from USB flash drive with NUCLEO-F413ZH

NDewe.2
Associate II

Hi

I would like to read a file on a USB stick. But phost-> gState remains HOST_ABORT_STATE; (usbh_core.c) . The code was generated with STM32CubeMX.

USB_OTG_FS is set to Host_Only. Class for FS IP is set to Mass Storage Host Class in USB_HOST Mode and configuration.

board :

NUCLEO-F413ZH

clock settings :

 RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;

 RCC_OscInitStruct.HSIState = RCC_HSI_ON;

 RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;

 RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;

 RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;

 RCC_OscInitStruct.PLL.PLLM = 16;

 RCC_OscInitStruct.PLL.PLLN = 192;

 RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;

 RCC_OscInitStruct.PLL.PLLQ = 4;

 RCC_OscInitStruct.PLL.PLLR = 2;

ide:

Keil µVision V5.26.2.0

Thanks in advance

Kind regards

2 REPLIES 2
Pavel A.
Evangelist III

Please enable debug prints in the USB library (via CubeMX or manually somewhere in usb...conf.h) and fatfs.

-- pa

NDewe.2
Associate II

Hi

Thanks for the tip. Because of this I found out that Keil's debugger is wrong.

With debugging (USB library) enabled I see that the USB stick is recognized.

The debugger stops at phost-> gState = HOST_ABORT_STATE; (usbh_core.c), but this is not executed. In reality, phost-> gState has the value HOST_SET_CONFIGURATION. Which is the correct value.

Kind regards