Author Topic: STM32F0 USB interface  (Read 1745 times)

0 Members and 1 Guest are viewing this topic.

Offline Red_MicroTopic starter

  • Regular Contributor
  • *
  • Posts: 121
  • Country: ca
STM32F0 USB interface
« on: July 16, 2021, 04:59:29 pm »
Anyone with experience using the crystal less USB interface from STM32F072? I have no external crystal. I've seen some unstable communication, sometimes disconnecting and connecting back multiple times fix it. I will start debugging so any suggestion is welcome. I read this from the errata sheet, which could be checked.

Quote
ESOF interrupt timing desynchronized after resume signaling
Description
Upon signaling resume, the device is expected to allow full 3 ms of time to the host or hub for sending the initial SOF (start of frame) packet, without triggering SUSP interrupt. However, the device only allows two full milliseconds and unduly triggers SUSP interrupt if it receives the initial packet within the third millisecond.
Workaround
When the device initiates resume (remote wakeup), mask the SUSP interrupt by setting the SUSPM bit for 3 ms, then unmask it by clearing SUSPM.
 

Offline pigrew

  • Frequent Contributor
  • **
  • Posts: 680
  • Country: us
Re: STM32F0 USB interface
« Reply #1 on: July 20, 2021, 05:39:16 pm »
Run optimized code, sometimes debugging/unoptimized code causes latency to be too high for USB.

Verify mechanicals and schematic. Do you have too much series resistance on D+/D-? Is Vdd dropping out? Too much capacitance on the data lines? Bad solder joints?

A photo of your PCB (and perhaps schematic) could also help.
 
The following users thanked this post: Red_Micro

Offline lbthomsen

  • Newbie
  • Posts: 1
  • Country: my
Re: STM32F0 USB interface
« Reply #2 on: July 24, 2021, 01:28:21 am »
I have not tried crystal less USB on the STM32F072 (does that even exist or do you mean STM32L072?), but I have done this using an STM32L432 and that works flawlessly.

//Lars...
 

Offline GromBeestje

  • Frequent Contributor
  • **
  • Posts: 279
  • Country: nl
Re: STM32F0 USB interface
« Reply #3 on: July 24, 2021, 10:25:15 pm »
Did you enable Automatic Clock Trimming?
 

Offline teletypeguy

  • Contributor
  • Posts: 13
  • Country: us
Re: STM32F0 USB interface
« Reply #4 on: July 28, 2021, 05:54:47 am »
I have not used internal oscillator for usb, though as grombeestje pointed out, clock trimming is likely important.  I am interested how that works out.

What kind of device does it enumerate as, and what kind of data rate?

I have used many 072 and 042 parts as usb hid devices, though with an 8meg xtal.  Never a glitch on the streaming data -- well, until the test house clamped a sleeve around the cable for hv pulse immunity testing -- it didn't like that  :)

Layout could affect it if you don't have a short-ish/straight-ish 90-ohm diff pair, smooth transitions to the series resistors...  A tvs should be a must, and a common-mode choke is a decent addition.  I had pll spurs to knock down and found that 47pF from each trace to ground fixed that without affecting data.
 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 1535
  • Country: au
Re: STM32F0 USB interface
« Reply #5 on: July 28, 2021, 10:03:51 pm »
Anyone with experience using the crystal less USB interface from STM32F072?.
I've not used that part, but they all have a largely common approach of a 1ms based DFLL.

You could try with a crystal, and confirm the problems go away - that confirms it is not any SW related issue.

You could output the divided OSC to a pin, and put a counter on that - a 1ms pin toggle is likely to match any DPLL update rate, as they use USB SOF as the locking clock.

You should see that lock, when USB is connected and the SW operates correctly.
The lock granularity will be limited by the LSB of the trim steps, but the frequency should jitter about a long term average of the PC clock.


 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf