Need Help With EEPROM 11AA040

I'm trying to read and write to a EEPROM, everything I try seems to fail. Anyone every used the UNI/O single wire EEPROM.

Link to the EEPROM

Code that I've tried for the writer.

#define SCIO_PIN 5
#define DEVICE_ADDRESS 0xA0

void setup() {
  pinMode(SCIO_PIN, OUTPUT);
  Serial.begin(9600);

  //send write enable
  writeEnable();

// Standby Pulse
sendStartHeader();

// Send Write Command
sendCommand(0x6C);
sendAck(true);

// Send Word Address MSB and LSB
sendByte(0x00);
sendAck(true);
sendByte(0x00);
sendAck(true);


// Send Data Bytes
sendByte(0x12);
sendAck(true);
sendByte(0x34);
sendAck(false);
delayMicroseconds(5);
}

void loop() {
}

void sendStartHeader() {
  sendStandBy();
  digitalWrite(SCIO_PIN, LOW);
  delayMicroseconds(10);
  sendByte(0x55);
  sendAck(true);
}
void sendStandBy() {
  digitalWrite(SCIO_PIN, HIGH);
  delayMicroseconds(600);
}

void writeEnable(){
  sendStartHeader();
  sendCommand(0x96);
  sendAck(false);
}

void sendAck(bool ack) {
  sendBit(ack);
  readBit();
}

void sendBit(bool bit) {
  pinMode(SCIO_PIN, OUTPUT);
  digitalWrite(SCIO_PIN, LOW);
  digitalWrite(SCIO_PIN, bit ? HIGH : LOW);
  pinMode(SCIO_PIN, INPUT_PULLUP);
}

void sendCommand(byte command) {
  sendByte(DEVICE_ADDRESS);
  sendAck(true);
  sendByte(command);
}

void sendByte(byte data) {
  for (int i = 7; i >= 0; i--) {
    bool bit = data & (1 << i);
    sendBit(bit);
  }
}

byte readByte() {
  byte data = 0;
  for (int i = 7; i >= 0; i--) {
    bool bit = readBit();
    data |= (bit << i);
  }
  return data;
}

bool readBit() {
  bool bit = digitalRead(SCIO_PIN);
  return bit;
}

Code ive tried for the reader

#define SCIO_PIN 5
#define DEVICE_ADDRESS 0xA0

void setup() {
  pinMode(SCIO_PIN, OUTPUT);
  Serial.begin(9600);

  // Standby Pulse
sendStandBy();

// StartHeader
sendStartHeader();

// Send Write Command
sendCommand(0x03);

// Send Word Address MSB and LSB
sendByte(0x00);
sendAck(true);
sendByte(0x00);
sendAck(true);


// Read Data
byte data = readByte();
Serial.println(String(data, HEX));
sendAck(true);
data = readByte();
Serial.println(String(data, HEX));
sendAck(true);

}

void loop() {
}

void sendStartHeader() {
  digitalWrite(SCIO_PIN, LOW);
  delayMicroseconds(10);
  sendByte(0x55);
  sendAck(true);
}
void sendStandBy() {
  digitalWrite(SCIO_PIN, HIGH);
  delayMicroseconds(600);
}

void writeEnable(){
  sendStandBy();
  sendStartHeader();
  sendCommand(0x96);
}

void sendAck(bool ack) {
  sendBit(ack);
  readBit();
}

void sendBit(bool bit) {
  pinMode(SCIO_PIN, OUTPUT);
  digitalWrite(SCIO_PIN, LOW);
  digitalWrite(SCIO_PIN, bit ? HIGH : LOW);
  pinMode(SCIO_PIN, INPUT_PULLUP);
}

void sendCommand(byte command) {
  sendByte(DEVICE_ADDRESS);
  sendAck(true);
  sendByte(command);
  sendAck(true);
}

void sendByte(byte data) {
  for (int i = 7; i >= 0; i--) {
    bool bit = data & (1 << i);
    sendBit(bit);
  }
}

byte readByte() {
  byte data = 0;
  for (int i = 7; i >= 0; i--) {
    bool bit = readBit();
    data |= (bit << i);
  }
  return data;
}

bool readBit() {
  bool bit = digitalRead(SCIO_PIN);
  return bit;
}

I've attempted this with a Arduino nano and a esp 32. Just keeps returning FF.

Maybe this link has more specific help...
https://forum.microchip.com/s/topic/a5C3l000000MVfYEAW/t351796?comment=P-2543122

Thanks for the reply however I have no idea where to even start with converting that to arduino code. I will play around with it and try.

I do not know how to translate datasheets into code, but the sequence starts on chapter 3 with creating the bus.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.