View previous topic :: View next topic |
Author |
Message |
Hans Wedemeyer
Joined: 15 Sep 2003 Posts: 226
|
How to access register at 0X300005 |
Posted: Thu Dec 18, 2003 8:32 pm |
|
|
PIC18F252
I need to set bit 0 of 0X300005 to 0
CONFIGURATION REGISTER 3 HIGH (CONFIG3H: BYTE ADDRESS 300005h)
Bit 0 is CCP2MX when set to 0 make Port B3 the output pin.
I seem to remember there is a way to do this with PCH
Data sheet implies it's the similar to writing eeprom... Either I made a mistake or it's lying to me... |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Thu Dec 18, 2003 8:53 pm |
|
|
It should be writing to program memory. I've never done it with CCS's function but it should do the trick. Try the write_program_memory() function.
Mark |
|
|
Hans Wedemeyer
Joined: 15 Sep 2003 Posts: 226
|
Chip no longer programs after using write_program_memory() |
Posted: Thu Dec 18, 2003 9:52 pm |
|
|
OK that compiled, and I ran it... it did not work as expected...but else something strange happened...
ICD-2 now reports this error !
ICD0161: Verify failed (MemType = Program, Address = 0x0, Expected Val = 0xEFE9, Val Read = 0x0)
ICD0275: Programming failed.
This is strange. I've been using this prototype for about 3 weeks and programmed it about 20 time today alone.
Is this a coincidence or what !
Did the write_program_memory() clobber something !
I tired programming a second prototype and did not try to run the code.
It still programs !
It's a SMD chip so not so easy to swap out... Arrrgh!
Just in case anyone is interested here is the code that I used.
int i;
Read_Program_Memory(0X300005,&i,1); // one byte at a time
bit_clear( i, 0 ); // 0 then RB3 is PWM o/p
Write_Program_Memory(0X300005,&i,1);
|
|
|
Hans Wedemeyer
Joined: 15 Sep 2003 Posts: 226
|
More info |
Posted: Thu Dec 18, 2003 9:56 pm |
|
|
I programmed the configuration bits only and here's the error messge.
ICD0161: Verify failed (MemType = Config, Address = 0x300001, Expected Val = 0x26, Val Read = 0x0)
ICD0275: Programming failed.
Looks like the chip got clobbered... |
|
|
Tom-H-PIC
Joined: 08 Sep 2003 Posts: 105 Location: New Castle, DE
|
FUSE setting? |
Posted: Thu Dec 18, 2003 9:58 pm |
|
|
Hello Hans
I think what you are looking for is a FUSE setting.
I’m using the 18F452 and in checking the valid #Fuse keywords.
This is what I found.
Code: | CCP2C1 CCP2 input/output multiplexed with RC1
CCP2B3 CCP2 input/output multiplexed with RB3
|
If these are the right fuses options CCS will set the configuration register for you.
Tom |
|
|
Hans Wedemeyer
Joined: 15 Sep 2003 Posts: 226
|
Write_Program_Memory destroyed the chip ! |
Posted: Thu Dec 18, 2003 10:05 pm |
|
|
I disconnected ICD-2 and cycled the power retsarted MPLAB and got this message when I tried to connect to the Debugger (ICD-2)
ICDWarn0020: Invalid target device id(expected-0x20, read=0x0)
The ICD-2 settings are correct. Connecting the the second protoype and MPLAB find the device no problem...
Whatever Wrtie_Program_memory() did it looks to me like it clobbered the chip ID location !
Anyone know a way to reset that !
I expect I'll have to change the chip.
|
|
|
Hans Wedemeyer
Joined: 15 Sep 2003 Posts: 226
|
Changed chip |
Posted: Thu Dec 18, 2003 10:54 pm |
|
|
Removed the SMD chip and soldered in a new one...
everything works.... |
|
|
Guest
|
Re: FUSE setting? |
Posted: Fri Dec 19, 2003 7:37 am |
|
|
Tom-H-PIC wrote: | Hello Hans
I think what you are looking for is a FUSE setting.
I’m using the 18F452 and in checking the valid #Fuse keywords.
This is what I found.
Code: | CCP2C1 CCP2 input/output multiplexed with RC1
CCP2B3 CCP2 input/output multiplexed with RB3
|
If these are the right fuses options CCS will set the configuration register for you.
Tom |
Tom,
Yes and it's also possible to set them in the configuration dialog of MPLAB.
However it's supposed to be "ok" to do it on the fly.... ! |
|
|
Tom-H-PIC
Joined: 08 Sep 2003 Posts: 105 Location: New Castle, DE
|
ICD settings |
Posted: Fri Dec 19, 2003 8:15 am |
|
|
Yes I agree that this option would be able to be changed on the fly.
But there must be an issues with changing the configuration register at 0x30000x address.
Hans now has a chip that is junk.
I do know one think that is that if you don’t have the ICD-UXX setup for “Bulk erase on wirte “ under the advanced settings. That the ID address at 0x200000 etc. will not get set to 0xFFFF.
I’m think that maybe that the configuration registers will not get reset 100% if ICD not set to “Bulk erase on wirte “.
Hans if you want to save that other chip check your ICD setting under advanced.
Tom |
|
|
Guest
|
Re: ICD settings |
Posted: Fri Dec 19, 2003 8:34 am |
|
|
Tom-H-PIC wrote: | Yes I agree that this option would be able to be changed on the fly.
But there must be an issues with changing the configuration register at 0x30000x address.
Hans now has a chip that is junk.
I do know one think that is that if you don’t have the ICD-UXX setup for “Bulk erase on wirte “ under the advanced settings. That the ID address at 0x200000 etc. will not get set to 0xFFFF.
I’m think that maybe that the configuration registers will not get reset 100% if ICD not set to “Bulk erase on wirte “.
Hans if you want to save that other chip check your ICD setting under advanced.
Tom |
Thanks I'll look at the bulk erase.
In the mentime I talked with Mark at CCS....
He thinks it may be an issue with the odd address. the pic18 needs to be read/written on even boundries. !
CCS is investigating, I post an update when I get one. |
|
|
|