Can the kv-store and Em_EEPROM libraries share use of the emulated EEPROM flash region?

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

cross mob
NiBu_4687336
Level 5
Level 5
5 solutions authored 50 replies posted 25 replies posted

Hi.

I'm using the Em_EEPROM library to emulate a 2 KB EEPROM, with wear-leveling factor of 2, plus a redundant copy, for a total of 16 KB of the EE Emulation flash region of the PSoC 6.

I'd also like to implement the kv-store library. I would prefer to use the remainder of the EE Emulation flash region to store kv-store data, as well, rather than the main user flash. I presume that configuring kv-store with the appropriate addresses will accomplish that, but will Em_EEPROM and kv-info play nicely together? 

For example, if I continue to use the first 16 KB of EE Emulation flash for EEPROM emulation via the Em_EEPROM library, can I then configure the kv-store library to use the upper 16 KB of the EE Emulation flash region and expect both libraries to function properly?

Thanks,

-Nick

0 Likes
1 Solution
NiBu_4687336
Level 5
Level 5
5 solutions authored 50 replies posted 25 replies posted

To follow up - it appears that both libraries can coexist and share the AUX (EM emulation) flash, but it turns out to make more sense to use only the kv-store library to store the EEPROM data along with the rest of the non-volatile data.

-Nick

View solution in original post

0 Likes
4 Replies
Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

Hi Nick, 

The Em_EEPROM Middleware uses the flash driver internally to write to flash. The Em_EEPROM middleware will not be aware If any changes are made to the Em_EEPROM region directly using the flash write APIs which might lead to data corruption. So as long as the direct flash API calls do not affect the region used by the Em_EEPROM and are not called simultaneously, it should not cause any issues. 

Could you please share the link to the kv-store library that you are using? Would it be possible to redirect the library also to use Em_EEPROM APIs?

Thanks and Regards,
Rakshith M B
0 Likes
NiBu_4687336
Level 5
Level 5
5 solutions authored 50 replies posted 25 replies posted

Hi @Rakshith

I'm using the Infineon kv-store library (GitHub link here). 

The Em_EEPROM API doesn't provide sufficient granularity for read/erase/write operations to be useable directly by the kv-store library. 

As long as the Em_EEPROM middleware uses only the contiguous addresses range from the start of the EE Emulation region, and of length as calculated by the CY_EM_EEPROM_GET_PHYSICAL_SIZE macro, it seems that the two libraries shouldn't interfere with each other.

Thanks,

-Nick

0 Likes

Hi Nick, 

Thanks for the update. Yes, the Em_EEPROM middleware uses a contiguous address range.

Thanks and Regards,
Rakshith M B
0 Likes
NiBu_4687336
Level 5
Level 5
5 solutions authored 50 replies posted 25 replies posted

To follow up - it appears that both libraries can coexist and share the AUX (EM emulation) flash, but it turns out to make more sense to use only the kv-store library to store the EEPROM data along with the rest of the non-volatile data.

-Nick

0 Likes