cancel
Showing results for 
Search instead for 
Did you mean: 

ST32F407 ''HSI as USB CDC'' or ''Separating SYCLK from USBCLK''

harerod
Associate II
Posted on May 29, 2013 at 15:22

Hello,

we want to implement a pulse generator with Timer1, clocked by SYCLK. For marketing reasons we'd prefer a granularity of 10ns, therefor we'd set SYSCLOCK to 100MHz.

At the same time we'll need a USB CDC for our user interface (FS-interface, device only).

Crosschecking the HSI-spec (factory accuracy -8..4,5%) and the USB2 spec, should rule out using HSI as USB clock.

On the other hand, we're pretty sure that the DFU-bootloader runs from HSI.

So - does anybody have experiences with using HSI as USB clock?

Or - even better - any suggestions for both basing 100MHz-SYSCLOCK and 48MHz-USBCLOCK on a crystal?

Looking forward your ideas,

 marc

 

#stm32-timer-usb-hsi
4 REPLIES 4
Posted on May 29, 2013 at 15:47

DFU might run from HSI, it could also conceivably start and time the HSE, I haven't dug into the firmware that deeply.

Problem with the PLL and USB is that the core needs to run at a multiple of 24 MHz. So your nice round decimal number plan goes out the window. Running at 168 MHz would however give you sub 6 ns timing.

A HS PHY might offer more options, I haven't review that with much rigor.

You might be able to run the core directly from HSE (say 25-26 MHz), and use the PLL just for USB, but I don't think the part likes speed inversions on the bus (ie bus running faster than core), and this doesn't get you a 10 ns granularity.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
harerod
Associate II
Posted on May 29, 2013 at 16:07

Thanks for feedback. It would be interesting to know, if the bootloader actually calculates the HSE clock. At least it works with HSE 8..25MHz, don't know if ''from''. Maybe I'll remove the crystal sometime...

If nobody else has a creative idea about clocking those two peripherals, I'll resort to 80MHz SYSCLK which gives us 12,5ns granularity. (240MHz VCO, P==3, Q==5).

johnjohn9106
Associate
Posted on May 30, 2013 at 07:17

Refer to AN2606 which says of the STM32F4:

  The HSI clock source is used at startup (interface

 

detection phase) and when USARTx interfaces are

 

selected (once CAN or DFU bootloader is selected,

 

the clock source will be derived from external

 

crystal).

So, HSI is only used to select the interface and by the USART bootloader.  HSE is used for USB and CAN.  Furthermore, the same app note says:

  The HSE clock source is used only when the CAN

 

or the DFU (USB FS Device) interfaces are

 

selected.

 

The external clock must provide a frequency

 

multiple of 1 MHz and ranging from 4 MHz to

 

26 MHz.

harerod
Associate II
Posted on May 30, 2013 at 11:01

Thanks Richard, for hunting this piece of information down and closing that approach to separating SYSCLOCK from USBCLOCK.

Quoting AN2606 (Which I didn't consult, because my brain was down a different track) was a very helpful reminder that the external crystal must be either 8/14,7456/25 MHz for DFU to work. Luckily I always stuck with 8MHz so far.

For a second I even considered overspeeding the VCO to 480MHz. But my strong believe in not being cruel to semiconductors prevented me from this.

Thanks all!