User Tools

Site Tools


tutorials:cb1:development:access_at24c_eeprom_via_i2c

This is an old revision of the document!


Access AT24C EEPROM via I2C

About this Article

Abstract

In this tutorial, an approach for accessing AT24C EEPROM via I2C bus on is presented. Cubieboard1 or Cubieboard2 expand out groups of I2C pins which could be connected to peripheral I2C slave devices, like RTC device(DS1307), EEPROM device(AT24C) etc. It's possible to connect serval slave devices on a single I2C interface, because I2C has the ability to communicate with different devices by various device addresses. For details, you may look into literatures describing I2C protocols.

Pictures below illustrate the DIY result of accessing four AT24C256s via I2C on Cubieboard1. In fact, all Cubieboard series expand out I2C pins, so the approach in this article will apply for all Cubieboards, the mechanism is same.

Configuration

In order to access peripheral I2C devices, Cubieboard's script.bin should enable I2C interfaces. Edit script.fex, make certain that the following lines exist there.

[twi1_para]
twi1_used = 1
twi1_scl = port:PB18<2><default><default><default>
twi1_sda = port:PB19<2><default><default><default>

This will configure Cubieboard's IO port PB18 & PB19 to TWI1-SCK & TWI1-SDA (I2C-1).

Connection

AT24C Access

Example Codes

tutorials/cb1/development/access_at24c_eeprom_via_i2c.1386035057.txt.gz · Last modified: 2013/12/23 14:50 (external edit)