STM32F411 USB MSC (host) OTG flash drive problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-06-19 9:02 AM
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.
- 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
- 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
- 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.
- 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.
- When i have to use reenumeration?
Thanks a lot!
Bests
Attila
- Labels:
-
STM32CubeMX
-
STM32F4 Series
-
USB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-06-19 9:09 AM
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-06-19 9:39 AM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-03-02 5:45 AM
have the same problem with a F746 did you fixed it?
