ACCES to the EEPROM

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My project is builded with an AT MEGA 128, the code is write and build with Atmel Studio 7 (Version: 7.0.582 - ) and 6.2 with the same result.

 

I have define four  arrays in EEPROM, for the array N° 3 “Vigil_ALERT_DATA” if the program write a value on the first array line (0), the data is not write in EEPROM.

 

To check this I used this code:

Check 1 : Write the char '5' in the EEPRM Byte [0][7], eeprom_write_byte (&Vigil_ALERT_DATA[0][7],'5'); return_value =  eeprom_read_byte(&Vigil_ALERT_DATA[0][7]);

Check 2 : Write the char '7' in the EEPRM Byte [1][7], eeprom_write_byte (&Vigil_ALERT_DATA[1][7],'7'); return_value =  eeprom_read_byte(&Vigil_ALERT_DATA[1][7]);

Check 3 : Write the char '6' in the EEPRM Byte [2][7], eeprom_write_byte (&Vigil_ALERT_DATA[2][7],'6'); return_value =  eeprom_read_byte(&Vigil_ALERT_DATA[2][7]);

 

Check 3 result: The char ‘6’ is loaded at the Address 0x123 value 0x36 the return value is 54 (decimal)

Check 2 result: The char ‘7’ is loaded at the Address 0x11B value 0x37 the return value is 55 (decimal)

Check 1 result: The char ‘5’ is not loaded at the Address 0x113.

 

From the address 0x105 to 0x114, 16 garbage data are loaded, this is not compliant with the EEPROM mapping (MAP file)

 

After inhibition of all the CALL to  “eeprom_write_byte(,)” function, an EEPROM memory erasing. A new EEPROM mapping : all the cell are to 0xFF except from 0x105 to 0x114 is loaded with hexadecimal values 57,C3,C1,53,51,D3, 53,D1,53,53,D1,01,D3,D1,C3,53..

 

Copy of the MAP file :

 

.eeprom              0x00810000        0x215

 *(.eeprom*)

 .eeprom              0x00810000       0x7 Battery.o

                           0x00810000       PowerDatas

 .eeprom              0x00810007      0x105 Controle.o

                           0x00810007      HeatDataSaved

                           0x00810010      HeatProgram

 .eeprom             0x0081010c       0x100 HouseVigil.o

                          0x0081010c       Vigil_ALERT_DATA

 .eeprom             0x0081020c       0x9 Time.o

                          0x0081020c       EE_TimeDate

                          0x00810215        __eeprom_end = .

 

Extract from the code

 

#define SIGNATURE_ARRAY 32

#define SIGNATURE_ARRAY_SIZE 8

 

uint8_t EEMEM PowerDatas[7];

uint8_t EEMEM HeatDataSaved [9];

uint8_t EEMEM HeatProgram [3][7][6][2];

uint8_t EEMEM Vigil_ALERT_DATA [SIGNATURE_ARRAY][SIGNATURE_ARRAY_SIZE];

uint8_t EEMEM EE_TimeDate[9]

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Have a read of Deans tutorial on using the eeprom located here: http://fourwalledcubicle.com/AVR...

 

Paul

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Many Thanks, I just read this document.