View previous topic :: View next topic |
Author |
Message |
congthinh95
Joined: 31 Aug 2017 Posts: 7
|
Problem with XT_PLL4 in dspic30f6015 |
Posted: Sun Sep 03, 2017 12:45 am |
|
|
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: 19504
|
|
Posted: Sun Sep 03, 2017 3:34 am |
|
|
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: 9225 Location: Greensville,Ontario
|
|
Posted: Sun Sep 03, 2017 5:28 am |
|
|
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: 19504
|
|
Posted: Sun Sep 03, 2017 9:00 am |
|
|
and (of course) compiler version number.... |
|
|
congthinh95
Joined: 31 Aug 2017 Posts: 7
|
|
Posted: Mon Sep 04, 2017 12:36 pm |
|
|
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
|
|
Posted: Mon Sep 04, 2017 12:38 pm |
|
|
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
|
|
Posted: Mon Sep 04, 2017 12:39 pm |
|
|
I used CCS 5.0.15. :(
Ttelmah wrote: | and (of course) compiler version number.... |
_________________ Improve dspic more |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19504
|
|
Posted: Mon Sep 04, 2017 1:33 pm |
|
|
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. |
|
|
|