- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I had the em_eeprom block working in Creator 3. Now in Creator 4 the block has changed and that code does not work. Surprised by the lack of backward compatibility!
Here is how I have it set. If anyone spots the problem, thanks in advance! - John
EmEEPROM_v2_20 block:
EEPROM Size: 64
Redundant copy: No
Wear Level Factor: 5x
(Actual EEPROM size (bytes): 640
Flash Security:
All blocks W except the last five blocks are U
Build settings; Linker command line:
-Wl.--section-start=.EEPROMDATA=0x00007D80
Code:
#define TAG 0x5a
#define EE_SIZE 3
static const uint8 eepromArray[] __attribute__ ((section (".EEPROMDATA"))) = { ~TAG,0,0};
#define ee_valid_flag (*(volatile uint8 *) &eepromArray[0])
#define ee_control_byte (*(volatile uint8 *) &eepromArray[1])
#define ee_spare (*(volatile uint8 *) &eepromArray[2])
uint8 ram_array[EE_SIZE];
#define valid_flag ram_array[0]
#define control_byte ram_array[1] // ????temp
#define spare ram_array[2]
int main()
{
Em_EEPROM_Init(CY_EM_EEPROM_FLASH_BASE_ADDR);
:
:
Em_EEPROM_Read(0, ram_array, EE_SIZE); //&Em_EEPROM_context);
:
:
Em_EEPROM_Write(0, ram_array, EE_SIZE); //&Em_EEPROM_context);
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Em_EEPROM_Init(uint32 startAddress) needs the start address of the Em_EEPROM storage. As per the linker settings, the Em_EEPROM data storage is placed in a custom memory section called EEPROMDATA. However, you are initializing the Em_EEPROM_Init with CY_EM_EEPROM_FLASH_BASE_ADDR (0x00000000u) which returns failure. PSoC 4 do not have seperate Em_EEPROM memory section. It emulates EEPROM using flash. Hence, the CY_EM_EEPROM_FLASH_BASE_ADDR points to flash base ie, 0x00000000u.
Please modify Em_EEPROM_Init to following and you should be good to go.
Em_EEPROM_Init((uint32_t) eepromArray);
Go to CE195313 PSoC Emulated EEPROM for Em_EEPROM code example using the new Em_EEPROM component.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Em_EEPROM_Init(uint32 startAddress) needs the start address of the Em_EEPROM storage. As per the linker settings, the Em_EEPROM data storage is placed in a custom memory section called EEPROMDATA. However, you are initializing the Em_EEPROM_Init with CY_EM_EEPROM_FLASH_BASE_ADDR (0x00000000u) which returns failure. PSoC 4 do not have seperate Em_EEPROM memory section. It emulates EEPROM using flash. Hence, the CY_EM_EEPROM_FLASH_BASE_ADDR points to flash base ie, 0x00000000u.
Please modify Em_EEPROM_Init to following and you should be good to go.
Em_EEPROM_Init((uint32_t) eepromArray);
Go to CE195313 PSoC Emulated EEPROM for Em_EEPROM code example using the new Em_EEPROM component.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you, that fixed it! - John