View previous topic :: View next topic |
Author |
Message |
Jerry R
Joined: 25 Apr 2007 Posts: 23
|
Int EE is volitile on specific PC |
Posted: Fri Jun 01, 2007 7:19 am |
|
|
CCS PCWH v3.249. Windows XP Pro
This one is weard. I've been having all manner of problems writing / reading to internal EEPROM. I have recently confirmed that the int EEPROM is volitile in a 16F877A or 16F877 when my ICD-U links to the target on a specific PC. This problem exists using Ex_IntEE.c code on the CCS evaluation board. Apparently, the ICD-U is erasing the EEPROM when sending new code to the target when I work on this specific PC.
I have set Erase Modes to Erase when needed under the ICD-U's Advanced set-up.
Could there be anything else that a set-up file (specific to a PC) would be influencing the intEE erase?
Thanks for any steer. This has blown a lot of coding hours in troubleshooting. |
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Fri Jun 01, 2007 7:39 am |
|
|
If you have it set to overwrite, and there are data EEPROM values, I would expect that the ICD-U does just what you said, overwrites it.
If you don't want it to overwrite the eeprom, change that setting to No Erase
Quote: | Erase Modes
--------------------------------------------------------------------------------
The erase modes effect how the target is erased before programming.
Bulk Erase on write-This will perform a bulk erase on the entire chip.
Erase when needed-This will erase only the area of memory that needs to be erased. If the file being programmed contains program memory instructions, the entire program memory will be erased. If the file being programmed contains data EEPROM values, the entire data EEPROM will be erased. Bulk erase will still be used if the target is code protected.
No Erase-This programs the target without erasing it. This can only be used with normal programming mode as it erases before programming.
|
Last edited by treitmey on Fri Jun 01, 2007 7:45 am; edited 1 time in total |
|
|
Guest
|
|
Posted: Fri Jun 01, 2007 7:44 am |
|
|
treitmey:
Thanks for the quick reply. I think I've already set the Erase Mode to "Erase when Needed". I have confirmed that this mode is not changed between "Good" and "Bad" PCs. This box is under the ADVANCED area on the ICD-U set-up screen.
Please excuse me if I'm misunderstanding your reply. Is there a box I've not seen? Would really like to find it.
Thanks again,
Jerry |
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Fri Jun 01, 2007 7:46 am |
|
|
Yes thats the one. Lower right, advanced, erase mode.
Was your test done in normal programming mode or fast? see above quote |
|
|
Jerry R
Joined: 25 Apr 2007 Posts: 23
|
|
Posted: Fri Jun 01, 2007 7:54 am |
|
|
treitmey:
Thanks again for the reply. OK, I think I may now understand your first reply. Are you suggesting "ticking" the box NO ERASE instead of ERASE WHEN NEEDED ?
The way I'm troubleshooting is I'm writing data to EEPROM, confirming that it is there before a power down, then powering back up to find no EEPROM data.
Thanks again!
Jerry |
|
|
Jerry R
Joined: 25 Apr 2007 Posts: 23
|
|
Posted: Fri Jun 01, 2007 7:58 am |
|
|
treitmey:
ICD-U set for Normal (3V or 5V) mode.
Thanks. |
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Fri Jun 01, 2007 8:11 am |
|
|
Your test should be done with "No erase" and "Normal Programming".
Is your hardware fixed now? |
|
|
Jerry R
Joined: 25 Apr 2007 Posts: 23
|
|
Posted: Fri Jun 01, 2007 8:19 am |
|
|
Hello treitmey:
Well hooked target and ICD-U back to the "BAD" PC. Confirmed that Normal Programming is set and that No Erase is set under ICD Advanced screen. Same problem and only with that PC!!. Apparently, the EE data is getting erased during ICD's Attach / Load sequence. I did not remove power from the target, just reloaded the code into the target. Previously stored data in the EEPROM (as viewed on the Debug Window's EE Data screen) was all returned to 0xFF.
Any more suggestions? Thanks again for your interest in my problem!
Best regards |
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Fri Jun 01, 2007 8:33 am |
|
|
Any chance you have a mplab setup we can cross check this against?
I'm wondering if the eeprom windows in debug isn't updated.
Is there a refresh? |
|
|
Jerry R
Joined: 25 Apr 2007 Posts: 23
|
|
Posted: Fri Jun 01, 2007 8:38 am |
|
|
treitmey:
Sorry, not using MPLab here.
After Attaching / Loading I do a refresh on EEPROM data and all back to FF. Data retrieved by my target program also confirms that the old EEData has been overwritten (cleared) to FF.
I am using v 1.39 CCS F/W in the debugger, if this is any help.
Thanks again |
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Fri Jun 01, 2007 9:06 am |
|
|
My ICD-40 did the same thing.
EEPROM:
01 02 03 04 ff ff ff ff ff
ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff
data not expected to change.
EEPROM:
1a 1b 1c 1d ff ff ff ff ff
ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff
Code: | #define FIRM_MINOR 17
#define FIRM_MAJOR 'K'
#define HARD_MAJOR 0
#define HARD_MINOR 0
#include <16F877a.h>
#device *=16
#fuses hs,wdt,noprotect,nolvp,put
#use delay(clock=11059200,RESTART_WDT)
#use rs232(baud=19200,xmit=PIN_B3,invert,stream=debug)
#use rs232(xmit=PIN_C6,rcv=PIN_C7,enable=PIN_C5,baud=1200,bits=8,parity=e,errors,stream=CIM)
#case
#zero_ram
//========================= Defines ================================//
#rom 0x2100={26,27,28,29}
//========================= Main ====================================//
void main(void)
{
int i,j;
fprintf(DEBUG,"\n\r\nEEPROM:\n\r"); // Display contents of the first 64
for(i=0; i<=3; ++i) { // bytes of the data EEPROM in hex
for(j=0; j<=15; ++j) {
printf( "%2x ", read_eeprom( i*16+j ) );
}
printf("\n\r");
}
printf("\r\nLocation to change: ");
while(1)
{
}
}
|
|
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Fri Jun 01, 2007 9:17 am |
|
|
Why do you need to leave a section of data eeprom alone.
Perhaps there is another way to solve your problem. |
|
|
Jerry R
Joined: 25 Apr 2007 Posts: 23
|
|
Posted: Fri Jun 01, 2007 9:32 am |
|
|
treitmey:
Well, I don't want to reload user specified data into EEPROM every time I run a debug. My program prompts user for floating point data and manipulates it during run-time. With the current malidy, I have to reload 40 EE data locations evertime I debug the code. A BIG HASSLE 8-(
Your telling me your debugger (same as mine) resets EEPROM data as well after linking to your target even with No Erase set?
Thanks for your help!
JR |
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Fri Jun 01, 2007 10:16 am |
|
|
yes, it seems to have. I tried some work with mplab,... but
now I'm putting out a fire at work. I'll get back to you when I can.
sorry |
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Fri Jun 01, 2007 10:41 am |
|
|
Got it working,.. my issue was running 2 versions of ICD-U40 software..
the setting were not in changed in the version I ran.
this is 2 runs.
1)ICD-u40 program, then run,
2)recompile with #rom commented out, recompile, program, run.
see how second run isn't overwritten.
You could comment out the #rom with a ifdef statment and use an envirenment variable.
Code: |
#define FIRM_MINOR 17
#define FIRM_MAJOR 'K'
#define HARD_MAJOR 0
#define HARD_MINOR 0
#include <16F877a.h>
#device *=16
#fuses hs,nowdt,noprotect,nolvp,put
#use delay(clock=11059200,RESTART_WDT)
#use rs232(baud=19200,xmit=PIN_B3,invert,stream=debug)
#case
//#zero_ram
#rom 0x2100={1,2,3,4}
void main() {
BYTE i, j, address, value;
fprintf(DEBUG,"\r\n\nICD-U40 EEPROM:\r\n");// Display contents of the first 64
for(i=0; i<=3; ++i) { // bytes of the data EEPROM in hex
for(j=0; j<=15; ++j) {
printf( "%2x ", read_eeprom( i*16+j ) );
}
}
printf("\n\r");
address = 0x2102;
value = 0xBB;
write_eeprom( address, value );
fprintf(DEBUG,"\r\n\nUser change 0x2102 to 0xBB \r\n");// Display contents of the first 64
for(i=0; i<=3; ++i) { // bytes of the data EEPROM in hex
for(j=0; j<=15; ++j) {
printf( "%2x ", read_eeprom( i*16+j ) );
}
}
while (1);
}
|
Quote: |
------------1st run -------------------
ICD-U40 EEPROM:
01 02 03 04 ff ff ff ff ff
ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff
ff
User change 0x2102 to 0xBB
01 02 bb 04 ff ff ff ff ff
ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff
ff
-------------2nd run ----------------
ICD-U40 EEPROM:
01 02 bb 04 ff ff ff ff ff
ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff
ff
User change 0x2102 to 0xBB
01 02 bb 04 ff ff ff ff ff
ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff
ff
|
|
|
|
|