cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F411 USB MSC (host) OTG flash drive problem

ASchu.4
Associate II

Hi,

Im developing a logger device with STM32F411CC processor. I use the latest Cube, DFP, Keil etc. I would like to use the USB to log datas to a flash drive. I developed a prototype software with an older usb msc host example and it worked on a F4 discovery board.

Now i have the new hardware and i have several questions.

The newest generated code's strusture was a bit different from the old one but it won't the problem.

  1. If i use an I2C device to enable the OTG voltage the cube won't generate it in the init section(won't call the MX_I2C1_Init()). - OK FIXED
  2. Misstyped comment on MX_DriverVbusFS() function, 1 parameter should have a meaning to switch on the USB voltage. The code call it at start with TRUE(1) parameter, but comment shows: 1 : VBUS Inactive - OK FIXED
  3. After several tries to log the file (what was worked in the old code with 407) something is changed in the USBH_UserProcess() function. Now its only working when i call the writeout in READY state (at the past worked in START state) - OK its not a problem its logical.
  4. After everything is working fine i just realised if i disconnect and connect back the flash drive several times it freezes down. After 7-8 tries. Sometimes it recovers back in a long time, but the driver switch off the VUSB voltage and doesn't switch it back! How can i fix it? I added some vusb forcing code(it tries to switch back the VUSB after a second) and it works better, but i think the problem is not this.
  5. When i have to use reenumeration?

Thanks a lot!

Bests

Attila

3 REPLIES 3
ASchu.4
Associate II

SW is stucking in HOST_USER_UNRECOVERED_ERROR:

 case CTRL_ERROR:

  /*

  After a halt condition is encountered or an error is detected by the

  host, a control endpoint is allowed to recover by accepting the next Setup

  PID; i.e., recovery actions via some other pipe are not required for control

  endpoints. For the Default Control Pipe, a device reset will ultimately be

  required to clear the halt or error condition if the next Setup PID is not

  accepted.

  */

  if (++ phost->Control.errorcount <= USBH_MAX_ERROR_COUNT)

  {

   /* try to recover control */

   USBH_LL_Stop(phost);

   /* Do the transmission again, starting from SETUP Packet */

   phost->Control.state = CTRL_SETUP;

   phost->RequestState = CMD_SEND;

  }

  else

  {

   phost->pUser(phost, HOST_USER_UNRECOVERED_ERROR);

   phost->Control.errorcount = 0U;

   USBH_ErrLog("Control error");

   status = USBH_FAIL;

  }

  break;

ASchu.4
Associate II

Sorry my fault, the texas battery charger and OTG power management IC has a WDT inside it (with default 40sec reset time) disable it solved the half of the problems. Still stucked in HOST_USER_UNRECOVERED_ERROR sometimes. Replug the flash drive fixes the problem, but can i solve it by SW?

SKrau
Associate II

have the same problem with a F746 did you fixed it?