cancel
Showing results for 
Search instead for 
Did you mean: 

USB - SET_CONFIGURATION fails

Martin Pesek
Associate III
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
1 ACCEPTED SOLUTION

Accepted Solutions
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

View solution in original post

6 REPLIES 6
Lubos KOUDELKA
ST Employee
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š
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
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
Posted on March 19, 2018 at 08:00

Changing clock to HSI48 seems to have resolved the issue, although I am not exactly sure why. Could you please care to explain?

Thank you very much for your help.

Posted on March 19, 2018 at 08:40

You used MSI as input to PLLSAI, to generate the USB clock.

MSI is an internal RC oscillator, not precise enough for the USB standard requirement of 0.25% clock error for Full Speed.

JW

Posted on March 19, 2018 at 09:10

Hello,

Thank you Jan for your reply with explanation.

Martin,

It's look like additional delay hide timing issue inside your application (for verification would be needed test with some USB analyzer).

As mentioned in USB 2.0 specification (chapter 7.1.11 – Data Signaling Rate), clock acuraccy for USB is quite demanding, so you have to choose also higher precision clock source inside your application, and as already highlited, in case of STM32L452 there are two posibilities:

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

2 PLL with HSE used as PLL input

best regards,

Lubos