Quantcast
Channel: PIC18F4550 - oscillator settings - FlowCode
Viewing all articles
Browse latest Browse all 56

Re: PIC18F4550 - oscillator settings - FlowCode (pcbbc)

$
0
0
viki2000Why PLL option is better for USB usage?  What is  wrong with OSC1/OSC2 usage for USB? When do I not use PLL?
The PLL is required to generate the 96Mhz clock from which the 48MHz FS USB clock is derived via a divide by 2.
 
 
Unless of course you have an external crystal which is directly suitable for USB clock rates, in which you can use that directly.  This is what the USBDIV configuration setting selects - nothing else and nothing to do with the CPU clock.
 
It's optional if you use the PLL output to drive the CPU system clock.  I was simply suggesting it was easier when getting started to just to use the external 20MHz directly and not worry about PLL, especially if you aren't currently using the USB.  Also your first screen grab shows you have clock set at 20MHz - so I assumed that was the CPU clock you were trying to achieve.
 
If I want to use 20MHz external crystal, then I start from 4) and I choose first "FOSC=HS" in Addendum, in FlowCode named "Oscillator: HS:USB-HS" or "FOSC=HSPLL_HS" in Addendum, in FlowCode named "Oscillator: HS:HS+PLL; USB-HS".
 
Is it any strict relation that I must follow between 1) and 4) ?
What I mean is: if I choose first "FOSC=HS" in Addendum, in FlowCode named "Oscillator: HS:USB-HS" for 4), then is it a must to use "USBDIV=1" in Addendum, in FlowCode named "USB Clocl Selection: clc src from OSC1/OSC2"?
Or may I mix up with PLL?
Or when I choose "FOSC=HSPLL_HS" in Addendum, in FlowCode named "Oscillator: HS:HS+PLL; USB-HS", then must I use use "USBDIV=2" in Addendum, in FlowCode named "USB Clocl Selection: clc src from 96MHz PLL/2"?



Which clock are you talking about here?  The clock for the USB peripheral or the clock for the CPU?
You started this discussion only with regard to the CPU clock speed, and I've mainly been answering with regard to that.
 
How you set USBDIV has absolutely no bearing on the CPU clock, as you can see from the diagram.  All that bit controls is the mux in the top right of the diagram, and if the USB peripherals clock comes direct from the oscillator input, or from the PLL output.
 
I also see there is another bit (FSEN) controlling the Mux on the right to the USB peripheral source. That allows you to select the USB clock as either coming from the system clock div 4, or the PLL output.  But where that bit is configured I do not know.
 
It might help if you said what clock rates you want from your 20MHz crystal for:
a) CPU clock
b) USB peripheral clock
Then I could perhaps come up with some concrete examples of how to configure them.  At the moment there are so many possibilities that it is difficult to explain, other than to say the diagram is very clear to me as to what config bits control what.  Perhaps I should label the diagram for you and show you which configuration bits (i.e. which drop downs in FlowCode) contol which muxes in the clock circuit...
 
And again I should add I have not used this part myself, but I am, hopefully, reasonably experienced with MC products and their documentation.

Viewing all articles
Browse latest Browse all 56

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>