- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am having an issue with using the emulated eeprom in my project that utilizes BLE on a PSoC6 MCU. I am looking to run the EEPROM on CM0 core only and therefore followed the discussion forums instructions regarding modifying the CM4 linker script. After that I was able to compile the project after adding in the EM_EEPROM object to the schematic. I am now having an issue where the Cy_Em_EEPROM_Write function returns CY_EM_EEPROM_WRITE_FAIL. I am not sure why this may be the case. During debug I can see that the code reaches this function before halting at the handleError function (infinite loop) due to the write_fail return. Perhaps I need to modify the memory location of the EEPROM some how? Any help would be much appreciated. It has already been quite a hurdle to get this far in implementing the eeprom. Perhaps once I get this working we could use it as a new example that is EEPROM with BLE or something like that.
//initial part of my main function on Core0:
int main(void)
{
UART_1_Start();
EEPROM_init();
// Enable global interrupts.
__enable_irq();
..........................................................
}
//EEPROM initialization function
void EEPROM_init()
{
cy_en_em_eeprom_status_t eepromReturnValue;
eepromReturnValue = Em_EEPROM_Init(LOGICAL_EEPROM_START);
if(eepromReturnValue != CY_EM_EEPROM_SUCCESS)
{
HandleError();
}
eepromReturnValue = Cy_Em_EEPROM_Read(LOGICAL_EEPROM_START, eepromArray, LOGICAL_EEPROM_SIZE, &Em_EEPROM_context);
if(eepromReturnValue != CY_EM_EEPROM_SUCCESS)
{
HandleError();
}
/*If first byte of EEPROM isn't 'P' the write data from array*/
if(eepromArray[0] != ASCII_P)
{
/*Write inital data to EEPROM*/
eepromReturnValue = Cy_Em_EEPROM_Write(LOGICAL_EEPROM_START, array, LOGICAL_EEPROM_SIZE, &Em_EEPROM_context);
if(eepromReturnValue != CY_EM_EEPROM_SUCCESS)
{
HandleError();
}
eepromReturnValue = Cy_Em_EEPROM_Read(LOGICAL_EEPROM_START, eepromArray, LOGICAL_EEPROM_SIZE, &Em_EEPROM_context);
if(eepromReturnValue != CY_EM_EEPROM_SUCCESS)
{
HandleError();
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
The Emulated EEPROM can work from both CM0+ and CM4 cores. Please find the attached code example in which CM0+ is used for writing and reading from the emulated eeprom. Please check if this example is working at your side.
From your explanation, I understood that you are trying to emulate flash as EEPROM. There is a dedicated region for emulated eeprom in the PSoC device. You can use this region for storing your data. If the size of this region is not sufficient for your requirement, you can use the flash memory as emulated eeprom memory also.
To use dedicated emulated eeprom region, you can select the option for use Emulated EEPROM as yes as shown in the image below. Please let us know if you can us this dedicated memory.
Thanks
Ganesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ganesh,
Thank you for taking the time to respond to my question. I will review and attempt to run the example you have provided to ensure that the EmEEPROM is functioning on my psoc6 mcu. Here is a link to the forum post that discusses the changes I have implemented so far to get my code to compile when utilizing both EmEEPROM and BLE hardware elements: