View previous topic :: View next topic |
Author |
Message |
arunb
Joined: 08 Sep 2003 Posts: 492 Location: India
|
Unable to program configuration word using ICSP |
Posted: Sun Jun 04, 2006 3:16 am |
|
|
Hi,
MCU: 16F628
Compiler: PCM
I am able to succesfully program the Program memory, but I am unable to program the Configuration word.
The sequence of programming is as follows
1. Load Config command
2. Increment address 7 times
3. Load Config word
4. Begin Erase/programming cycle.
Please advise.....
thanks
arunb |
|
|
Ttelmah Guest
|
|
Posted: Sun Jun 04, 2006 4:12 am |
|
|
What voltage are you using.
The configuration memory, is special. It can _only_ be erased, using a 'full chip' erase, and high voltage prgramming. You cannot erase the config memory as a normal 'page', and you cannot erase it using LVP. Bits can be set as normal.
The reason for this, is to prevent people being able to bypass the code protection, by erasing just the config memory.
Best Wishes |
|
|
arunb
Joined: 08 Sep 2003 Posts: 492 Location: India
|
RE: |
Posted: Sun Jun 04, 2006 5:04 am |
|
|
Hi,
Thanks for the reply.
I am using 13 volts on MCLR to erase the Program Memory (Bulk Erase Setup 1, Bulk Erase Setup 2 sequence and Bulk Erase program memory), using the 6 bit commands.
Although the program memory gets written, I am unable to write to the configuration memory..
Just for curiousity ...
The Load Data command for program memory is used before sending a Program Memory word, this is followed by Begin Erase?program cycle command.
The configuration word is sent as follows
1. Load configuration command
2. Increment command 7 times
3. Send the configuration word LSB first...
4. Begin Erase/program cycle command
Shouldn't there be a command between 2 and 3 just before the configuration word is sent ???
kindly advise.....
thanks
arun |
|
|
Ttelmah Guest
|
|
Posted: Sun Jun 04, 2006 3:06 pm |
|
|
I am slightly puzzled by your references to 'erase' cycles, after the program cycles.
There are two different cycles available. A 'program/erase', and a 'program only'. For the configuration memory, you must use a bulk erase, followed by the data load, and then the 'program only' cycle. I suspect this is where your problem lies.
Best Wishes |
|
|
arunb
Joined: 08 Sep 2003 Posts: 492 Location: India
|
RE: |
Posted: Sun Jun 04, 2006 10:04 pm |
|
|
Hi,
I use the following steps
1. Load config command
2. advance PC 7 times
3. Load configuration word
4. Perform the Program only command for program memory
These steps still do not program the config memory
thanks
arunb |
|
|
Ttelmah Guest
|
Re: RE: |
Posted: Mon Jun 05, 2006 2:26 am |
|
|
arunb wrote: | Hi,
I use the following steps
1. Load config command
2. advance PC 7 times
3. Load configuration word
4. Perform the Program only command for program memory
These steps still do not program the config memory
thanks
arunb |
The flow appears right, but you have substituted different 'names' for parts of the cycles, and one may be causing the problem. The sequence should be:
Load configuration data
Advance PC 7 times
_Execute a load program data command_.
Perform program only command.
Note that you _do not use_ the 'load configuration data command for the data sent to the config word. The 'load configuration data' command, sets the address to the first byte of the config memory, and is only used to select the memory, with the first command. After this the other bytes are written using normal 'load data' commands. If you use a 'load configuration data' command, the byte will be put into the first location in config memory.
I suspect this is what is causing your problem.
Best Wishes |
|
|
arunb
Joined: 08 Sep 2003 Posts: 492 Location: India
|
RE: |
Posted: Mon Jun 05, 2006 6:44 am |
|
|
Hi,
Iam sorry but I am confused.. It might be better Idea if you could give the command in bits instead of names..
Load configuration: 000000
Load Data for program memory: XX0010
Increment Address: xx0110
Begin Program only: 011000
thanks
arunb |
|
|
|