cancel
Showing results for 
Search instead for 
Did you mean: 

STM32746G-Discovery: USB Device MSC - connects, then fails to enumerate. Low power mode enabled?

Tapio Valli
Associate II

Posted on April 27, 2018 at 20:30

My project uses STM32CubeMX generated code for USB FS Device in MSC class. I am using Windows USB Device Viewer trying to analyze what's going wrong.

1. The device connects but curiously there are mentions of 'device is in low power state', although it was disabled in CubeMX and in generated code

-----

  -----   The usbd_conf.c says:   -----  

  hpcd_USB_OTG_FS.Instance = USB_OTG_FS;   hpcd_USB_OTG_FS.Init.dev_endpoints = 6;   hpcd_USB_OTG_FS.Init.speed = PCD_SPEED_FULL;   hpcd_USB_OTG_FS.Init.dma_enable = DISABLE;   hpcd_USB_OTG_FS.Init.ep0_mps = DEP0CTL_MPS_64;   hpcd_USB_OTG_FS.Init.phy_itface = PCD_PHY_EMBEDDED;   hpcd_USB_OTG_FS.Init.Sof_enable = DISABLE;     hpcd_USB_OTG_FS.Init.low_power_enable = LPM_L0;

hpcd_USB_OTG_FS.Init.lpm_enable = DISABLE;

hpcd_USB_OTG_FS.Init.use_dedicated_ep1 = DISABLE;

-----

low_power_enable = LPM_L0 is CubeMX generated value, although low power mode is disable there. Changing it through LPM_L1-L3 does not change this behaviour. After above listing in USB Device Viewer, the status changes to 'Enumerating' and then 'Failed to enumerate ... device descriptor .. (code 43)'

I have the working example ofSTM32746G-Discovery/MSC_Standalone and when I run that code, the USB Device viewer is different:

-----

Is Port User Connectable: yes

Is Port Debug Capable: no

Companion Port Number: 18

Companion Hub Symbolic Link Name: USB#ROOT_HUB30#4&1148bc98&0&0#{f18a0e88-c30c-11d0-8815-00a0c906bed8}

Protocols Supported:

USB 1.1: yes

USB 2.0: yes

USB 3.0: no

Device Power State: PowerDeviceD0

---===>Device Information<===---

English product name: 'Mass Storage in FS Mode'

  -----   No more low power state, and something new,Device Power State: PowerDeviceD0.

The usbd_conf.c says:

#ifdef USE_USB_FS  /* Set LL Driver parameters */  hpcd.Instance = USB_OTG_FS;  hpcd.Init.dev_endpoints = 4;  hpcd.Init.use_dedicated_ep1 = 0;  hpcd.Init.ep0_mps = 0x40;  hpcd.Init.dma_enable = 0;  hpcd.Init.low_power_enable = 0;  hpcd.Init.phy_itface = PCD_PHY_EMBEDDED;  hpcd.Init.Sof_enable = 0;  hpcd.Init.speed = PCD_SPEED_FULL;  hpcd.Init.vbus_sensing_enable = 0;  hpcd.Init.lpm_enable = 0;    /* Link The driver to the stack */  hpcd.pData = pdev;  pdev->pData = &hpcd;

But I haven't been able to find the switch that would turn on this state. Would someone know how to get USB Device to enumerate?

ConnectionStatus:  Current Config Value: 0x01 -> Device Bus Speed: Full (is not SuperSpeed or higher capable)

[Port] : USB Mass Storage Device

if (pdev->id == DEVICE_FS) {  /* Link the driver to the stack. */  hpcd_USB_OTG_FS.pData = pdev;  pdev->pData = &hpcd_USB_OTG_FS;

[Port2] : USB Mass Storage Device 
Is Port User Connectable: yes 
Is Port Debug Capable: no 
Companion Port Number: 18 Companion Hub Symbolic Link Name: USB#ROOT_HUB30#4&1148bc98&0&0#{f18a0e88-c30c-11d0-8815-00a0c906bed8} 
Protocols Supported: 
USB 1.1: yes 
USB 2.0: yes 
USB 3.0: no 
---===>Device Information<===--- 
String Descriptor for index 2 not available while device is in low power state. ConnectionStatus: 
Current Config Value: 0x01 -> Device Bus Speed: Full (is not SuperSpeed or higher capable) Device Address: 0x08 Open Pipes: 2

0 REPLIES 0