Sign in

username:

password:



Not a member?

Search avrclub



Search tips

Subscribe to avrclub



avrclub by Keywords

AT90S2313 | AT90S8515 | ATMega | ATmega128 | ECL | FETS | IAR | Keyboard | LCD | STK50 | TMOS | UART

Ads

Discussion Groups

Discussion Groups | AVRclub | [AVR club] Problem with ATMEga32 EEPROM

Atmel AVR Microcontroller discussion group.

[AVR club] Problem with ATMEga32 EEPROM - "Niyaz K.Zubair" - Jun 23 17:47:03 2006

hi all....

can any one help me on this??
My ATMEga32 EEPROM is not retaining data after AVR reset
When I first write the data into EEPROM, and then read ,
I could read back the correct data.
but it returnes back '0xFF' if i read after reset.
why is it so?
Note: I am powering my uC from USB...
regards
niyaz
[Non-text portions of this message have been removed]





(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )


Re: [AVR club] Problem with ATMEga32 EEPROM - =?windows-1250?B?UuFjeiBLcmlzenRp4W4=?= - Jun 24 10:27:29 2006

SFkgTml5YXogSy5adWJhaXI6IA0KDQogRG9udCB1c2UgMGggYWRyZXNzLGJlY2F1c2UgaXQg
aXMgaW5jb3JyZWN0IGluIEFWUi4gDQogV2hlbiB5b3Ugd3JpdGUgdGhlIEVFUFJPTSB3YWl0
IDhtcyBiZWZvcmUgcmVhZCBpdCwgb3IgdXNlIHRoZSBFRVBST00gUkVBRFkgaW50ZXJydXB0
Lg0KRG8geW91IGVuYWJsZSB0aGUgd3JpdGUgYW5kIHJlYWQgaW4gdGhlIEVFQ1I/DQogIA0K
UmVnYXJkczoNCg0KS3Jpc3p0aWFuDQpjcmlzYm95QGZyZWVtYWlsLmh1ICAgICAgICAgICAg
ICAgIA0KMjAwNi0wNi0yNCAgICAgIA0KDQo9ID0gPSA9ID0gPSA9ID0gPSA9ID0gPSA9ID0g
PSA9ID0gPSA9ID0gPSA9DQogDQo9PT09PT09PSAyMDA2LTA2LTI0LCAwMDowMjowNyDtcnRh
OiA9PT09PT09PQ0KDQpoaSBhbGwuLi4uDQoNCmNhbiBhbnkgb25lIGhl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JvdXBzIExpbmtzCgo8Kj4gVG8gdmlzaXQgeW91ciBncm91
cCBvbiB0aGUgd2ViLCBnbyB0bzoKICAgIGh0dHA6Ly9ncm91cHMueWFob28uY29tL2dyb3Vw
L2F2cmNsdWIvCgo8Kj4gVG8gdW5zdWJzY3JpYmUgZnJvbSB0aGlzIGdyb3VwLCBzZW5kIGFu
IGVtYWlsIHRvOgogICAgYXZyY2x1Yi11bnN1YnNjcmliZUB5YWhvb2dyb3Vwcy5jb20KCjwq
PiBZb3VyIHVzZSBvZiBZYWhvbyEgR3JvdXBzIGlzIHN1YmplY3QgdG86CiAgICBodHRwOi8v
ZG9jcy55YWhvby5jb20vaW5mby90ZXJtcy8KIAo=



(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )

Re: [AVR club] Problem with ATMEga32 EEPROM - "Niyaz K.Zubair" - Jun 25 17:26:27 2006

hi Krisztian,

Thank you for your kind response...

I am writing to 3 locations..0x00,0x03 and 0x08... and the case is same wit=
h
all locations...means all are returning 0xFF.

My code looks like,

void EEPROM_write(unsigned int Eeprom_Address, unsigned char Data)
{
/* Wait for completion of previous write */
while(EECR & (1< ;
/* Set up address and data registers */
EEAR =3D Eeprom_Address;
EEDR =3D Data;
/* Write logical one to EEMWE */
EECR |=3D (1< /* Start eeprom write by setting EEWE */
EECR |=3D (1< }

unsigned char EEPROM_read(unsigned int Eeprom_Address)
{
/* Wait for completion of previous write */
while(EECR & (1< ;
/* Set up address register */
EEAR =3D Eeprom_Address;
/* Start eeprom read by writing EERE */
EECR |=3D (1< /* Return data from data register */
return EEDR;
}
can you respond is it okay?

regards
niyaz
India

On 6/24/06, R=E1cz Kriszti=E1n wrote:
>
> HY Niyaz K.Zubair:
>
> Dont use 0h adress,because it is incorrect in AVR.
> When you write the EEPROM wait 8ms before read it, or use the EEPROM READ=
Y
> interrupt.
> Do you enable the write and read in the EECR?
>
> Regards:
>
> Krisztian
> c...@freemail.hu
> 2006-06-24
>
> =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =
=3D =3D =3D =3D
>
> =3D=3D=3D=3D=3D=3D=3D=3D 2006-06-24, 00:02:07 =EDrta: =3D=3D=3D=3D=3D=3D=
=3D=3D
>
> hi all....
>
> can any one help me on this??
> My ATMEga32 EEPROM is not retaining data after AVR reset
> When I first write the data into EEPROM, and then read ,
> I could read back the correct data.
> but it returnes back '0xFF' if i read after reset.
> why is it so?
> Note: I am powering my uC from USB...
>
> regards
> niyaz
>
> [Non-text portions of this message have been removed]
> _____________ NOD32 1.1537 (20060514) Inform=E1ci=F3 _____________
>
> Az =FCzenetet a NOD32 antivirus system megvizsg=E1lta.
> http://www.nod32.hu
>
=20



(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )

RE: [AVR club] Problem with ATMEga32 EEPROM - Juan Gabriel Aldana - Jun 26 9:15:09 2006

Hi,
=20=20=20
Can you post the code that write and read the EEPROM memory?
your main function is sobrewriting the eeprom ???

"Niyaz K.Zubair" escribi=F3:
hi all....

can any one help me on this??
My ATMEga32 EEPROM is not retaining data after AVR reset
When I first write the data into EEPROM, and then read ,
I could read back the correct data.
but it returnes back '0xFF' if i read after reset.
why is it so?
Note: I am powering my uC from USB...

regards
niyaz

[Non-text portions of this message have been removed]

=20

=20

=20


(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )

Re: Re: [AVR club] Problem with ATMEga32 EEPROM - =?windows-1250?B?UuFjeiBLcmlzenRp4W4=?= - Jun 26 12:07:32 2006

Hy Niyaz K.Zubair: =0D
=0D
try this:=0D
=0D
void EEPROM_write(unsigned int Eeprom_Address,unsigned char Data)=0D
{=0D
unsigned char test=3DEECR;=0D
while(test&(1< {=0D
test=3DEECR;=0D
}=0D
EEAR=3DEeprom_Adress;=0D
EEDR=3DData;=0D
/* Write logical one to EEMWE */=0D
EECR |=3D (1< /* Start eeprom write by setting EEWE */=0D
EECR |=3D (1< }=0D
=0D
Some compiller not compiling correct code if you testing a register in "if"=
or "while" etc.=0D
=0D
I use this code:=0D
=0D
;**************************************************************************=
**=0D
;reading 1 byte from eeprom=0D
;jobreg=3Dreading adress, and returned data=0D
eepbytein:=0D
sbic EECR,EEWE ;wait until eeprom not ready=0D
rjmp eepbytein=0D
out EEAR,jobreg ;set address=0D
sbi EECR,EERE ;set reading flag=0D
in jobreg,EEDR ;read data =0D
ret=0D
;**************************************************************************=
*=0D
;write 1 byte to eeprom=0D
;jobreg: adress=0D
;datareg:data=0D
eepbyteout:=0D
sbic EECR,EEWE ;wait until eeprom not ready=0D
rjmp eepbyteout=0D
out EEAR,jobreg ;set adress=0D
out EEDR,datareg ;set data=0D
sbi EECR,EEMWE ;write it=0D
sbi EECR,EEWE =0D
ret =0D
=0D
Regards:=0D
=0D
R=E1cz Kriszti=E1n=0D
c...@freemail.hu =0D
2006-06-26 =0D
=0D
=3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D=
=3D =3D =3D=0D
=0D
=3D=3D=3D=3D=3D=3D=3D=3D 2006-06-24, 17:05:39 =EDrta: =3D=3D=3D=3D=3D=3D=3D=
=3D=0D
=0D
hi Krisztian,=0D
=0D
Thank you for your kind response...=0D
=0D
I am writing to 3 locations..0x00,0x03 and 0x08... and the case is same wit=
h=0D
all locations...means all are returning 0xFF.=0D
=0D
My code looks like,=0D
=0D
void EEPROM_write(unsigned int Eeprom_Address, unsigned char Data)=0D
{=0D
/* Wait for completion of previous write */=0D
while(EECR & (1< ;=0D
/* Set up address and data registers */=0D
EEAR =3D Eeprom_Address;=0D
EEDR =3D Data;=0D
/* Write logical one to EEMWE */=0D
EECR |=3D (1< /* Start eeprom write by setting EEWE */=0D
EECR |=3D (1< }=0D
=0D
unsigned char EEPROM_read(unsigned int Eeprom_Address)=0D
{=0D
/* Wait for completion of previous write */=0D
while(EECR & (1< ;=0D
/* Set up address register */=0D
EEAR =3D Eeprom_Address;=0D
/* Start eeprom read by writing EERE */=0D
EECR |=3D (1< /* Return data from data register */=0D
return EEDR;=0D
}=0D
can you respond is it okay?=0D
=0D
regards=0D
niyaz=0D
India=0D
=0D
On 6/24/06, R=E1cz Kriszti=E1n wrote:=0D
>=0D
> HY Niyaz K.Zubair:=0D
>=0D
> Dont use 0h adress,because it is incorrect in AVR.=0D
> When you write the EEPROM wait 8ms before read it, or use the EEPROM READ=
Y=0D
> interrupt.=0D
> Do you enable the write and read in the EECR?=0D
>=0D
> Regards:=0D
>=0D
> Krisztian=0D
> c...@freemail.hu=0D
> 2006-06-24=0D
>=0D
> =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =
=3D =3D =3D =3D=0D
>=0D
> =3D=3D=3D=3D=3D=3D=3D=3D 2006-06-24, 00:02:07 =EDrta: =3D=3D=3D=3D=3D=3D=
=3D=3D=0D
>=0D
> hi all....=0D
>=0D
> can any one help me on this??=0D
> My ATMEga32 EEPROM is not retaining data after AVR reset=0D
> When I first write the data into EEPROM, and then read ,=0D
> I could read back the correct data.=0D
> but it returnes back '0xFF' if i read after reset.=0D
> why is it so?=0D
> Note: I am powering my uC from USB...=0D
>=0D
> regards=0D
> niyaz=0D
>=0D
> [Non-text portions of this message have been removed]=0D
>=0D
>=0D
>=0D
>=0D
> _____________ NOD32 1.1537 (20060514) Inform=E1ci=F3 _____________=0D
>=0D
> Az =FCzenetet a NOD32 antivirus system megvizsg=E1lta.=0D
> http://www.nod32.hu=0D
>=0D
>=0D
>=0D
>=0D
>
=20



(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )