em_EEPROM problem

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

cross mob
doho_1581701
Level 1
Level 1

Psoc 4.2 updated the em_EEPROM element. Well, not updated, completely replaced with it

with a new one that breaks all existing projects using it. It would have been far smarter (and nicer)

if they had given it a different name.   The notes says it was done to meet customer expectations.

That is true if the customer expects to be put in a bad spot and have to miss a critical deadline

because the programmer thought things should be done differently.

In any case, there is a major problem I have no idea how to fix. I have implemented the em_EEPROM

element according to the new documentation. The symptom is that it reports success in writes but it

mostly erases the contents and occasionally writes one of the parameters. The first write does nothing

and leaves the values at the compile defaults. The second write destroys the contents. This all worked

fine before the "upgrade". My first choice would be to get the old version back but that does not seem to

be an option.

Initializations

static const uint8 eepromArray[Em_EEPROM_1_PHYSICAL_SIZE]

__ALIGNED(CY_FLASH_SIZEOF_ROW) =

                                 {0x01, 0x05, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x03, 0x00, 0x00, 0x01, 0x00, 0x10,

                                  0x0f, 0x0f, 0x0f, 0xf6, 0xf6, 0xf6, 0xb3, 0x20, 0x05, 0x01, 0x01, 0x10, 0x04, 0x04, 0x03, 0x01,

                                  0x87, 0x00, 0x10, 0x00, 0x12, 0x34, 0x56, 0x78, 0x60, 0x0c, 0x01, 0x00, 0x00, 0x30,0xaa, 0x55

                                    };

In main()

returnValue = Em_EEPROM_1_Init((int32)  &eepromArray[0]);

Write and read routines

uint8 writeeeprom(uint8 dta,uint8 offset){

   // uint8 status = Em_EEPROM_1_Write(&dta,&eepromArray[offset],1u);

    uint8 status = Em_EEPROM_1_Write((int32) offset,&dta,1u);

    return status;

}

uint8 readeeprom(uint8 offset){

  //  uint8  volatile val = eepromArray[offset];

    uint8 val;

    uint8 status = Em_EEPROM_1_Read((int32) offset,&val ,1u);

    return val;

}

Anybody make this work with a CY8C4245?

Thanks.

0 Likes
1 Solution
GeonaP_26
Moderator
Moderator
Moderator
250 solutions authored 100 solutions authored 50 solutions authored

Hello Doug Hogg,

Emulated EEPROM v2.0 is a major revision of the component and please make use of this code example.

Best Regards,

Geona Mary

View solution in original post

0 Likes
3 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Can you please post your complete project or a shortened version that shows the error so that we all can have a look at all of your settings. To do so, use

Creator->File->Create Workspace Bundle (minimal)

and attach the resulting file.

Bob

0 Likes

Unfortunately I cannot post the project. I would have to build a version that I could use to demonstrate the problem

and the time pressure is too great to take the day to do that. The settings for build were all default as were the settings on the component.

I found a solution. In the Component catalog, there is a setting for "show all versions". The old version was there

and i replaced V2 with V1.2, restored my code and everything works again. I also got back the 250 bytes of ram that

the new one took so I could restore the features I had to remove to try to make the new one work.

It still would be nice to know what is wrong with the component.

0 Likes
GeonaP_26
Moderator
Moderator
Moderator
250 solutions authored 100 solutions authored 50 solutions authored

Hello Doug Hogg,

Emulated EEPROM v2.0 is a major revision of the component and please make use of this code example.

Best Regards,

Geona Mary

0 Likes