CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Writing Configuration Memory

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ktallevi



Joined: 17 Dec 2005
Posts: 58

View user's profile Send private message

Writing Configuration Memory
PostPosted: Fri Dec 08, 2006 12:56 pm     Reply with quote

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?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Dec 08, 2006 2:07 pm     Reply with quote

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.
ktallevi



Joined: 17 Dec 2005
Posts: 58

View user's profile Send private message

Writing Configuration Memory
PostPosted: Fri Dec 08, 2006 2:21 pm     Reply with quote

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);
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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