Hello,
Does anybody help how to access 2Kbit eeprom?
I'm playing with two EEPROMs using Wire.h library.
One is IS24C02B (256x8=2Kbits) and the another is 24LC256 (256K).
I can read/write data to/from 24LC256 with the code which is provided from Arduino playground (pasted below).
But I can't access to IS24C02B. It stuck at endTransmission().
I didn't dig twi.c yet but seems like stuck at polling routine:
// wait until twi is ready, become master transmitter
while(TWI_READY != twi_state){
continue;
}
OR
// wait for write operation to complete
while(wait && (TWI_MTX == twi_state)){
continue;
}
Regards,
----- here is the code I'm using from Playground -----
#include <Wire.h>
void i2c_eeprom_write_byte( int deviceaddress, unsigned int eeaddress, byte data ) {
int rdata = data;
Wire.beginTransmission(deviceaddress);
Wire.send((int)(eeaddress >> 8)); // MSB
Wire.send((int)(eeaddress & 0xFF)); // LSB
Wire.send(rdata);
Wire.endTransmission();
}
byte i2c_eeprom_read_byte( int deviceaddress, unsigned int eeaddress ) {
byte rdata = 0xFF;
Wire.beginTransmission(deviceaddress);
Wire.send((int)(eeaddress >> 8)); // MSB
Wire.send((int)(eeaddress & 0xFF)); // LSB
Wire.endTransmission();
Wire.requestFrom(deviceaddress,1);
if (Wire.available()) rdata = Wire.receive();
return rdata;
}