- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am using the CY8CKIT-049-42XX prototype board for my experiments. I am trying to interface a I2C based EEPROM 24LC256 to the board. The SDA pin of the EEPROM is connected to P0[5] pin of the board (also configured as SDA) and the SCL pin of EEPROM to P0[4] pin on the board. The bus lines (SDA and SCL) are pulled up via 3.3K resistors.
I use the following code in the main.c file to read a byte in the EEPROM
void ReadExtEEPROM(uint32 SlaveAddress,uint32 MemAddress){
uint8 ret=0;
I2C_I2CMasterClearStatus();
I2C_I2CMasterSendStart(SlaveAddress,0);
I2C_I2CMasterWriteByte(MemAddress>>8);
I2C_I2CMasterWriteByte(MemAddress);
I2C_I2CMasterSendRestart(SlaveAddress,1);
ret=I2C_I2CMasterReadByte(0);
return (ret);
}
void WriteExtEEPROM(uint32 SlaveAddress,uint32 MemAddress,uint8 MemData){
I2C_I2CMasterSendStart(SlaveAddress,0);
I2C_I2CMasterWriteByte(MemAddress>>8);
I2C_I2CMasterWriteByte(MemAddress);
I2C_I2CMasterWriteByte(MemData);
I2C_I2CMasterSendStop();
}
The problem is I can read the byte correctly for the first time (after power up) after which the reads always return 0. The address to which I read has be written previously (using the above WriteExtEEPROM) with a known value. So I know what value is expected..
Please help...
Thanks
a
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A couple of working projects here -
http://www.cypress.com/?app=forum&id=4749&rID=107688
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for the tips. I got it working there was a problem with the addressing...
thanks
a
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Glad to have assisted.
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi every body.I want to running at24c512 with psoc5lp.so can you realse your project file here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Would be much better to start a new thread instead of using a two year old one.
Bob