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

Problem with XT_PLL4 in dspic30f6015

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



Joined: 31 Aug 2017
Posts: 7

View user's profile Send private message

Problem with XT_PLL4 in dspic30f6015
PostPosted: Sun Sep 03, 2017 12:45 am     Reply with quote

I have problem when i use #use delay(clock=40Mhz,crystal=10Mhz).
When i test blink led with delay 1s, it blinks too slow. So can you help me to fix it ? Thank you so much!
_________________
Improve dspic more
Ttelmah



Joined: 11 Mar 2010
Posts: 19260

View user's profile Send private message

PostPosted: Sun Sep 03, 2017 3:34 am     Reply with quote

Have you actually proved the crystal is working?.
Post your fuses.

The obvious suspicion is that it doesn't think the crystal is there, and is 'falling back' to the RC oscillator. This can happen if the crystal gain is a little low, and it is not starting. This is why they recommend a resistor is present across the crystal. Typically perhaps 1M5R. This helps ensure the oscillator starts. Later DsPIC's have this built in the die, but the older ones like this don't.
temtronic



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

View user's profile Send private message

PostPosted: Sun Sep 03, 2017 5:28 am     Reply with quote

Another thought is that , if using MPLAB, the program was compiled in 'debug' mode and not 'release'.
Then to expand Mr. T.s comment.... PCB isn't correct, missing solder or 'extra', wrong xtal, wrong caps,...

Posting the '1Hz LED' program would help, as well as the compiler version and how you stuuf the code into the PIC (ie: IDE and programmer).

Once we know all this, then we can narrow down the reason to be either hardware, software or firmware.

Jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19260

View user's profile Send private message

PostPosted: Sun Sep 03, 2017 9:00 am     Reply with quote

and (of course) compiler version number....
congthinh95



Joined: 31 Aug 2017
Posts: 7

View user's profile Send private message

PostPosted: Mon Sep 04, 2017 12:36 pm     Reply with quote

My fuse is
#FUSES XT_PLL4
#FUSES NOWDT //No Watch Dog Timer
#FUSES CKSFSM //Clock Switching is enabled, fail Safe clock monitor is enabled
#FUSES BORRES //Reserved (do not use)
#FUSES NOBROWNOUT //No brownout reset
#FUSES MCLR //Master Clear pin enabled
#FUSES NOPROTECT //Code not protected from reading
//#fuses noput
#device ICSP=1
#use delay(crystal=10000000,clock=40000000)
Ttelmah wrote:
Have you actually proved the crystal is working?.
Post your fuses.

The obvious suspicion is that it doesn't think the crystal is there, and is 'falling back' to the RC oscillator. This can happen if the crystal gain is a little low, and it is not starting. This is why they recommend a resistor is present across the crystal. Typically perhaps 1M5R. This helps ensure the oscillator starts. Later DsPIC's have this built in the die, but the older ones like this don't.

_________________
Improve dspic more
congthinh95



Joined: 31 Aug 2017
Posts: 7

View user's profile Send private message

PostPosted: Mon Sep 04, 2017 12:38 pm     Reply with quote

Tks so much, if i use crystal =20Mhz, so what type of Caps i need to use?
temtronic wrote:
Another thought is that , if using MPLAB, the program was compiled in 'debug' mode and not 'release'.
Then to expand Mr. T.s comment.... PCB isn't correct, missing solder or 'extra', wrong xtal, wrong caps,...

Posting the '1Hz LED' program would help, as well as the compiler version and how you stuuf the code into the PIC (ie: IDE and programmer).

Once we know all this, then we can narrow down the reason to be either hardware, software or firmware.

Jay

_________________
Improve dspic more
congthinh95



Joined: 31 Aug 2017
Posts: 7

View user's profile Send private message

PostPosted: Mon Sep 04, 2017 12:39 pm     Reply with quote

I used CCS 5.0.15. :(
Ttelmah wrote:
and (of course) compiler version number....

_________________
Improve dspic more
Ttelmah



Joined: 11 Mar 2010
Posts: 19260

View user's profile Send private message

PostPosted: Mon Sep 04, 2017 1:33 pm     Reply with quote

That's not actually a CCS version number. They are in the format x.xxx
Look at the list file of in the help screen if you have the IDE for the compiler version. What you have there is the version as reported by Windows.
We need the version so we can test with the same compiler version and see what the fuses actually result in. It changes with some assumptions made by different compiler versions.
If it is 5.015, then this is quite an early V5 compiler.
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