|
|
View previous topic :: View next topic |
Author |
Message |
Guest
|
Bug with configuration bits in PIC18F2520? |
Posted: Tue Sep 27, 2005 8:42 am |
|
|
CCS generates:
Configuration Fuses:
Word 1: 0800 NOIESO NOFCMEN INTRC_IO
Word 2: 1EE8 NOBROWNOUT NOWDT BORV27 PUT
Word 3: 8700 PBADEN CCP2C1 LPT1OSC MCLR
Word 4: 0041 STVREN DEBUG NOLVP XINST
Word 5: C00F NOPROTECT NOCPD NOCPB
Word 6: E00F NOWRT NOWRTD NOWRTC NOWRTB
Word 7: 400F NOEBTR NOEBTRB
According to data sheet: CONFIG2H
bit7-5 Unimplemented: Read as '0'
Hence my problem with the configuration never verifying correctly!
How can I work around this and force the correct Word 2 for this device? Is there a way to manually set configuration bits? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Sep 27, 2005 12:43 pm |
|
|
You didn't post your #fuses statement or your compiler version,
so I made the test file below, to try to get close to what you're doing.
I compiled it with PCH vs. 3.235. It gave the following Config bits:
Code: | Configuration Fuses:
Word 1: 0800 NOIESO NOFCMEN INTRC_IO
Word 2: 0E10 NOBROWNOUT WDT128 NOWDT BORV27 PUT
Word 3: 8300 PBADEN CCP2C1 NOLPT1OSC MCLR RESERVED
Word 4: 0081 STVREN NODEBUG NOLVP NOXINST RESERVED
Word 5: C00F NOPROTECT NOCPD NOCPB
Word 6: E00F NOWRT NOWRTD NOWRTC NOWRTB
Word 7: 400F NOEBTR NOEBTRB |
If you have PCWH, it's possible that you could use the Device Editor
to fix the fuses. If not, I think you have to upgrade the compiler.
See this thread: http://www.ccsinfo.com/forum/viewtopic.php?t=24380
In the past, I've tried to override the #fuses settings with a #rom
statement, and I think I was able to get the override values into the
HEX file, but it didn't get picked up by MPLAB and ICD2. So it's not
a convenient solution.
Code: | #include <18F2520.h>
#fuses INTRC_IO, NOWDT, NOPROTECT, PUT, NOBROWNOUT, NOLVP, BORV27, WDT128
#use delay(clock=4000000)
void main()
{
while(1);
} |
|
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Tue Sep 27, 2005 1:23 pm |
|
|
Quote: | In the past, I've tried to override the #fuses settings with a #rom
statement, and I think I was able to get the override values into the
HEX file, but it didn't get picked up by MPLAB and ICD2. So it's not
a convenient solution. |
If its in the hex file and you import the hex file it should get picked up by MPLAB. |
|
|
StuartH
Joined: 19 Aug 2005 Posts: 14 Location: W. Midlands, UK
|
|
Posted: Tue Sep 27, 2005 3:13 pm |
|
|
I've had problems with this device with the brownout voltage select not programming correctly. It didn't matter in my application so I just ignored it, although this fuse worked properly in a 4520.
I don't know if this is a CCS problem as much as a(nother) Microchip silicon problem with this device.
Interestingly, I just checked the Microchip site five minutes ago (to see if they've updated the silicon yet) and they now list the 18F2520 as a "Future Product" So how come I was able to buy a bucketload of the things from Farnell two months ago? And they list them as being in stock now. I'm reasonably sure that when I last looked, the status was "In Production" (the 4520 is). The plot thickens... |
|
|
Guest
|
|
Posted: Wed Sep 28, 2005 1:35 am |
|
|
aSorry. It's version 3.212 which I am happy with apart from this problem:
Code: | #include <18F2520.h>
#device icd=true
#device adc=10
#fuses INTRC,PUT,NOWDT,DEBUG,NOLVP,MCLR,NOFCMEN,NOIESO,NOBROWNOUT,NOXINST
#use delay(clock=8000000) |
Generates:
Code: | Word 2: 1EE8 NOBROWNOUT NOWDT BORV27 PUT |
the "E" in the high byte which should be a zero which is causing the problem as the PIC by definition always returns a "0".
I also can't get the IDE to recognise the #device icd=true when I try and debug, it always insists on adding the line itself!
If these are fixed in the later version I guess I am going to have to bite the bullet and upgrade.
Thanks for you help with this, much appreciated. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Sep 28, 2005 11:46 am |
|
|
I created the following test program based on your posted code:
Code: | #include <18F2520.h>
#device icd=true
#device adc=10
#fuses INTRC,PUT,NOWDT,DEBUG,NOLVP,MCLR,NOFCMEN,NOIESO,NOBROWNOUT,NOXINST
#use delay(clock=8000000)
void main(void)
{
while(1);
} |
I compiled it with PCH vs. 3.235. Here are the fuses from the .LST file:
Code: | Configuration Fuses:
Word 1: 0900 NOIESO NOFCMEN INTRC
Word 2: 1E19 NOBROWNOUT NOWDT BORV20 NOPUT WDT32768
Word 3: 8300 PBADEN CCP2C1 NOLPT1OSC MCLR RESERVED
Word 4: 0000 NOSTVREN DEBUG NOLVP NOXINST RESERVED
Word 5: C00F NOPROTECT NOCPD NOCPB
Word 6: E00F NOWRT NOWRTD NOWRTC NOWRTB
Word 7: 400F NOEBTR NOEBTRB |
|
|
|
Guest
|
|
Posted: Fri Sep 30, 2005 1:09 am |
|
|
It would appear it's fixed.
CONFIG2H
bit7-5 Unimplemented: Read as '0'!
From an early post: I also bought mine through Farnell in the UK. I usually us the 18F252 but the '0' part has a faster internal oscillator which I needed.
Thank you all |
|
|
|
|
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
|