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 CCS Technical Support

PIC18F27J53 missing fuses?

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



Joined: 01 Dec 2010
Posts: 25

View user's profile Send private message

PIC18F27J53 missing fuses?
PostPosted: Mon Dec 13, 2010 3:40 pm     Reply with quote

I have recently updated my compiler version to 4.114 in order to support a PIC18F27J53. It seems some of the fuses related to the oscillator are somehow missing. I'm attempting to use the internal RC oscillator with the PLL. The fuses are present in the .h file but the compiler does not recognise them:
Code:

Executing: "C:\Program Files (x86)\PICC\Ccsc.exe" +FH "main.c" +DF +LN +T +A +M +Z +Y=9 +EA
*** Error 111 "main.c" Line 10(7,30): Unknown keyword in #FUSES   "NOCPUDIV"
*** Error 111 "main.c" Line 13(7,30): Unknown keyword in #FUSES   "SOSC_HIGH"
*** Error 111 "main.c" Line 29(7,30): Unknown keyword in #FUSES   "LS48MHZ"
      3 Errors,  0 Warnings.
Halting build on first failure as requested.
BUILD FAILED: Mon Dec 13 21:34:10 2010


The lst file generated without the fuses looks like (last part only):
Code:

Configuration Fuses:
   Word  1: F49E   NODEBUG NOXINST NOSTVREN NOWDT NOPROTECT PLL1 PLLEN
   Word  2: F702   WDT128 NOFCMEN NOIESO INTRC_PLL_IO NOCLOCKOUT
   Word  3: FCFF   NOIOL1WAY MSSPMSK7 DSWDT2147483648 DSWDT DSBOR RTCOSC_T1 DSWDTOSC_INT ADC12 PLL
   Word  4: F3FF   NOWPCFG WPBEG WPDIS WPFP

The oscillator seems to be running very slow.
Code:

#use delay(clock=48000000)
setup_oscillator(OSC_PLL_ON);

Are both used. Can anyone help?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Dec 13, 2010 3:57 pm     Reply with quote

Post your attempt to make it work. Post a short test program to blink
an LED. Don't include any Wizard code. Example of short but complete
test programs to blink an LED:
http://www.ccsinfo.com/forum/viewtopic.php?t=42731
Bollo



Joined: 01 Dec 2010
Posts: 25

View user's profile Send private message

PostPosted: Mon Dec 13, 2010 4:59 pm     Reply with quote

Thanks for the rapid reply.

Code:

#include <18F27J53.h>

#FUSES NOWDT
#FUSES INTRC_PLL_IO
#FUSES PLLEN
#FUSES PLL1
 
#use delay(clock=48000000)

void main(){
   
setup_oscillator(OSC_PLL_ON);

   do{
      output_high(PIN_A1);
      delay_ms(100);
      output_low(PIN_A1);
      delay_ms(100);
   }
   while(1);
}


This code runs but the delay is close to 4 seconds not 100 ms which makes me think the oscillator is not set correctly. Obviously if I try the osc related fuses in my first post, it fails to compile.

Edit:

Also tried setup oscillator with "OSC_NORMAL" or'd in like the example posted, still the same.

2nd Edit:

After looking at the datasheet (page 36) it also seems the PLL requires a 4MHz input to multiply up to 48MHz therefore instead of PLL1, PLL2 is required to divide the 8MHz int osc down to 4MHz. Oddly though this does not change the delay length, still ~ 4 seconds. So it would appear I don't want to use the "NOCPUDIV" fuse after all. However I still wish to use the USB function so the "LS48MHZ" fuse problem still stands. Perhaps this is set to that by default. Either way (at least firstly) this now seems to be about correctly setting the oscillator. Any ideas where I'm failing? Embarassed
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Dec 13, 2010 6:39 pm     Reply with quote

I don't have this PIC to test, but try the following program and see if works:
Code:

#include <18F27J53.h>
#fuses INTRC_PLL_IO, PLL2, PLLEN, NOCPUDIV, NOWDT
#use delay(clock=48000000)

//=====================================
void main()
{
setup_oscillator(OSC_8MHZ | OSC_PLL_ON);

while(1)
  {
   output_high(PIN_A1);
   delay_ms(100);
   output_low(PIN_A1);
   delay_ms(100);
  }

}
Bollo



Joined: 01 Dec 2010
Posts: 25

View user's profile Send private message

PostPosted: Tue Dec 14, 2010 5:12 am     Reply with quote

Code:

*** Error 111 "main.c" Line 2(7,50): Unknown keyword in #FUSES   "NOCPUDIV"


I hit the unknown fuse problem again with NOCPUDIV.

With or'ing OSC_8MHZ, the clock is now faster, a 1000 ms delay set in code is 6000 ms in real time. Looking at the oscillator block diagram there is a CPU Divider after the PLL. It looks like it's defaulting to divide by 6. The compiler doesn't recognise CPUDIV6,CPUDIV3,CPUDIV2,NOCPUDIV which look like the fuses controlling that cpu divider.

Almost there! Thanks.
Ttelmah



Joined: 11 Mar 2010
Posts: 19568

View user's profile Send private message

PostPosted: Tue Dec 14, 2010 5:27 am     Reply with quote

It sounds like two separate problems.
The PLL2 one, which you have already tracked.
I'd suggest though that your device database is corrupted. The code as posted, with PLL2 selected, compiles fine for me on 4.114. Remove, and re-install the compiler. For some 'unknown' reason, sometimes the devices4.dat file gets corrupted, and gives behaviour exactly like you are seeing.

Best Wishes
Bollo



Joined: 01 Dec 2010
Posts: 25

View user's profile Send private message

PostPosted: Tue Dec 14, 2010 8:00 am     Reply with quote

It seems it was the location the compiler was installed to. I copied the PICC folder to another folder outside of program files and then it seem to work fine. I imagine it's due to the security restrictions applied to the program files folder by windows 7. Is CCSC attempting to open files (devices4.dat for example) read/write where it doesn't need to?
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