Reply
Posts: 5
Registered: ‎08-31-2017
Accepted Solution

CP2120 Read I2C Buffer

Hello,

 

I have a question regarding reading the I2C values. My current task is to connect a EEPROM to the I2C line. I have managed to write to the eeprom device, but I'm struggling about reading the written values. 

 

If I have understood the datasheet for the CP2120 correctly, one has to first read the bytes from the I2C, which is stored in a internal register (RXBUFF). From there, I have to read this buffer in order to receive the written bytes?

 

myWriteFunction(0x00,0x04,0xA0,[0x01,0x33,0x15,0x11])

myReadFunction(0x01,0x04,0xA0)

myReadBuffFunction(0x06,0x00)

 

Is this the correct approach?

 

Description of my functions:

myWriteFunction (command, num_bytes, slave_addr, [data1, data2, dataN])

myReadFunction (command, num_bytes, slave_addr)

myReadBuffFunction (command, dont_care)

Posts: 343
Registered: ‎03-03-2015

Re: CP2120 Read I2C Buffer

Yes, you read the I2C data from RXBUFF after it is recieved by the CP2120.  It may be useful to monitor both the I2C and SPI traffic with an oscilloscope or logic analyzer while implementing this code.

 

Regards,

Joe

Highlighted
Posts: 5
Registered: ‎08-31-2017

Re: CP2120 Read I2C Buffer

Thank you for the reply.

 

I figured it out, I missed one command line from the EEPROM device in order to read the stored value.