View previous topic :: View next topic |
Author |
Message |
ktallevi
Joined: 17 Dec 2005 Posts: 58
|
Writing Configuration Memory |
Posted: Fri Dec 08, 2006 12:56 pm |
|
|
Im writing a bootloader for a PIC18F8722 and seem to be having an issue. The command write_configuration_memory crashes/freezes the program.
Here is a small snippet of the code...
int ConfigMemoryRegister[3];
ConfigMemoryRegister[0] = 0x00;
ConfigMemoryRegister[1] = 0x43;
ConfigMemoryRegister[2] = 0x16;
write_configuration_memory(ConfigMemoryRegister, 3);
I halt the program and read the chip, the configuration memory DOES get changed successfully, but there still seems to be something causing the program to crash.
any ideas? |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Dec 08, 2006 2:07 pm |
|
|
I've never tried to write the Config bits while the program is running,
so I don't know if this works.
But, reading the CCS manual, it says this:
Quote: |
write_configuration_memory (dataptr, count)
Erases all fuses and writes count bytes from the dataptr
to the configuration memory. |
All fuses are erased, but you're only re-writing the first three.
That might be the problem, or at least part of it. |
|
![](templates/subSilver/images/spacer.gif) |
ktallevi
Joined: 17 Dec 2005 Posts: 58
|
Writing Configuration Memory |
Posted: Fri Dec 08, 2006 2:21 pm |
|
|
Thanks PCM Programmer, it appears the program does NOT crash if you write all 14 bytes, eg.
int ConfigMemoryRegister[14];
ConfigMemoryRegister[0] = 0x00;
ConfigMemoryRegister[1] = 0x42;
ConfigMemoryRegister[2] = 0x1E;
ConfigMemoryRegister[3] = 0x0E;
ConfigMemoryRegister[4] = 0xF3;
ConfigMemoryRegister[5] = 0x87;
ConfigMemoryRegister[6] = 0xA0;
ConfigMemoryRegister[7] = 0x00;
ConfigMemoryRegister[8] = 0xFF;
ConfigMemoryRegister[9] = 0xC0;
ConfigMemoryRegister[10] = 0xFF;
ConfigMemoryRegister[11] = 0xE0;
ConfigMemoryRegister[12] = 0xFF;
ConfigMemoryRegister[13] = 0x40;
write_configuration_memory(0,ConfigMemoryRegister, 14); |
|
![](templates/subSilver/images/spacer.gif) |
|