EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Reset and wrong value in eeprom

Started by Pascal January 11, 2007
Hello,

I write some values in the eeprom of 9s12dt128.

Before doing a hard reset (power off) if i read the content at 0x800 it is correct.

I do the hard reset and i follow this code with the debugger :

for(;;) { /* forever: initialize the program; call the root-procedure */

if (!(_startupData.flags&STARTUP_FLAGS_NOT_INIT_SP)) {
/* initialize the stack pointer */
INIT_SP_FROM_STARTUP_DESC(); /*lint !e522 asm code */ /* HLI macro definition in hidef.h */
}
/* Here user defined code could be inserted, the stack could be used */
//Dinition des registres de mappage
INITRG = 0; /* lock registers block to 0x0000 */
asm nop;
INITRM = 0x20; /* RAM de 0x2000 0x3FFF */
INITEE = 9; /* eeprom de 0x800 0xFFF */

When i pass the line INITEE=9 and see the content at 0x800 some values are wrong!!

I use CW3.1 and in the prm file i have EEPROM_AREA = NO_INIT 0x0800 TO 0x0FFF;

What could happen?

Thank you

Regards
Hello,

It is very strange. I have do some test on an other card and i have not this problem. I can't explain why i have it on my first card.
Strange...

Regards

----- Original Message -----
From: Pascal
To: 6...
Sent: Thursday, January 11, 2007 11:16 AM
Subject: [68HC12] Reset and wrong value in eeprom
Hello,

I write some values in the eeprom of 9s12dt128.

Before doing a hard reset (power off) if i read the content at 0x800 it is correct.

I do the hard reset and i follow this code with the debugger :

for(;;) { /* forever: initialize the program; call the root-procedure */

if (!(_startupData.flags&STARTUP_FLAGS_NOT_INIT_SP)) {
/* initialize the stack pointer */
INIT_SP_FROM_STARTUP_DESC(); /*lint !e522 asm code */ /* HLI macro definition in hidef.h */
}
/* Here user defined code could be inserted, the stack could be used */
//Dinition des registres de mappage
INITRG = 0; /* lock registers block to 0x0000 */
asm nop;
INITRM = 0x20; /* RAM de 0x2000 0x3FFF */
INITEE = 9; /* eeprom de 0x800 0xFFF */

When i pass the line INITEE=9 and see the content at 0x800 some values are wrong!!

I use CW3.1 and in the prm file i have EEPROM_AREA = NO_INIT 0x0800 TO 0x0FFF;

What could happen?

Thank you

Regards
--- In 6..., "Pascal" wrote:
>
> Hello,
>
> It is very strange. I have do some test on an other card and i have
not this problem. I can't explain why i have it on my first card.
> Strange...
>
> Regards
>
> ----- Original Message -----
> From: Pascal
> To: 6...
> Sent: Thursday, January 11, 2007 11:16 AM
> Subject: [68HC12] Reset and wrong value in eeprom
> Hello,
>
> I write some values in the eeprom of 9s12dt128.
>
> Before doing a hard reset (power off) if i read the content at
0x800 it is correct.
>
> I do the hard reset and i follow this code with the debugger :
>
> for(;;) { /* forever: initialize the program; call the root-
procedure */
>
> if (!(_startupData.flags&STARTUP_FLAGS_NOT_INIT_SP)) {
> /* initialize the stack pointer */
> INIT_SP_FROM_STARTUP_DESC(); /*lint !e522 asm code */ /* HLI macro
definition in hidef.h */
> }
> /* Here user defined code could be inserted, the stack could be
used */
> //Dinition des registres de mappage
> INITRG = 0; /* lock registers block to 0x0000 */
> asm nop;
> INITRM = 0x20; /* RAM de 0x2000 0x3FFF */
> INITEE = 9; /* eeprom de 0x800 0xFFF */
>
> When i pass the line INITEE=9 and see the content at 0x800 some
values are wrong!!
>
> I use CW3.1 and in the prm file i have EEPROM_AREA = NO_INIT
0x0800 TO 0x0FFF;
>
> What could happen?
>
> Thank you
>
> Regards
>
>
If I remember correctly, the Codewarrior debugger moves the EEPROM to
adress 0x2000 to be able to reach the RAM at 0x800 where they download
bootloader things. Have you tried to write a value to those cells
through the memory map? Ie, are you sure whether it is RAM or ROM?
Hello Daniel,

Thank you for your answer. I use the isystem debugger. Indeed, my ram is 0x2000 and my eeprom at 0x800. I don't undestand the problem. On one card when i pass INITEE=9 3 values are changed at 0x800!!!
And i am sure that before the hard reset the values are true.

Regards

----- Original Message -----
From: Daniel Lundin
To: 6...
Sent: Friday, January 12, 2007 8:52 AM
Subject: [68HC12] Re: Reset and wrong value in eeprom
--- In 6..., "Pascal" wrote:
>
> Hello,
>
> It is very strange. I have do some test on an other card and i have
not this problem. I can't explain why i have it on my first card.
> Strange...
>
> Regards
>
> ----- Original Message -----
> From: Pascal
> To: 6...
> Sent: Thursday, January 11, 2007 11:16 AM
> Subject: [68HC12] Reset and wrong value in eeprom
>
>
> Hello,
>
> I write some values in the eeprom of 9s12dt128.
>
> Before doing a hard reset (power off) if i read the content at
0x800 it is correct.
>
> I do the hard reset and i follow this code with the debugger :
>
> for(;;) { /* forever: initialize the program; call the root-
procedure */
>
> if (!(_startupData.flags&STARTUP_FLAGS_NOT_INIT_SP)) {
> /* initialize the stack pointer */
> INIT_SP_FROM_STARTUP_DESC(); /*lint !e522 asm code */ /* HLI macro
definition in hidef.h */
> }
> /* Here user defined code could be inserted, the stack could be
used */
> //Dinition des registres de mappage
> INITRG = 0; /* lock registers block to 0x0000 */
> asm nop;
> INITRM = 0x20; /* RAM de 0x2000 0x3FFF */
> INITEE = 9; /* eeprom de 0x800 0xFFF */
>
> When i pass the line INITEE=9 and see the content at 0x800 some
values are wrong!!
>
> I use CW3.1 and in the prm file i have EEPROM_AREA = NO_INIT
0x0800 TO 0x0FFF;
>
> What could happen?
>
> Thank you
>
> Regards
>
>
>
>

If I remember correctly, the Codewarrior debugger moves the EEPROM to
adress 0x2000 to be able to reach the RAM at 0x800 where they download
bootloader things. Have you tried to write a value to those cells
through the memory map? Ie, are you sure whether it is RAM or ROM?
--- In 6..., "Pascal" wrote:
>
> Hello Daniel,
>
> Thank you for your answer. I use the isystem debugger. Indeed,
> my ram is 0x2000 and my eeprom at 0x800. I don't undestand
> the problem. On one card when i pass INITEE=9 3 values are
> changed at 0x800!!! And i am sure that before the hard reset
> the values are true.

Could it be that in normal mode, INITEE is only writable once after reset?
Hello Jefferson,

I have this problem in normal mode. But it occurs less time than in debug mode (1/20 in normal mode and 1/1 in debug mode). Is it possible the eeprom has a problem? Strange!

Regards

----- Original Message -----
From: Jefferson Smith
To: 6...
Sent: Friday, January 12, 2007 3:17 PM
Subject: [68HC12] Re: Reset and wrong value in eeprom
--- In 6..., "Pascal" wrote:
>
> Hello Daniel,
>
> Thank you for your answer. I use the isystem debugger. Indeed,
> my ram is 0x2000 and my eeprom at 0x800. I don't undestand
> the problem. On one card when i pass INITEE=9 3 values are
> changed at 0x800!!! And i am sure that before the hard reset
> the values are true.

Could it be that in normal mode, INITEE is only writable once after reset?
--- In 6..., "Jefferson Smith" wrote:
>
> --- In 6..., "Pascal" wrote:
> >
> > Hello Daniel,
> >
> > Thank you for your answer. I use the isystem debugger. Indeed,
> > my ram is 0x2000 and my eeprom at 0x800. I don't undestand
> > the problem. On one card when i pass INITEE=9 3 values are
> > changed at 0x800!!! And i am sure that before the hard reset
> > the values are true.
>
> Could it be that in normal mode, INITEE is only writable once after reset?

We had a situation develop where after producing hundreds of units we all of a sudden were getting a percentage of boards that needed to be reprogrammed due to incorrect EEProm values.

We traced this to the increasing efficience of the people doing the programming, they switched the power of before the internal initialization was completed.

Since our program only checked the version no to determine if rerogramming the EE was needed, when it was powered up the second time it did't complete the cycle, the version had changed but not the rest, things you don't anticipate are legion.

Of course a full longitudal check is in the works:-)

Cheers,
Theo
Thank you Theobee0,

I will look at it

Regards

----- Original Message -----
From: theobee00
To: 6...
Sent: Sunday, January 14, 2007 10:26 PM
Subject: [68HC12] Re: Reset and wrong value in eeprom
--- In 6..., "Jefferson Smith" wrote:
>
> --- In 6..., "Pascal" wrote:
> >
> > Hello Daniel,
> >
> > Thank you for your answer. I use the isystem debugger. Indeed,
> > my ram is 0x2000 and my eeprom at 0x800. I don't undestand
> > the problem. On one card when i pass INITEE=9 3 values are
> > changed at 0x800!!! And i am sure that before the hard reset
> > the values are true.
>
> Could it be that in normal mode, INITEE is only writable once after reset?

We had a situation develop where after producing hundreds of units we all of a sudden were getting a percentage of boards that needed to be reprogrammed due to incorrect EEProm values.

We traced this to the increasing efficience of the people doing the programming, they switched the power of before the internal initialization was completed.

Since our program only checked the version no to determine if rerogramming the EE was needed, when it was powered up the second time it did't complete the cycle, the version had changed but not the rest, things you don't anticipate are legion.

Of course a full longitudal check is in the works:-)

Cheers,

Theo

The 2024 Embedded Online Conference