3
\$\begingroup\$

There is a board of STM32F103CBT6 without external high speed crystal.

I want to use the USB module on this board. The input of the PLL is 4MHZ as I configured PLL source to internal RC oscillator (8MHZ typically with 2x division), then I configures the PLL to 12x, which means the clock to USB module is 48M.

Then the USB module works well, it seems stable.

I tried to heat up the board to 80C to test the stability of the USB module when the accuracy of the clock decreases, I also tried to cool it down to -10C, no problem is caused.

But I still worried about the stability of the USB module driven in this way.

Some datasheet of STM32F0 series from ST emphasizes their usb module is "crystalless", which seems to mean the usb of other series like STM32F1 cannot run without external crystal. But the datasheet of STM32F1 didn't say this problem clearly.

I wondered if usb works really stable enough without external crystal.

BTW, usb is needed to add IAP function to the project, so it is a serious problem.

Thanks.

\$\endgroup\$
  • 1
    \$\begingroup\$ The datasheet does state that "the dedicated 48 MHz clock is generated from the internal main PLL (the clock source must use a HSE crystal oscillator)" so it's technically out of specification and ST won't guarantee it will be reliable. The USB-equipped STM32F0s can work crystalless because they have an extra RC oscillator (HSI48) which is continously adjusted by a clock recovery peripheral during USB communication. \$\endgroup\$ – jms Sep 22 '16 at 9:40
8
\$\begingroup\$

USB, as per the spec, requires the frequency to be within 0.25% (2500 ppm) of the ideal value (for full speed - high speed needs a more accurate clock). In the datasheet of STM32F103xB (chapter 5.3.7: Internal clock source characteristics), you'll see that the HSI is guaranteed to have, even at a steady 25°C, a tolerance of -1.1% to +1.8%, which is not enough.

Note that the STM32F0 (specified for crystal-less USB, as you noticed), has a HSI48 specified with even worse tolerance (-2.8 to +2.9%), which, at first, seems contradictory. But it also has a feature called automatic trimming, part of the Clock recovery system (CRS) block (mentioned in chapter 3.20 of the datasheet, and described in full details in chapter 8 of the reference manual), which allows this oscillator to be adjusted depending on the SOF frame received from the USB, effectively recovering a clock with the required tolerance.

This clock recovery system is not included in the STM32F1, so you can't rely on USB to work properly on this chip without an external crystal. Chances are you've got a chip with more-than-average accuracy of the HSI, but it may not work with another sample.

In short: don't do that, unless it is a one-off prototype.

\$\endgroup\$
  • \$\begingroup\$ Thank you! I'm considering to add an external crystal to the board. \$\endgroup\$ – user123179 Sep 25 '16 at 9:16
  • \$\begingroup\$ @user123179, you can manually tune (trim) the internal RC oscillator frequency to get closer to 48MHz. I did that for a personal STM32F4 project. Also, according to the spec, low speed USB only needs 1.5% accuracy, so that could be a possibility. But I tried setting speed = USBD_SPEED_LOW in usbd_conf.c, but it didn't seem to work - USBview still reports it as full speed. \$\endgroup\$ – Yale Zhang Dec 12 '16 at 8:10
  • \$\begingroup\$ CRS is not available in all STM32F0 line have. Only STM32F0x1, STM32F0x2 and STM32F0x8 series provide necessary HSI48 oscillator. \$\endgroup\$ – ifyalciner May 10 '17 at 8:57

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.