Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
en:netzer:i2c-master [2014/12/21 11:21]
svesch Replaced TCP/IP with more generic socket
en:netzer:i2c-master [2014/12/21 11:59]
svesch Fixed image
Line 95: Line 95:
 The termination character stops any pending communication and also terminates any pending frame. The termination character stops any pending communication and also terminates any pending frame.
  
 +
 +
 +
 +
 +===== Examples =====
 +
 +The following examples presume that there is a [[connection|connection]] to Netzer.
 +
 +Take a look at the following picture for circuiting a I2C EEPROM IC as slave to Netzer.
 +
 +<​imgcaption eeprom_example|Connecting a simple EEPROM to Netzer>​{{:​eeprom_example.png?​direct}}</​imgcaption>​
 +
 +
 +
 +===== EEPROM slave address =====
 +
 +The EEPROM has the slave address 0x50. 
 +Because the LSB is reserved for the R/W indicator the address is shifted left by one: //0xA0//.
 +
 +
 +===== Writing to the EEPROM =====
 +
 +See the following byte sequence for writing a //0x55// to memory address 0 of the EEPROM:
 +<​code>​
 +Write per socket to Netzer: 0xA0 0x5C 0x00 0x55 0x00
 +Answer from EEPROM received from Netzer: 0xFF 0xFF 0xFF 0x00
 +</​code>​
 +
 +  - //0xA0// is the slave address with the R/W bit cleared, means write access.
 +  - Netzer returns //0xFF//, indicating the available slave.
 +  - //0x5C 0x00// transfers the memory address 0 - of course must be backslashed ('​\\'​ = 0x5C)
 +  - Netzer returns //0xFF//, successful transfered memory address.
 +  - //0x55// is the value written to EEPROM
 +  - Netzer returns //0xFF//, successful transfered value.
 +  - //0x00// stops the transmission - I2C bus is released.
 +  - Socket sends //0x00// to the host - Frame termination
 +
 +
 +===== Reading from EEPROM =====
 +
 +<​code>​
 +Write per TCP/IP to Netzer: 0xA0 0x5C 0x00 0x73 0xA1 0xFF 0x00
 +Answer from EEPROM received per TCP/IP from Netzer: 0xFF 0xFF 0xFF 0xFF 0x55 0x78 0x00
 +</​code>​
 +
 +  - //0xA0// is the slave address with the R/W bit cleared, means write access.
 +  - Netzer returns //0xFF//, indicating the available slave.
 +  - //0x5C 0x00// transfers the memory address 0 - of course must be backslashed ('​\\'​ = 0x5C)
 +  - Netzer returns //0xFF//, successful transfered memory address.
 +  - //0x73// initiates a repeated start on the bus.
 +  - Netzer returns //0xFF//, successful repeated start.
 +  - //0xA1// is the slave address with the R/W bit set, means read access.
 +  - Netzer returns //0xFF//, indicating the available slave.
 +  - //0xFF// from host: Pull me one byte from slave and acknowledge it.
 +  - Netzer returns the value read from memory address 0: //0x55//.
 +  - //0x00// from host: Pull me one more byte from slave and stop.
 +  - Netzer returns the value read from memory address 1 (auto increment feature of the EEPROM): 0x78.
 +  - Netzer automatically announces a stop condition after sending the byte.
 +  - Socket sends //0x00// to the host - Frame termination
  

QR Code
QR Code The I2C master protocol (generated for current page)