Skip to main content
Martin Pesek
Associate II
January 30, 2018
Solved

USB - SET_CONFIGURATION fails

  • January 30, 2018
  • 6 replies
  • 1901 views
Posted on January 30, 2018 at 11:32

Hello,

I have encountered a problem with my STM32L452VE - when I set up USB with CDC, it sometimes connects, sometimes not. When it doesn't connect, Windows clasically show yellow exclamation mark.

Increasing heap size and chaning packets size didn't solve this issue.

I have tried sniffing USB communication and problem seems to be the same every time - SET_CONFIGURATION is sent from host (PC) but no response is received. Upon closer inspection, I tried to modify HAL libraries by adding an extra delay, which miraculously solved the issue and now it succusefully connects every time.

As this this fix appears to be highly temporary, does anyone know the root of the issue?

0690X00000609XrQAI.png
    This topic has been closed for replies.
    Best answer by Lubos KOUDELKA
    Posted on March 07, 2018 at 09:35

    Hello,

    in your HW design R105 and R106 shall be removed (bridged by 0 ohm resistors) - 22 ohm resistors is some our schematics are used as workaround for inappropriate ESD protection, but in general USB peripheral inside STM32 already match characteristic impedance of the bus and no additional resistors on the data lines shall be used.

    As possible cause for USB instability I see your clock setting - clock source for USB shall be different. There is more options:

    1 HSI48 with Clock Recovery System (HSI48 can be fine tuned from host SOFs or LSE)

    2 PLL with HSE used as PLL input

    Have you used such clock setting also with your nucleo board, where it's working?

    Please try to change your clock setting, let me know afterwards if it helps for you.

    best regards,

    Lubos

    6 replies

    Lubos KOUDELKA
    ST Employee
    February 22, 2018
    Posted on February 22, 2018 at 10:04

    Dear Martin,

    Could you share more details with me? As there is no ST eval board with STM32L452VE I guess you have your own design. Are you able to test also with some ST board? Can you share your USB part schematic?

    For the firmware part I see as the most suspecting part the clock setting - please send me the setting of the clocks in your project? Also the USB communication log you did could be interested for the me.

    Thank you & best regards,

    Luboš
    Martin Pesek
    Associate II
    March 6, 2018
    Posted on March 06, 2018 at 14:05

    Hello,

    thank you for your answer.

    Yes, design is of my own.

    I have tested the same piece of code (without added delay) on NUCLEO board where it worked flawlessly.

    My USB schematic:

    0690X00000609xLQAQ.png

    My Clock setting (external 16.384 MHz):

    0690X00000609xfQAA.png
    Lubos KOUDELKA
    Lubos KOUDELKABest answer
    ST Employee
    March 7, 2018
    Posted on March 07, 2018 at 09:35

    Hello,

    in your HW design R105 and R106 shall be removed (bridged by 0 ohm resistors) - 22 ohm resistors is some our schematics are used as workaround for inappropriate ESD protection, but in general USB peripheral inside STM32 already match characteristic impedance of the bus and no additional resistors on the data lines shall be used.

    As possible cause for USB instability I see your clock setting - clock source for USB shall be different. There is more options:

    1 HSI48 with Clock Recovery System (HSI48 can be fine tuned from host SOFs or LSE)

    2 PLL with HSE used as PLL input

    Have you used such clock setting also with your nucleo board, where it's working?

    Please try to change your clock setting, let me know afterwards if it helps for you.

    best regards,

    Lubos