em_EEPROM problem
doug_1581701 Apr 27, 2018 5:26 PMPsoc 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.