Forgot to mention... I assume you have 2 suitable size caps from the crystal leads to ground. Somewhere near 18-22 pF depending on the crystal.
Forgot to mention... I assume you have 2 suitable size caps from the crystal leads to ground. Somewhere near 18-22 pF depending on the crystal.
Yes, get rid of the PLL.
Dave
Always wear safety glasses while programming.
If you are using the PLL then you should be using a 5Mhz XTAL to get 20Mhz. The PLL multiplies by 4, so that will get you 20.
If you have a 20Mhz Xtal, set the oscillator for HS and turn the PLL off as macrakit says.
Charles Linquist
Thanks for the advice, I do have a 20Mhz Xtal and 20pf caps for it, It's set up just like the 4Mhz, as far as the hardware side goes. Is the PLL only for the USB, or does it speed up the Pic's code execuition also? I keep reading myself in circles in the data sheet trying to figure that one out. Should the OSCCON settings be removed?
I'll try the configuration from circuitpro's post.
Thanks,
I did not notice the OSCCON before. It is not needed for your setup.
The PLL is for anytime you need to run the chip at a different speed than the main OSC. USB is not the only reason.
The 2550 can be set to run at
1, 1.33, 2, 4, 16,32, or 48 MHz with a 4 MHz external.
You will need to DEFINE OSC x to what ever the actual chip speed is if you PLLed it.
Dave
Always wear safety glasses while programming.
I still don't have the 20Mhz XTAL resonating, these are my settings now.
I have this commented out in the include file:
In my program I removed the OSCCON settings.Code:;__CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L ;__CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H
I'm setting the HS in my program:
I can jumper the 4Mhz XTAL into the circuit and it will resonate, I move the jumpers to the 20Mhz XTAL, I don't get anything.Code:asm __CONFIG _CONFIG1H ,_FOSC_HS_1H __CONFIG _CONFIG2L ,_BOR_ON_2L & _BORV_2_2L endasm
I verify with a 200Mhz Fluke scope, and I also have an LCD that gives me a read out. The LCD works with the 4Mhz XTAL jumpered in and I have a nice clean wave form on the scope. The LCD cycles slow and I get garbage sometimes. My guess is that's because I still have the OSC DEFINE 20.
I though maybe something was up with the 20Mhz XTAL, so I tried another one with some short leads soldered on so it makes a good connection in the breadboard. Second 20Mhz XTAL does't resonate.
I tried 15, 17 and 20pf caps for the XTAL, no difference.
So I'm stumped, I do have a question on Mackrackit's Post, saying it can run at:
"1, 1.33, 2, 4, 16,32, or 48 MHz with a 4 MHz external"
It looks like all the settings divide the external XTAL speed, I don't see how I would get 16 or 32Mhz? If I can get 16 or 32Mhz with my 4Mhz XTAL I may have enough speed. At least it's worth a try.
Thanks, Let me know where I'm going wrong.
Shane
I do not use crystals so I can not comment on that.
Here are the configs to run at 48 MHz with a 4 MHz resonator.
Code:DEFINE OSC 48 @ __CONFIG _CONFIG1L, _PLLDIV_1_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L @ __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H @ __CONFIG _CONFIG2H, _WDT_OFF_2H & _WDTPS_512_2H @ __CONFIG _CONFIG2L, _PWRT_ON_2L & _VREGEN_ON_2L @ __CONFIG _CONFIG3H, _PBADEN_OFF_3H & _MCLRE_OFF_3H @ __CONFIG _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
Dave
Always wear safety glasses while programming.
Bookmarks