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

Bad reading from EEPROM

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



Joined: 25 Feb 2004
Posts: 28

View user's profile Send private message

Bad reading from EEPROM
PostPosted: Fri Apr 17, 2009 7:38 am     Reply with quote

Hello,

Has anybody had any experience of getting random bad readings from the onboard eeprom in the 18F8722. I am using compiler version 4.042 and using the standard functions for reading the code. The code I use is

Code:
   int8 temp1 = C_TRISTATE;
   int8 temp2 = C_TRISTATE;
   
      // read in the comms settings and mask of the Control bits
      temp1 = read_eeprom(CAM_CON1);
     
     
      // if both stored settings are the same
      if(temp1 ==  read_eeprom(CAM_CON2))
     {
           switch(temp1)
         {
         case C_TRISTATE:  Change_COMMS(&temp1);
                           break;           
                           
         case C_BIPOLER:   Change_COMMS(&temp1);
                           break;
                           
         case C_232:       Change_COMMS(&temp1);
                           break;
                           
         case C_485:       Change_COMMS(&temp1);
                           break;
                           
         case C_USB:       Change_COMMS(&temp1);
                           break;
                           
         default:          if(Save_COMMS(&temp1))
                           {
                              Change_COMMS(&temp1);
                           }                           
                           break;
         }
     }
      else
      {
        temp1 = C_TRISTATE;         
         Save_COMMS(&temp1);       
      }
     
      return temp1;

What I'm finding is that maybe 1 in 20 readings of the eeprom gives a bad result and the code goes straight the the "else" section as to be expected. But I can't see any reason for the code getting a bad reading from the eeprom.

Any help appreciated.

SandyW Question
Ttelmah
Guest







PostPosted: Fri Apr 17, 2009 8:51 am     Reply with quote

How often are you actually changing the 'written' value?.
The read, is normally 100% reliable, unless you have a supply noise problem (which can affect anything....). Writes are normally the cause of problems. It is so easy to use up the 'life' of the EEPROM, without realising it, and then get data errors from it...
Are you using interrupts?. Do you have Rev A1 silicon or Rev B?. If the former, you might be hitting the Wreg corruption problem that can occur on these chips with interrupts.

Best Wishes
sandy wilson



Joined: 25 Feb 2004
Posts: 28

View user's profile Send private message

bad reading from eeprom
PostPosted: Mon Apr 20, 2009 2:51 am     Reply with quote

Thank you for your reply Ttelmah.

There has been very few writes to the eeprom since it only happens when the user changes the control mode. Granted I have done a few writes since then as part of testing but it should be no where near the 100,00 or so that is allowed.

I'm not sure how to check the chip markings for the silicon issue (Rev A1 or B).

The markings on the chip are:

PIC18F8722
-1/PT ( then an e3 in a circle)
08206PU

I'm assuming that the -1/PT is the silicon issue but I don't know how to tell what the issue is.

I've also found the Rev1 errata from microchip and they say:

The Device IDs (DEVID1 and DEVID2) are located at
addresses 3FFFFEh:3FFFFFh in the device’s
configuration space. They are shown in hexadecimal
in the format “DEVID2 DEVID1”.

So I presume the way to find out what silicon revision my chip is is to read these locations and if so how do I get at these locations?

Thanks for any help

SandyW
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