cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 USB Host

AKh.1
Associate II

Hello all,

I Have tried to implement a code to use a USB to read and write the function as a logging process.

My code is running just fine, and it writes and reads just properly. The only problem is that the MX_USB_Host_Process() loop runs only once, whenever during a single run, the write and read, only once, while I need it to run over and over as it is going to be logger!

So, do you guys have any suggestions that how I can run this loop over and over? (I have put the MX_USB_Host_Process() inside a while loop, but the program does not do the "Application Ready" section in my code)

Any help would be appreciated!

Here are my Switch cases

static void USBH_UserProcess (USBH_HandleTypeDef *phost, uint8_t id)

{

 /* USER CODE BEGIN CALL_BACK_1 */

 switch(id)

 {

 case HOST_USER_SELECT_CONFIGURATION:

 break;

 case HOST_USER_DISCONNECTION:

 Appli_state = APPLICATION_DISCONNECT;

Unmount_USB();

 break;

 case HOST_USER_CLASS_ACTIVE:

 Appli_state = APPLICATION_READY;

HAL_GPIO_WritePin(led4_GPIO_Port, led4_Pin, GPIO_PIN_SET);

Mount_USB();

 Check_USB_Details(); // check space details

 Scan_USB ("/"); // Scan for files and directions

 Create_File ("/Alireza.txt");

 Write_File ("/Alireza.txt", "AAAAAAAAA\n" );

 Update_File ("/Alireza.txt", "OMG12345"\n");

 break;

 case HOST_USER_CONNECTION:

 Appli_state = APPLICATION_START;

 break;

 default:

 break;

 }

 /* USER CODE END CALL_BACK_1 */

}

0 REPLIES 0