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

Fusebit of PIC18F4550 with USB

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



Joined: 30 Jan 2015
Posts: 8

View user's profile Send private message

Fusebit of PIC18F4550 with USB
PostPosted: Tue May 09, 2017 3:01 pm     Reply with quote

Hello,
I am not sure why working configuration of fusebit for PIC18F4550 with USB and quartz 20MHz is:

Code:
#fuses HSPLL, NOWDT, NOPROTECT, NOLVP, NODEBUG, USBDIV, PLL5, CPUDIV1, VREGEN


and clock:

Code:
#use delay(clock=48000000)


I am looking at this:



and I am thinking that should be:

PLL5, CPUDIV4, HSPLL and clock=24MHz

http://ww1.microchip.com/downloads/en/DeviceDoc/39632e.pdf
page 33

Sorry, but I am stuck Embarassed
temtronic



Joined: 01 Jul 2010
Posts: 9097
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue May 09, 2017 4:02 pm     Reply with quote

You'll need to look at the 4550 'header' file that's the first line of your program to see how 'CPUDIV1' is defined.
It's been years since I used the 4550 but CPUDIV1 probably means 1st divider config for CPU, which is /2 , giving 48MHz clock.
I know I'd print out the page that had the 'clock flow' diagram and highlight the signal path I wanted.....as some pathways were NOT allowed if you wanted USB operation and had a 'wrong' xtal value.

Jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19215

View user's profile Send private message

PostPosted: Wed May 10, 2017 3:55 am     Reply with quote

This is one of those oddities caused by the CCS naming, and the chip itself.

If you connect the clock directly (not via the PLL), the four clock divisions available are /1 /2 /3 & /4. CCS called these CPUDIV1, CPUDIV2, CPUDIV3 & CPUDIV4.
However the same dividers, when used from the PLL, give /2, /3, /4 & /6.
So the divider called CPUDIV3, gives /4 from the PLL!... Similarly all the other dividers give different ratios.

I pointed this out to CCS, and said that it really would be better to call these by their 'binary' titles, or by names that made this clear. So (something like) CPUDIV00 CPUDIV01 (so the binary values), or CPUDIV1_2 CPUDIV2_3, giving the two divisions. Unfortunately since the existing vales had been published for some time, they felt it better to keep them.

All of the listed values are supported for USB. The ones highlighted are those supported for low speed USB. This requires a 24MHz clock.
defoxe



Joined: 30 Jan 2015
Posts: 8

View user's profile Send private message

PostPosted: Fri May 12, 2017 2:54 pm     Reply with quote

Thank you for answers, but I must have spend a little bit more time on this.
Ttelmah



Joined: 11 Mar 2010
Posts: 19215

View user's profile Send private message

PostPosted: Sat May 13, 2017 8:23 am     Reply with quote

The key point is to read the text under the table you show:

Quote:

Bold is used to highlight clock selections that are compatible with low-speed USB operation (system clock of 24 MHz, USB clock of 6 MHz).


All of the clock frequencies shown can be used for USB.
The ones shown in bold are the ones for low speed USB.
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