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 CCS Technical Support

Spurious EEPROM writes

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



Joined: 07 Sep 2003
Posts: 40
Location: Adelaide, Australia

View user's profile Send private message

Spurious EEPROM writes
PostPosted: Thu Jul 22, 2004 5:46 am     Reply with quote

Hi

I seem to be getting EEPROM values changing for no valid reason on a 16F876 running at 4MHz. Using PCM v3.168. It seems that the first few locations (ie 0x2100 to about 0x2109) are being changed while the program runs.

This is where I store some calibration values, which the PIC calculates and writes at production. Is it possible to set and clear the EEPROM protect "CPD" fuse programatically? That way, when put in cal mode, I can enable EEPROM writes, store the cal values, and then disable EEPROM writes again.

Thanks
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Thu Jul 22, 2004 6:01 am     Reply with quote

Sounds like maybe your code it writing those values. One of the guys here had a similar problem. He was monitoring an input pin on startup to put the device into calibration mode. The device would sometimes go into calibration mode on power up due to the supply settling. A small delay at startup prevented this.
pat



Joined: 07 Sep 2003
Posts: 40
Location: Adelaide, Australia

View user's profile Send private message

PostPosted: Thu Jul 22, 2004 6:09 am     Reply with quote

Mark, yes I thought this as well. During maufacture, my PIC program is put into cal mode by a serial command from a PC. In operation, the device runs on a truck, which is electrically noisy, and I thought it may have been getting inadvertenly put into cal mode. I've now made the cal command a 3 character binary string, but it still seems to be happening!

I'm still unsure if the EEPROM is being corrupted, or its going into cal mode somehow.

I'd still like to know if the PIC can set/clear its own fuse values please, in particular, the "CPD" fuse at 0x2007 bit-8.

Thanks
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Thu Jul 22, 2004 6:39 am     Reply with quote

The configuration registers can only be written to during programming per the datasheet. There are various safe guards to prevent spurious writes. However, there is not protection to keep your code from "glitching" and going into your write routine. You could setup some sort of counter in a location and keep track of how many times it goes into calibration mode or change the location of the calibration data and see if the problem follows.
pat



Joined: 07 Sep 2003
Posts: 40
Location: Adelaide, Australia

View user's profile Send private message

PostPosted: Thu Jul 22, 2004 7:40 am     Reply with quote

Excellent ideas re my code glitching, I will implement them. And thanks for the config registers info.
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