Skip to main content
Visitor II
May 20, 2016
Question

STM32L4 USB low power stop

  • May 20, 2016
  • 7 replies
  • 5975 views
Posted on May 20, 2016 at 16:47

I am porting an existing design from an F107 to a L4 micro in the hopes that I can push sleep current below 50uA.

Currently I have only one barrier to achieving this low power: the USB device peripheral. No matter What I do, once the USB has been initialised, I can't get stop1 current below ~200uA.  

I have tried calling USBD_DeInit and USBD_Stop before stopping, but this only got me down to the 200uA. I have seen some forum posts (

/c8dfa70e

) related to the F4 saying that VBus sensing can account for this, but I have checked and the GCCFG register is completely reset after DeInit.

Does anyone have any ideas? I an using the latest Cube L4 HAL libraries, V1.4.    

#pull-up #stm32l4 #stm32l4 #usb #usb #power #stm32cube #pull-down
    This topic has been closed for replies.

    7 replies

    Technical Moderator
    May 23, 2016
    Posted on May 23, 2016 at 18:24

    Hi goosen.kobus.001,

    Are you using a dedicated power supply for USB as recommended in

    http://www.st.com/content/ccc/resource/technical/document/application_note/9e/9b/ca/a3/92/5d/44/ff/DM00148033.pdf/files/DM00148033.pdf/jcr:content/translations/en.DM00148033.pdf

    ?:

    Several independent supplies (VDDA, VDDIO2, VDDUSB), can be provided for specific peripherals, thus removing the constraint to supply all product at high voltage when analog or USB functions are used.

    -Mayla-

    kobusAuthor
    Visitor II
    May 24, 2016
    Posted on May 24, 2016 at 09:00

    Thanks for replying. on my board the VDDUSB is directly connected to 3.3V. I don't think this is necessarily a big deal, because before the USB is configured I can get down into single uA's even though its connected, so the fact that its connected to power surely couldn't be the problem... 

    What I can say is that the VDDUSB seems to be enabled and disabled by the L4 USB HAL libraries: in the HAL_PCD_MspInit/DeInit functions int he USBD_conf file, it calls HAL_PWREx_EnableVddUSB() / HAL_PWREx_DisableVddUSB(), so I would think this is not the issue...

    In any case if the power draw can be low before the USB is initialised, surely the problem was caused by code, and could hopefully be undone in code (unless thePWR_CR2:USV bit, or something else, cannot be cleared once set??).      

    I have read through the errata sheet, but nothing there stands out.

    I appreciate the help. Any other ideas?  

    kobusAuthor
    Visitor II
    May 26, 2016
    Posted on May 26, 2016 at 09:25

    Anyone have any ideas? For the sake of sanity I have tested this with another device and can confirm that its the same.  

    kobusAuthor
    Visitor II
    May 31, 2016
    Posted on May 31, 2016 at 08:27

    Anyone?

    Visitor II
    June 1, 2016
    Posted on June 01, 2016 at 17:05

    Beacuse L4 Has an internal pull up (1.5K) and  Host pull down (15K)

    16.5 K draws ~200uA

    kobusAuthor
    Visitor II
    June 2, 2016
    Posted on June 02, 2016 at 16:29

    Thanks Abdul, this makes sense. Ilight of your comment I searched through the reference guide a bit more. From what I can tell the pull ups/downs are controlled automatically based on the core state.

    There is a bit (OTG_DCTL.SDIS) which handles the soft disconnect which removes the DP pull-up, however this is ultimately set in the 'USBD_Stop' function, which still does not fix the issue. This indicates that if a resistor is the issue, its the host pulldowns. This makes sense as 3.3V/15k is definitely closer to the 220uA I'm seeing.

    Do you know of a way to forcibly turn off all the pull resistors?

    Interestingly, I have found when the USB is DeInitialised (or any time the PWR_CR2_USV bit is cleared), the current does go down, but within about 2 seconds the current rises again to about 350uA (worse than when the USB is suspended). this tells me that there is probably something like an internal pull resistor bleeding current into the USB hardware blocks.

    I thought this might be due to the pins still being connected to the USB, but changing them does nothing, and indeed DeInit also DeInits the pins, which does nothing.

    Seeing as the OTG core is controlling the pull resistors, I'm going to reconfigure my USB device to use bus sensing, and fiddle with the voltage on the Vbus pin and see what happens.    

       

    I'll let you know the results.   
    Visitor II
    February 21, 2024

    I have a related problem.

    I can fix it in hardware though..

    The problem is that the USB_DM is floating in STOP1MODE, even after I executed USBD_LL_Suspend().

    The whole board with >10 chips on it is consuming about 27 uA, when the microcontroller is in Stop1mode.

    But the USB_DM is so extremely sensitive, that, when I point to it using my finger ( not even touching it, but getting close) the current consumption goes up to several hundred uAmps.

    As a fix I used a 1 MOhm resistor to ground. works perfectly. The current consumtion is stable now. :)

    But I was wondering if I could fix it in firmware also.

    So I used LL_GPIO_SetPinPull(GPIOA, GPIO_PIN_11, LL_GPIO_PULL_DOWN);//USB_DM

    But it doesn't work. 

    to test my code I pulled it high, and verified on a scope: it is NOT working.

    Perhaps I nee to re-initialize the GPIO Pins PA11 & PA12. I did, but than the device won't wake from sleep anymore.

     

    I think the resistor is the best fix.

    Or has anyone a better idea?

    I verified the USB is working properly with the 1M Ohm connected to it.

     

     

    kobusAuthor
    Visitor II
    June 15, 2016
    Posted on June 15, 2016 at 09:22

    Just to give a bit of feedback, for the time being I've rigged a check up in my code that prevents the USB subsystem from being initialised until the system voltage is >4.3V. 

    In my design the system voltage will either come from a lithium battery (3~4.2V) or from the bus voltage, so this hack has worked reasonably well.

    In general I reset my micro after a few minutes of inactivity, os if it were to be plugged into a USB, it would only draw 240uA for a short period. Not perfect, but quite acceptable. 

    While this system works, I would still like to know if anyone has managed to return the USB system into a low power state.

    Also, if anyone has used USB in a low power application, i'd like to know how they went about it.

    My hardware is mostly fixed, but I suppose the correct thing to have done would have been to make sure the VDDUSB pin was only powered when the USB bus was connected? 

    Visitor II
    March 16, 2017
    Posted on March 16, 2017 at 10:08

    Good morning,

    Now I'm facing similar current consumption with same device: around 220uA in Stop1 mode when current consumption should be around 7uA (with RTC). How did you solve that? (maybe disconnecting VDD-USB)...

    Regards.

    Visitor II
    August 28, 2017
    Posted on August 28, 2017 at 12:24

    Hi,

    I have the same problem but with STM32L432 device that has not VDDUSB pin, so I can't disconnecting this voltage that is wire connected (inside the component) to VDD. If you or anyone have a suggestion is very appreciated.

    Regards.