You are here

How to read data from EEPROM of PSoC 3/5 | Cypress Semiconductor

Support & Community

How to read data from EEPROM of PSoC 3/5

Last Updated: March 23, 2011

How to read data from EEPROM of PSoC 3/5?


The  EEPROM resides within the memory space of PSoC3/5. The maximum size of EEPROM is 2 KB.The write to EEPROM can be done only through SPC. Whereas the read from the EEPROM can be through PHUB. The CPU or DMA can directly access the EEPROM data.

The base address for the EEPROM is defined in cydevice.h as CYDEV_EE_BASE. This define can be used for accessing the data through PHUB.

 Example to read first 255 bytes from EEPROM and store to array.

1. Reading EEPROM using CY_GET_REG8 API

   for (count = 0; count < 255;i++)
     EEPROM_Data[count] = CY_GET_REG8(CYDEV_EE_BASE + count);

2. Reading EEPROM using data Pointer                                     

A pointer can be defined for the EEPROM address as follows:

   #define EEPROM_ADDR (unsigned char *) CYDEV_EE_BASE
   for (count = 0; count < 255; i++)
     EEPROM_Data[count] = EEPROM_ADDR[count];  

3. Reading using DMA

The same base address can be used while reading using DMA.

   MyCh = DMA_DmaInitialize(0,0,0,0);
   MyTd = CyDmaTdAllocate();
   CyDmaTdGetConfiguration(MyTd, 255, DMA_INVALID_TD, (TD_INC_SRC_ADR | TD_INC_DST_ADR));
   CyDmaTdSetAddress(MyTd, (uint16) CYDEV_EE_BASE, (uint16) EEPROM_Data)

Knowledge Base Tags: 

Provide feedback on this article

Browse KB By Product

Browse KB by Type