I cannot write a byte to Emulated EEPROM even if I compile an example project or my old worked one

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
alli_264371
Level 4
Level 4
25 replies posted 10 replies posted 10 questions asked

For example 
# pragma abs_address: 0x4000
static const uint32 MASTER = 0x22222222;
 # pragma end_abs_address
I expect to read the memory with a PSoC programmer and see 22222222 in cell 4000, but the value puts into another cell.
Or so

uint8 ram_array[16]={0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,}; 
static const uint8 CYCODE eepromArray[]= {0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x88 }; 

int main()
{
CyGlobalIntEnable; 
EEPROM_Init(0x4000);
CyDelay(20000);
EEPROM_Write(ram_array,eepromArray,16);
}


I expect to read 888888 ..., turn on the device for 20 seconds and then read 1111111 ...
But I read 888888 in both cases ...


I cannot confirm email and add messages due to a bug on your site, the email section is not active
0 Likes
1 Solution
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

> By the way, where can I find an explanation of this variable initialization format in ROM?

> "const uint8 store [Em_EEPROM_PHYSICAL_SIZE]__ALIGNED (CY_FLASH_SIZEOF_ROW"

Please refer to the component datasheet of Em_EEPROM,

which can be accessed by one of the following methods.

Note: The definitions are in "Quick Start" section

012-from_the_datasheet.JPG

(1) Selecting "Datasheet" in the configuration dialog

010-Config_Em_EEPROM.JPG

(2) Selecting "Datasheet" in the symbol window of the Component Catalog

011-WorkBench-Component_Catalog.JPG

 

> I want to set the default value, for example
>  const uint32 MASTER[1]__ALIGNED(1) = {0x12345678};
>
> And actually, I read the 0x616C6966

As write/read to/from Em_EEPROM is handled by the Em_EEPROM APIs,

I don't know if there is a method to statically define the initial contents of the Em_EEPROM.

I would check the content of Em_EEPROM at the beginning of the program (after Em_EEPROM_Init())

and if the content does not have expected values, use Em_EEPROM_Write() to initialize the content.

 

moto

 

View solution in original post

10 Replies
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

alli,

you can try the MyEEPROM component to save/recall data from EEPROM (PSoC5).

myEEPROM: component to save/recall application settings

/odissey1

myEEPROM_01_A.png

 

0 Likes
alli_264371
Level 4
Level 4
25 replies posted 10 replies posted 10 questions asked

I am using PSoC4


I cannot confirm email and add messages due to a bug on your site, the email section is not active
0 Likes

PSoC4 doesn't have EEPROM, emulated only. Please disregard.

0 Likes

Right, I have edited the post


I cannot confirm email and add messages due to a bug on your site, the email section is not active
0 Likes
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

Attached is my test sample for PSoC4. (CY8CKIT-044)

moto

P.S. (Editted/Added)

Since Em_EEPROM is "Emulating" EEPROM using Flash ROM, there need to be some data/work area to manage the endurance etc, so the data is not written from the beginning of the data area (store), but the data will be written after these "management data area". So the serial output of my sample looks like below.

The actual data is written from the 13  byte offset. (12 bytes are used for the emulation)

001-Tera_Term-log.JPG

0 Likes

I replaced the array initialization with
uint8 zustand [Em_EEPROM_EEPROM_SIZE] = {0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11};
I turned on the device and then read the PSoC memory with the PSoC programmer ... I did not find bytes 11 11 11 11 11 ...
Am I doing something wrong?


I cannot confirm email and add messages due to a bug on your site, the email section is not active
0 Likes
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

Am I doing something wrong?

As I wrote in my previous response, the Flash ROM area dedicated to the Em_EEPROM is under control of Em_EEPROM component. So the component will (in my guess) format/organize the area for its use.

Please try reading the Flash ROM area before and after Em_EEPROM_Init().

Anyway, IMHO, the storage area of Em_EEPROM is not intended to be written/read directly like an array,

but we need to use  Em_EEPROM_Write() and Em_EEPROM_Read().

moto

0 Likes
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

Since you seem to be using CY8C4245AXI-483,

I retargeted the device of my sample to CY8C4245AXI-483 and tested with CY8CKIT-042.

(I needed to jumper P0.4 (D0) to 5LP's P12[7] and P0.5 (D1) to 5LP's P12[6] for UART output)

moto

0 Likes

Thank you, now it works, it seems that Cypress changed the way of accessing memory in the PSoC Creator itself...
By the way, where can I find an explanation of this variable initialization format in ROM?

"const uint8 store [Em_EEPROM_PHYSICAL_SIZE]__ALIGNED (CY_FLASH_SIZEOF_ROW"

I want to set the default value, for example
const uint32 MASTER[1]__ALIGNED(1) = {0x12345678};

And actually, I read the 0x616C6966


I cannot confirm email and add messages due to a bug on your site, the email section is not active
0 Likes
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

> By the way, where can I find an explanation of this variable initialization format in ROM?

> "const uint8 store [Em_EEPROM_PHYSICAL_SIZE]__ALIGNED (CY_FLASH_SIZEOF_ROW"

Please refer to the component datasheet of Em_EEPROM,

which can be accessed by one of the following methods.

Note: The definitions are in "Quick Start" section

012-from_the_datasheet.JPG

(1) Selecting "Datasheet" in the configuration dialog

010-Config_Em_EEPROM.JPG

(2) Selecting "Datasheet" in the symbol window of the Component Catalog

011-WorkBench-Component_Catalog.JPG

 

> I want to set the default value, for example
>  const uint32 MASTER[1]__ALIGNED(1) = {0x12345678};
>
> And actually, I read the 0x616C6966

As write/read to/from Em_EEPROM is handled by the Em_EEPROM APIs,

I don't know if there is a method to statically define the initial contents of the Em_EEPROM.

I would check the content of Em_EEPROM at the beginning of the program (after Em_EEPROM_Init())

and if the content does not have expected values, use Em_EEPROM_Write() to initialize the content.

 

moto