Any usb experts around here? (I'm sure there are)
I am playing around with a micro with usb support that was intended to be used with a crystal when using usb. However, I wanted to see if I could make it work with the internal frc ('everyone' is doing it now, so why not me). The system clock uses a pll , and a clock can be routed out to a pin in various ways, and into the clkin pin which will only be used for the usb pll input (4Mhz).
I can adjust the frc via an osctun register, and be in the range of 3.94Mhz-4.066Mhz (sysclk/10) in 64 steps. I have tested the whole range, and the usb (cdc) doesn't hiccup at all (for some reason), so I think it is workable. I have about 10 steps in osctun that keep the clock in the 0.25% range.
I currently am using polling in the usb stack, and simply use the SOF callback to get average times between callbacks (1000 per second).
is there a way to 'delay' the initial usb communication after coming out of the usb reset state, so I can get some SOF packets coming in to tune the clock? (so I can tune the clock before important comms take place just in case the pc doesn't like the initial clock)