I need to preload Em_EEPROM values on a PSoC6 at compile-time.

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

cross mob
lock attach
Attachments are accessible only for community members.
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

I have used the Em_EEPROM on a PSoC6.

I'm trying to preload values from a struct into the Em_EEPROM at compile-time.

I've tried different methods such as "Use emulated EEPROM = No" and it isn't working.

Attached is a simple test program.

Any suggestions?

Len

Update: 01/14/2020.

Apparently when a Cy_Em_EEPROM_Read() is performed, it is pulling the data from the EEPROM image to copy into RAM from the EEPROM_addr+0x100 bytes.

Here are some code snippets as I stepped through the code from my trouble-shooting session:

cy_en_em_eeprom_status_t Cy_Em_EEPROM_Read(uint32_t addr,  void * eepromData,  uint32_t size, cy_stc_eeprom_context_t * context)

{
  // addr = 0, eepromData = pointer to the RAM copy of the struct   size=size of the struct

     ...  //  Next curRowOffset is computed.

     curRowOffset = CY_EM_EEPROM_EEPROM_DATA_LEN + (rdAddr % CY_EM_EEPROM_EEPROM_DATA_LEN);  //curRowOffset = 0x100 (256 bytes) because of CY_EM_EEPROM_EEPROM_DATA_LEN.

     ...  // later the EEPROM image is copied to the RAM location.

     /* Copy the data to the user buffer */

     (void)memcpy((void *)(eeData),   // eeData = eepromData.

              (void *)(startRowAddr + curRowOffset),     // startRowAddr = 0  curRowOffset = 0x100

             numBytesToRead);

     ...  //EEPROM data 0x100 bytes into the EEPROM allocation is copied into the RAM.

}

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
1 Solution

The Emulated EEPROM component stores service specific information such as checksum, sequence number etc., in the Em_EEPROM header section. Since the Emulated EEPROM data storage section contains both data and header information, it is not straight forward to initialize and load values at the compile time. Instead, user can check whether it contains the valid data in firmware and update if necessary. CE195313 PSoC Emulated EEPROM implements this flow.

To load Emulated EEPROM content at compile time, you can use the Em_EEPROM middleware in the simple mode from GitHub. It does not contain header information and consumes lesser flash area. Please refer to the documentation here​ for more details.

View solution in original post

0 Likes
5 Replies