This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

STM32f429 discovery USB problem

Hello,

I have been trying to connect a memory stick to the STM32f429 discovery board through the micro USB connector. I am using the HS driver with FS onboard PHY. Afer the function call USBH_Initialize (0); debugging shows an message internal error and the debugging sesson closes. The Vbus light only flashess for half a second. No communication or even debugging is possible. The sofware used is:
-uVisionV5.0.5.15
-everything is cofigured through the Software components menu and RTE.h

Has anybody else had simmilar problems with Keil's USB driver not working on stm32f429?

Main function is shown bellow.

#include <stdio.h>                      /* Standard I/O .h-file               */
#include <ctype.h>                      /* Character functions                */
#include <string.h>                     /* String and memory functions        */

#include "cmsis_os.h"                   /* CMSIS RTOS definitions             */
#include "rl_fs.h"                      /* FileSystem definitions             */
#include "rl_usb.h"                     /* RL-USB function prototypes         */


void USBH_Thread (void const *arg) {
  osPriority priority;                        /* Thread priority              */
  char con    =  0;                           /* Connection status of MSCs    */
  char con_ex =  40;                          /* Previous connection status
                                                 + initial time in 100 ms
                                                 intervals for initial disp   */

  USBH_Initialize (0);                        /* Initialize USB Host 0        */
  //USBH_Initialize (1);                        /* Initialize USB Host 1        */

  while (1) {
    con = (((USBH_MSC_GetDeviceStatus(1) == usbOK) << 1) | (USBH_MSC_GetDeviceStatus(0) == usbOK)) & 3;
    if ((con ^ con_ex) & 3) {                 /* if connection changed        */
      priority = osThreadGetPriority (osThreadGetId());
      osThreadSetPriority (osThreadGetId(), osPriorityHigh);
      if ((con ^ con_ex) & 1) {
        if (con & 1) {                        /* if device 0 connected        */
          //con |= init_msd ("U0:");
          printf ("\nConnected Drive U0:\n");
        } else {                              /* if device 0 disconnected     */
          printf ("\nDisconnected Drive U0:\n");
        }
      }
      if ((con ^ con_ex) & 2) {
        if (con & 2) {                        /* if device 1 connected        */
          //con |= init_msd ("U1:");
          printf ("\nConnected Drive U1:\n");
        } else {                              /* if device 1 disconnected     */
          printf ("\nDisconnected Drive U1:\n");
        }
      }
      fflush (stdout);
      osThreadSetPriority (osThreadGetId(), priority);
      con_ex = con;
    } else if (con_ex > 3) {                  /* if initial time active       */
      con_ex -= 4;                            /* decrement initial time       */
      if ((con_ex <= 3) && (!con)) {          /* if initial time expired      */
        priority = osThreadGetPriority (osThreadGetId());
        osThreadSetPriority (osThreadGetId(), osPriorityHigh);
        printf ("\nNo drives connected ... \n");
        fflush (stdout);
        osThreadSetPriority (osThreadGetId(), priority);
        con_ex = con;
      } else {
        osDelay(400);
      }
    }
    osDelay(100);
  }
}
osThreadDef(USBH_Thread, osPriorityNormal, 1, NULL);

int main (void) {

  osThreadCreate (osThread(USBH_Thread), NULL);
        while(1){}
}

Thanks

0