CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

18F4450 Fuses

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
dbrown



Joined: 24 Jul 2004
Posts: 20

View user's profile Send private message

18F4450 Fuses
PostPosted: Fri Jan 20, 2006 8:00 pm     Reply with quote

I am trying the us_ex_serial example, however I am having problems with two things. I am using compiler version 3.242. I have tried several different crystals, 4 mhz, 20 mhz, and 48 mhz. I have set the use delay to reflect the applicable crystal frequency. When I connect the pic to the serial port I get garbled characters, an indication to me that the baud rate is not correct. The other problem is that the Win 2K computer never seems to find the pic. I have installed the usb.sys files in windows system folder, and I have also copied the .inf files to the system folder. Is there somewhere that I can find a definition for the fuses.

HS, HSPLL are they two separate purposes? I assume HS is for crystal speed greater than 4 mhz, and HSPLL is part of the High speed phase lock loop.

I do not undestand the purpose of the usbdiv fuse.

If I understand correctly the cpudiv1, pll5 all relate to the chosen crystal.

Does the vregen fuse enable the internal 3.3V regulator.

I have read the data sheet for the '4550, for 4 mhz, why does it list xt,hs,ec,ecio in one cell with clock divisions, and then hspll, ecpll, xtpll, ecpio in another cell with clock divisions again?

Any help would be appreciated.

Thank you

David Brown
dbrown



Joined: 24 Jul 2004
Posts: 20

View user's profile Send private message

Correction to first email
PostPosted: Fri Jan 20, 2006 8:06 pm     Reply with quote

The pic I am using is a 18F4550, not 18F4450, that was a typo.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jan 20, 2006 9:34 pm     Reply with quote

Start with a very simple program, just to get the RS-232 serial port
working. Example:
Code:
#include <18F4550.H>
#fuses XT, NOWDT,  NOPROTECT, BROWNOUT, PUT, NOLVP   
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

void main()
{
printf("Hello World\n\r");

while(1);
}
dbrown



Joined: 24 Jul 2004
Posts: 20

View user's profile Send private message

18F4550
PostPosted: Fri Jan 20, 2006 10:05 pm     Reply with quote

I tried the simple program as listed above, and the serial interface works fine. If I want to use the usb with a 4 mhz crystal then I need to set pll/1 and cpudiv0.

Thanks for your help PCM.

Dave
arys



Joined: 09 Mar 2007
Posts: 31

View user's profile Send private message

PostPosted: Fri Jan 11, 2008 2:20 am     Reply with quote

sorry for interrupt but where can I see the "hello world" sentence?
Ttelmah
Guest







PostPosted: Fri Jan 11, 2008 3:56 am     Reply with quote

Going back to the first question, a 48MHz crystal, is not legitimate. You can use a 48Mhz external _oscillator_, but not a crystal. The internal oscillator is not specified to run above 25MHz.
Now, the 4MHz crystal, may also give problems. Though 'legitimate', on these PICs, I have seen problems with them. For some reason, the internal USB PLL, can behave 'oddly', with quite a few crystals. The chip works, and is clocking at the right rate, but the USB becomes unreliable.
So, I'd say, use a multiple of 4MHz. The 20MHz crystal (or an 8MHz, 12MHz etc.), would be my choice.
For the 20MHz crystal, you have the choice of running the processor, at 48MHz, 24MHz, 20MHz, 16MHz, 12MHz, 10MHz, 6.66MHz, or 5MHz. The normal fuse settings are:
Code:


HSPLL  PLL5 CPUDIV1 USBDIV   - 48MHz CPU
HSPLL  PLL5 CPUDIV2 USBDIV   - 24MHz CPU
HS PLL5 CPUDIV1 USBDIV         - 20MHz CPU
HSPLL PLL5 CPUDIV3 USBDIV    - 16MHz CPU
HSPLL PLL5 CPUDIV4 USBDIV    - 12MHz CPU
HS PLL5 CPUDIV2 USBDIV         - 10MHz CPU
HS PLL5 CPUDIV3 USBDIV         - 6.66MHz CPU
HS PLL5 CPUDIV4 USBDIV         - 5MHz CPU

The 'key' is that the USB PLL, is _always_ used, provided the 'USBDIV' fuse is selected. If 'HS' is selected, the CPU clock comes from the crystal, while if 'HSPLL' is selected, the CPU clock comes from the USB PLL. PLL5, says divide the master clock by 5, to get the required 4MHz to feed the USB PLL. Then the 'CPUDIV' numbers, give the division used from the clock source (either the external crystal, or the USBPLL/2), to feed the CPU.
If the 'USBDIV' fuse is not selected, the USB clock comes directly from the external clock.
Start by getting the oscillators 'right'. Setup whichever one you want, set the 'clock' statement to match the CPU frequency, and run a simple 'output one pin high for one second, then low for one second' type program, to verify that the CPU _is_ running at the selected frequency. Once this is running, substitute these clock fuse settings, and clock statement, into the UB example, and try this.
As another 'caveat', add more smoothing to the regulator pin, than is specified in the data sheet. I have had problems with some batches of these chips not giving reliable operation. My standard setup now, is a 1uF electrolytic capacitor, in parallel with a 0.1uF ceramic capacitor on the regulator pin, and this (seems) to be reliable.
Yes, VREGEN, enables the internal regulator.

Best Wishes
Ttelmah
Guest







PostPosted: Fri Jan 11, 2008 3:56 am     Reply with quote

Going back to the first question, a 48MHz crystal, is not legitimate. You can use a 48Mhz external _oscillator_, but not a crystal. The internal oscillator is not specified to run above 25MHz.
Now, the 4MHz crystal, may also give problems. Though 'legitimate', on these PICs, I have seen problems with them. For some reason, the internal USB PLL, can behave 'oddly', with quite a few crystals. The chip works, and is clocking at the right rate, but the USB becomes unreliable.
So, I'd say, use a multiple of 4MHz. The 20MHz crystal (or an 8MHz, 12MHz etc.), would be my choice.
For the 20MHz crystal, you have the choice of running the processor, at 48MHz, 24MHz, 20MHz, 16MHz, 12MHz, 10MHz, 6.66MHz, or 5MHz. The normal fuse settings are:
Code:


HSPLL  PLL5 CPUDIV1 USBDIV   - 48MHz CPU
HSPLL  PLL5 CPUDIV2 USBDIV   - 24MHz CPU
HS PLL5 CPUDIV1 USBDIV         - 20MHz CPU
HSPLL PLL5 CPUDIV3 USBDIV    - 16MHz CPU
HSPLL PLL5 CPUDIV4 USBDIV    - 12MHz CPU
HS PLL5 CPUDIV2 USBDIV         - 10MHz CPU
HS PLL5 CPUDIV3 USBDIV         - 6.66MHz CPU
HS PLL5 CPUDIV4 USBDIV         - 5MHz CPU

The 'key' is that the USB PLL, is _always_ used, provided the 'USBDIV' fuse is selected. If 'HS' is selected, the CPU clock comes from the crystal, while if 'HSPLL' is selected, the CPU clock comes from the USB PLL. PLL5, says divide the master clock by 5, to get the required 4MHz to feed the USB PLL. Then the 'CPUDIV' numbers, give the division used from the clock source (either the external crystal, or the USBPLL/2), to feed the CPU.
If the 'USBDIV' fuse is not selected, the USB clock comes directly from the external clock.
Start by getting the oscillators 'right'. Setup whichever one you want, set the 'clock' statement to match the CPU frequency, and run a simple 'output one pin high for one second, then low for one second' type program, to verify that the CPU _is_ running at the selected frequency. Once this is running, substitute these clock fuse settings, and clock statement, into the UB example, and try this.
As another 'caveat', add more smoothing to the regulator pin, than is specified in the data sheet. I have had problems with some batches of these chips not giving reliable operation. My standard setup now, is a 1uF electrolytic capacitor, in parallel with a 0.1uF ceramic capacitor on the regulator pin, and this (seems) to be reliable.
Yes, VREGEN, enables the internal regulator.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group