BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px; }
Hi guys,
I am using a pic18F4553 in a project and I am having problems with
the oscillator.
I am trying to use the internal 8MHz clock PLL, prescaler etc (which
works nicely clocking at 32MHz), but when it comes to working with the
USB I am failing miserably.
All of the Microchip documentation seems to contradict itself in
each section when discussing the USB clock.
My question is this:-
Can i use the 8MHz internal oscillator to drive the 48MHz/6MHz
needed for the on-chip USB peripheral, and if so, what settings would
you use?
Here is what I am using (I have documented the config settings)
(MPLab 8.83, Hi-tech C 9.65)
// 8Mhz internal oscillator producing 48MHz USB clock and 48MHz CPU
clock
// clk src from 96MHz PLL/2, // Internal External Switch Over Mode disabled
// Fail-Safe Clock Monitor Disabled
// INTOSC: INTOSC+CLK0{RA6}, USB-EC // CPU No divide
// OSC Select div by 2 {8MHz internal input} __CONFIG(1, USBPLL & IESODIS & FCMDIS & INTCLKO & CPUDIV1 &
PLLDIV2); // USB Voltage Regulator Enabled
// Power Up Timer Disabled
// Brown Out Detect Disabled (2.0v)
// Watchdog Timer Disabled (1:32768)
__CONFIG(2, VREGEN & PWRTDIS & BORDIS & BORV20 & WDTDIS & WDTPS32K);
// PortB A/D disabled (digital)
// Low Power Timer1 Osc Disabled
// Master Clear Enable
__CONFIG(3, PBDIGITAL & LPT1DIS & MCLREN);
// Disable extended instruction set (Legacy mode) // Stack Overflow Reset Disabled
// Low Voltage Program Disabled
// Dedicated In-Circuit Port {ICD/ICSP} Disabled
// Background Debug Enabled
__CONFIG(4, XINSTDIS & STVRDIS & LVPDIS & ICPORTDIS & DEBUGEN);
// Protect bits Unprotected
__CONFIG(5, UNPROTECT);
__CONFIG(6, UNPROTECT);
__CONFIG(7, UNPROTECT);
Many Thanks,
Ji
\> I am using a pic18F4553 in a project and I am having problems with
> the oscillator.
>
> I am trying to use the internal 8MHz clock PLL, prescaler etc (which
> works nicely clocking at 32MHz), but when it comes to working with the
> USB I am failing miserably.
>
> All of the Microchip documentation seems to contradict itself in
> each section when discussing the USB clock.
>
> My question is this:-
>
> Can i use the 8MHz internal oscillator to drive the 48MHz/6MHz
> needed for the on-chip USB peripheral, and if so, what settings would
> you use?
I would not try to use the internal clock to do USB, even if it is possible on the chip (and I don't know if it is).
USB requires better clock accuracy than you are likely to get without a resonator or crystal.
> BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px; }
>
> Hi guys,
>
> I am using a pic18F4553 in a project and I am having problems with
>the oscillator.
>
> I am trying to use the internal 8MHz clock PLL, prescaler etc (which
>works nicely clocking at 32MHz), but when it comes to working with the
>USB I am failing miserably.
>
> All of the Microchip documentation seems to contradict itself in
>each section when discussing the USB clock.
>
> My question is this:-
>
> Can i use the 8MHz internal oscillator to drive the 48MHz/6MHz
>needed for the on-chip USB peripheral, and if so, what settings would
>you use?
>
> Here is what I am using (I have documented the config settings)
>
> (MPLab 8.83, Hi-tech C 9.65)
>
> // 8Mhz internal oscillator producing 48MHz USB clock and 48MHz CPU
>clock
> // clk src from 96MHz PLL/2,
> // Internal External Switch Over Mode disabled
> // Fail-Safe Clock Monitor Disabled
> // INTOSC: INTOSC+CLK0{RA6}, USB-EC
> // CPU No divide
> // OSC Select div by 2 {8MHz internal input}
> __CONFIG(1, USBPLL & IESODIS & FCMDIS & INTCLKO & CPUDIV1 &
>PLLDIV2);
> // USB Voltage Regulator Enabled
> // Power Up Timer Disabled
> // Brown Out Detect Disabled (2.0v)
> // Watchdog Timer Disabled (1:32768)
> __CONFIG(2, VREGEN & PWRTDIS & BORDIS & BORV20 & WDTDIS & WDTPS32K);
> // PortB A/D disabled (digital)
> // Low Power Timer1 Osc Disabled
> // Master Clear Enable
> __CONFIG(3, PBDIGITAL & LPT1DIS & MCLREN);
> // Disable extended instruction set (Legacy mode)
> // Stack Overflow Reset Disabled
> // Low Voltage Program Disabled
> // Dedicated In-Circuit Port {ICD/ICSP} Disabled
> // Background Debug Enabled
> __CONFIG(4, XINSTDIS & STVRDIS & LVPDIS & ICPORTDIS & DEBUGEN);
> // Protect bits Unprotected
> __CONFIG(5, UNPROTECT);
> __CONFIG(6, UNPROTECT);
> __CONFIG(7, UNPROTECT);
> Many Thanks,
>
> Jim
>
>
Jim,
I just glanced at the datasheet for the 4550 and found this:
2.2.5 INTERNAL OSCILLATOR BLOCK
The PIC18F2455/2550/4455/4550 devices include an
internal oscillator block which generates two different
clock signals; either can be used as the microcontroller’s
clock source. _If the USB peripheral is not used_, the
internal oscillator may eliminate the need for external
oscillator circuits on the OSC1 and/or OSC2 pins.
And looking at figure 2.1 on page 24, you see that the source of the USB clock can't be fed from the Internal Clock. It can only be derived from the Primary Osc.
BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px; }
Hi Bill,
I thought that initially, but looking through the datasheet has sent
my head in a spin.
Normally, these configs are a breeze, but this one has just been
killing me.
I have designed in (and now fitted) a 20MHz resonator, so I will try
with that.
Thanks again
Jim
On Thu 14/06/12 2:57 PM , William Bross spam_OUTwbrossTakeThisOuTcinci.rr.com sent:
Jim wrote:
> BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px; }
>
> Hi guys,
>
> I am using a pic18F4553 in a project and I am having problems with
>the oscillator.
>
> I am trying to use the internal 8MHz clock PLL, prescaler etc
(which
>works nicely clocking at 32MHz), but when it comes to working with
the
>USB I am failing miserably.
>
> All of the Microchip documentation seems to contradict itself in
>each section when discussing the USB clock.
>
> My question is this:-
>
> Can i use the 8MHz internal oscillator to drive the 48MHz/6MHz
>needed for the on-chip USB peripheral, and if so, what settings
would
>you use?
>
> Here is what I am using (I have documented the config settings)
>
> (MPLab 8.83, Hi-tech C 9.65)
>
> // 8Mhz internal oscillator producing 48MHz USB clock and 48MHz
CPU
>clock
> // clk src from 96MHz PLL/2,
> // Internal External Switch Over Mode disabled
> // Fail-Safe Clock Monitor Disabled
> // INTOSC: INTOSC+CLK0{RA6}, USB-EC
> // CPU No divide
> // OSC Select div by 2 {8MHz internal input}
> __CONFIG(1, USBPLL & IESODIS & FCMDIS & INTCLKO & CPUDIV1 &
>PLLDIV2);
> // USB Voltage Regulator Enabled
> // Power Up Timer Disabled
> // Brown Out Detect Disabled (2.0v)
> // Watchdog Timer Disabled (1:32768)
> __CONFIG(2, VREGEN & PWRTDIS & BORDIS & BORV20 & WDTDIS &
WDTPS32K);
> // PortB A/D disabled (digital)
> // Low Power Timer1 Osc Disabled
> // Master Clear Enable
> __CONFIG(3, PBDIGITAL & LPT1DIS & MCLREN);
> // Disable extended instruction set (Legacy mode)
> // Stack Overflow Reset Disabled
> // Low Voltage Program Disabled
> // Dedicated In-Circuit Port {ICD/ICSP} Disabled
> // Background Debug Enabled
> __CONFIG(4, XINSTDIS & STVRDIS & LVPDIS & ICPORTDIS & DEBUGEN);
> // Protect bits Unprotected
> __CONFIG(5, UNPROTECT);
> __CONFIG(6, UNPROTECT);
> __CONFIG(7, UNPROTECT);
> Many Thanks,
>
> Jim
>
>
Jim,
I just glanced at the datasheet for the 4550 and found this:
2.2.5 INTERNAL OSCILLATOR BLOCK
The PIC18F2455/2550/4455/4550 devices include an
internal oscillator block which generates two different
clock signals; either can be used as the microcontroller’s
clock source. _If the USB peripheral is not used_, the
internal oscillator may eliminate the need for external
oscillator circuits on the OSC1 and/or OSC2 pins.
And looking at figure 2.1 on page 24, you see that the source of the
USB
clock can't be fed from the Internal Clock. It can only be derived
from
the Primary Osc.
Bill
-- http://www.piclist.com [1] PIC/SX FAQ & list archive
View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist [2]
>I would not try to use the internal clock to do USB, even if it is possible
>on the chip (and I don't know if it is).
>
>USB requires better clock accuracy than you are likely to get without a
>resonator or crystal.
That's what I've always thought as well. But don't recent FDTI USB chips work without an external crystal?
>>USB requires better clock accuracy than you are likely to get without a
>>resonator or crystal.
>
> That's what I've always thought as well. But don't recent FDTI USB
> chips work without an external crystal?
>
> How do they work their magic?
>
> Thanks!
>
> dwayne
I think they might adjust their timing based on the clock rate of the signal from the host. I have used that trick to do bit-banged RS232 async without a crystal.
> >I would not try to use the internal clock to do USB, even if it is
> >possible on the chip (and I don't know if it is).
> >
> >USB requires better clock accuracy than you are likely to get without a
> >resonator or crystal.
>
> That's what I've always thought as well. But don't recent FDTI USB chips work
> without an external crystal?
>
There are a handful of Microchip USB chips that claim to have an internal oscillator stable enough to work with USB, but I don't believe that chip is one in this category.
The only one I can think of that I have discovered claims to be stable enough is the PIC24FJ64GBxxx series.
-- Scanned by iCritical.
On Thu, June 14, 2012 10:35 am, alan.b.pearceKILLspamstfc.ac.uk wrote:
>> >I would not try to use the internal clock to do USB, even if it is
>> >possible on the chip (and I don't know if it is).
>> >
>> >USB requires better clock accuracy than you are likely to get without a
>> >resonator or crystal.
>>
>> That's what I've always thought as well. But don't recent FDTI USB
>> chips work
>> without an external crystal?
>>
>
> There are a handful of Microchip USB chips that claim to have an internal
> oscillator stable enough to work with USB, but I don't believe that chip
> is one in this category.
>
> The only one I can think of that I have discovered claims to be stable
> enough is the PIC24FJ64GBxxx series.
To meet the USB spec (full speed, at least), you need a pretty accurate
oscillator, I believe about 0.5%. In general, the standard internal
oscillator just won't cut it across temperature. The internal oscillator
is often accurate enough for USB operation at room temp, but you run the
very real possibility of it drifting out of compliance with the USB
specification.
Low speed USB allows much looser tolerances on USB, and I believe it runs
within the USB specification across the temperature range of the most
parts (-40 to +85).
Although I'm running low speed USB *it's controlling a handful of I2c
digital pots and reading some digital ports, it seems I need to use the
external oscillator. As I posted earlier on the list, I have designed in a resonator including on
the pcb so I populated the spot with a 20Mhz part. I'll give it a whirl.