USB Clock with 16 MHz crystal

Go To Last Post
14 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi there,

 

for precise measuring i need my controller as fast as possibile. So I use a 16 crystal and PLL to create 128MHz CLK/4 and 32MHz CLK.

 

The datasheet tells me, that the USB clock needs 12 oder 48MHz. I dont want overclocking. So how can I use the USB with my 32/128 MHz clock? Will it work? I cant see a solution :(.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

16 * 3 = 48

48 / 4 = 12

 

That's essentially how MEGA-USB chips do USB from 16MHz. I don't know Xmega but assume it will offer something similar? 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes i could make a PLL about 48MHz. But i need it already at a speed of 128MHz.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can use the crystal and PLL to generate the USB clock, and then the internal 32MHz RC oscillator for your CPU clock.

 

Otherwise the maximum non-overclocked speed available is 24MHz. In my limited testing everything seems to work okay at 48MHz, but obviously there are no guarantees.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As I said, I already need a 128MHz PLL und 32MHz CPU Clock  (from a 16MHz crystal) frown

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can't do that on XMEGA. What do you need the precision 32MHz clock for?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Precise Sound generation and precise waveform generation for frequency subtraction. No - it has to be very precise and hires (500kHz in 1kHz steps).

 

What means that USB Start of frame and DFLL?

Last Edited: Mon. Jun 26, 2017 - 08:57 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Isn't 24MHz enough?

 

Anyway, you can use the RC32MHz oscillator, tuned to 48MHz and using DFLL that measures the USB start of frame waveform. It's explained in the manual and the app note.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Generating a >= 400kHz squarewave with 1kHz steps is not possibile anymore with 24MHz. With 32MHz the boundary is at about 480kHz.

Last Edited: Mon. Jun 26, 2017 - 10:06 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why is it not possible? You are running the TC at 128MHz, right? So do you mean that the CPU can't do the necessary calculations fast enough?

 

I had a similar issue with a melody generator, 6x32kHz channels. With a bit of careful optimization of my C code I managed to reduce the processing from about 80% of available cycles to around 20%.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It runs in Hardware, not software. At 32MHz there is a much better resolution. Values are in Hz. You see at 24MHz there are 2kHz steps. At 32MHz they are at about 1kHz.

That is important for my circuit. This is a direct Timer Compare Output on a portpin, waveform generation.

 

24MHz:

415584,416
413793,103
412017,167
410256,41
408510,638
406779,661
405063,291
403361,345
401673,64
400000

 

32MHz:

411575,563
410256,41
408945,687
407643,312
406349,206
405063,291
403785,489
402515,723
401253,918
400000
Last Edited: Mon. Jun 26, 2017 - 10:29 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Have a look at the Hi-Res extension module, it will give you up to 8x the resolution. Then you should be able to run at 24MHz but with the resolution of a 192MHz clock.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is already used with the hires module. Without there would have been steps at around 10-20kHz. Here a calculation without hires, 32MHz and possibile frequencies:

 

400000
405063,291
410256,41
415584,416
421052,632
426666,667
432432,432
438356,164
444444,444
450704,225
Last Edited: Mon. Jun 26, 2017 - 11:40 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

RC32M+DFLL for the USB clock is your only option then. Well, you could generate a 12MHz USB clock and a 36MHz CPU clock... That's not got much overclocking ;-)

 

For this kind of precision frequency generation there are better options if you can add some external hardware.