cancel
Showing results for 
Search instead for 
Did you mean: 

Using USB-OTG in MSC_HOST mode

Anton Kiryukhin
Associate
Posted on June 28, 2018 at 09:47

Hello! I started working with

http://mikrocontroller.bplaced.net/wordpress/?page_id=383

. Apparently there are errors in it, since I can not connect to USB-Flash yet. I adapted this project STM32F105RCT6 microcontroller and corrected some mistakes, but now the program is stopped in an infinite loop in stm32_ub_usb_msc_host.c file:

USB_MSC_HOST_STATUS_t UB_USB_MSC_HOST_Do (void)

{

  if (USB_MSC_HOST_STATUS! = USB_MSC_DEV_NOT_SUPPORTED) {

    // when the USB stick is not supported,

    // function will not be called

    USBH_Process (& USB_OTG_Core, & USB_Host);

  }

  return (USB_MSC_HOST_STATUS);

}

In USBH_Process () function, the program waits for interrupt vector OTG_FS_IRQHandler. To convert the USB_MSC_HOST_STATUS variable to the USB_MSC_DEV_CONNECTED state. But there is no interruption. What could be the reason?

I placed main part of my project in

https://github.com/antonkiryukhin/USB-OTG-MSC-HOST

on Github. 

I would also like to clarify that the waiting for an interrupt occurs in this function, allocated to the bold font place.

void USBH_Process (USB_OTG_CORE_HANDLE * pdev, USBH_HOST * phost)

{

  volatile USBH_Status status = USBH_FAIL;

     switch (phost-> gState)

  {

  case HOST_ISSUE_CORE_RESET     

    if (HCD_ResetPort (pdev) == 0)

    {

      phost-> gState = HOST_IDLE;

    }

    break;

 case HOST_IDLE:

    if (HCD_IsDeviceConnected (pdev))

    {

      / * Wait for USB Connect Interrupt void USBH_ISR_Connected (void) * /

      USBH_DeAllocate_AllChannel (pdev);

      phost-> gState = HOST_DEV_ATTACHED;

    }

    break;
0 REPLIES 0