View previous topic :: View next topic |
Author |
Message |
AbuSaleh
Joined: 09 Dec 2012 Posts: 14
|
dspic30f programming problem |
Posted: Mon Mar 11, 2013 3:21 am |
|
|
I'm having a problem with dspic30f6014a programming. I have edited the code using CCS compiler PCW v4.104. When I import the hex file into MPLAB IDE v8.83, I get the following message:
" The configuration bits in the file are invalid and may cause problems if programmed.
Do you want to set them to their default value?
Please note that you will need to either rebuild the file or export memory again to correct the file.
Config Field : FOSFPR "
I tried to change the configuration bits manually from MPLAB "Configure" menu but the problem is still exist. Any help please ? The C code for configuration is:
Code: | #include <30f6014a.h>
#device adc=10
#fuses XT_PLL8, NOWDT, NOBROWNOUT, NOPUT
#use delay(clock=58.9824M,oscillator=7.3728M)
#use rs232(baud=9600,parity=N,UART1,bits=8)
#include <math.h> |
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19520
|
|
Posted: Mon Mar 11, 2013 4:25 am |
|
|
I'd suspect the problem is coming from one thing overriding another.
Your 'clock', and 'oscillator' frequencies are not exactly 8* each other. Now if I try your combination of fuses and clock settings, the compiler 'baulks' and the fuses are wrong in the file. However simplify slightly, and:
Code: |
#include <30F6014A.h>
#FUSES WPSA8,WPSB1,XT_PLL8, NOCKSFSM, NOWDT, PUT,NOBROWNOUT
#use delay(clock=58982400)
|
and the fuses look acceptable.
Load this into MPLAB, and it doesn't complain.
I'd always say use the PUT with a crystal, unless you are using the dual speed startup.
'oscillator=X', will select EC, not XT. 'crystal=X' would be the right selection, but only use the 'double' selection if you want the compiler to try to select the PLL. Given you have selected it yourself, just put the final clock rate.
Best Wishes |
|
|
AbuSaleh
Joined: 09 Dec 2012 Posts: 14
|
|
Posted: Mon Mar 11, 2013 4:45 am |
|
|
Thank you Ttelmah for your quick reply. I have copied your code to my program, but when I compile it by CCS I get the following error:
Error 111 : Unknown keyword in #FUSES "PUT"
What do you think the problem is ?
Thanx |
|
|
AbuSaleh
Joined: 09 Dec 2012 Posts: 14
|
|
Posted: Mon Mar 11, 2013 5:13 am |
|
|
Hi Ttelmah !
I went to the PCW pull down menu VIEW | Valid fuses and it showed all fuses with their descriptions. Regarding PUT fuse there are 3 types; PUT4, PUT16 and PUT64. And in the description it says that the numbers 4, 16 and 64 mean 4ms, 16ms and 64ms, respectively, but I dont know which one to choose. Any suggestions ?
Thanx |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19520
|
|
Posted: Mon Mar 11, 2013 5:29 am |
|
|
Depends how long your crystal needs to settle, but 4mSec should be plenty. If you don't specify 'NOPUT' (which is what I did), it defaults to PUT64.
Best Wishes |
|
|
AbuSaleh
Joined: 09 Dec 2012 Posts: 14
|
|
Posted: Mon Mar 11, 2013 1:00 pm |
|
|
Thanks alot ! |
|
|
|