Because of the Thanksgiving holiday in the U.S., TI E2E™ design support forum responses may be delayed from November 25 through December 2. Thank you for your patience.

This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LP5868: Arduino nano I2C interfacing with LP5868 LED matrix driver - requires 10 bit addressing

Part Number: LP5868
Other Parts Discussed in Thread: LP5860, MSP430F5529

The Arduino nano provides SDA and SCL for I2C connectivity. The LP5868 has a lot of registers and requires 10-bit addresses to select them. Arduino I2C libraries are generally 8-bit address implementations. Texas Instruments tech support tells me that Arduino libraries do not exist to drive the LP5868.

So I wrote Arduino IDE test code that manually manipulates SDA and SCL and switches SDA between input mode and output mode for ACKS and for reads and writes to the slave device. The hardware config is an LP5868 with its SCL and SDA pins connected to the SCL and SDA on the nano respectively, with 4.7K ohm pull-up resistors to +5V.

My interface is not working. The logic analyzer capture explains what I am seeing. This is a capture of me writing a value 1 to register 0 on the LP5868, and then reading back the value of register 0.

Any input including choice of an alternate microcontroller, logic or any other errors is appreciated.

The nano test code is:

#define numMicroseconds 1000
//#define SCL 19
//#define SDA 18

byte binaryValue = 0b11010110; // binary value to extract bit from
byte extractedBit = (binaryValue >> 2) & 0x01; // extract third bit (bit index starts from 0)

void setup() {
  Serial.begin(9600);
  while (!Serial);
  Serial.print(F("\tSDA = ")); Serial.println(SDA);
  Serial.print(F("\tSCL = ")); Serial.println(SCL);
}

void loop()
{

  //write
 
  pinMode(SDA,OUTPUT);
  pinMode(SCL,OUTPUT);

  //start
  digitalWrite(SCL, HIGH);
  delayMicroseconds(numMicroseconds);
  digitalWrite(SDA, LOW);
  delayMicroseconds(numMicroseconds);
  digitalWrite(SCL, LOW);
  delayMicroseconds(numMicroseconds);
 
  binaryValue = 0b10101000;
  for (int i = 7; i >=0; i--) {
    extractedBit = (binaryValue >> i) & 0x01;
    if(extractedBit==1) {
        digitalWrite(SDA, HIGH);
    } else {
        digitalWrite(SDA, LOW);
    }
    delayMicroseconds(numMicroseconds);
    digitalWrite(SCL, HIGH);
    delayMicroseconds(numMicroseconds);
    digitalWrite(SCL, LOW);
    delayMicroseconds(numMicroseconds);
  }
  pinMode(SDA,INPUT);
  delayMicroseconds(numMicroseconds);
  digitalWrite(SCL, HIGH);
  delayMicroseconds(numMicroseconds);
  digitalWrite(SCL, LOW);
  delayMicroseconds(numMicroseconds);
  pinMode(SDA,OUTPUT);
  delayMicroseconds(numMicroseconds);

  binaryValue = 0b00000000;
  for (int i = 7; i >=0; i--) {
    extractedBit = (binaryValue >> i) & 0x01;
    if(extractedBit==1) {
        digitalWrite(SDA, HIGH);
    } else {
        digitalWrite(SDA, LOW);
    }
    delayMicroseconds(numMicroseconds);
    digitalWrite(SCL, HIGH);
    delayMicroseconds(numMicroseconds);
    digitalWrite(SCL, LOW);
    delayMicroseconds(numMicroseconds);
  }
  pinMode(SDA,INPUT);
  delayMicroseconds(numMicroseconds);
  digitalWrite(SCL, HIGH);
  delayMicroseconds(numMicroseconds);
  digitalWrite(SCL, LOW);
  delayMicroseconds(numMicroseconds);
  pinMode(SDA,OUTPUT);
  delayMicroseconds(numMicroseconds);
 
  binaryValue = 0b00000001;
  for (int i = 7; i >=0; i--) {
    extractedBit = (binaryValue >> i) & 0x01;
    if(extractedBit==1) {
        digitalWrite(SDA, HIGH);
    } else {
        digitalWrite(SDA, LOW);
    }
    delayMicroseconds(numMicroseconds);
    digitalWrite(SCL, HIGH);
    delayMicroseconds(numMicroseconds);
    digitalWrite(SCL, LOW);
    delayMicroseconds(numMicroseconds);
  }
  pinMode(SDA,INPUT);
  delayMicroseconds(numMicroseconds);
  digitalWrite(SCL, HIGH);
  delayMicroseconds(numMicroseconds);
  digitalWrite(SCL, LOW);
  delayMicroseconds(numMicroseconds);
  pinMode(SDA,OUTPUT);
  delayMicroseconds(numMicroseconds);
   
  //stop
  digitalWrite(SDA, LOW);
  delayMicroseconds(numMicroseconds);
  digitalWrite(SCL, HIGH);
  delayMicroseconds(numMicroseconds);
  digitalWrite(SDA, HIGH);


  delay(10);                      // wait

  //read
 
  pinMode(SDA,OUTPUT);
  pinMode(SCL,OUTPUT);

  //start
  digitalWrite(SCL, HIGH);
  delayMicroseconds(numMicroseconds);
  digitalWrite(SDA, LOW);
  delayMicroseconds(numMicroseconds);
  digitalWrite(SCL, LOW);
  delayMicroseconds(numMicroseconds);
 
  binaryValue = 0b10101001;
  for (int i = 7; i >=0; i--) {
    extractedBit = (binaryValue >> i) & 0x01;
    if(extractedBit==1) {
        digitalWrite(SDA, HIGH);
    } else {
        digitalWrite(SDA, LOW);
    }
    delayMicroseconds(numMicroseconds);
    digitalWrite(SCL, HIGH);
    delayMicroseconds(numMicroseconds);
    digitalWrite(SCL, LOW);
    delayMicroseconds(numMicroseconds);
  }
  pinMode(SDA,INPUT);
  delayMicroseconds(numMicroseconds);
  digitalWrite(SCL, HIGH);
  delayMicroseconds(numMicroseconds);
  digitalWrite(SCL, LOW);
  delayMicroseconds(numMicroseconds);
  pinMode(SDA,OUTPUT);
  delayMicroseconds(numMicroseconds);

  binaryValue = 0b00000000;
  for (int i = 7; i >=0; i--) {
    extractedBit = (binaryValue >> i) & 0x01;
    if(extractedBit==1) {
        digitalWrite(SDA, HIGH);
    } else {
        digitalWrite(SDA, LOW);
    }
    delayMicroseconds(numMicroseconds);
    digitalWrite(SCL, HIGH);
    delayMicroseconds(numMicroseconds);
    digitalWrite(SCL, LOW);
    delayMicroseconds(numMicroseconds);
  }
  pinMode(SDA,INPUT);
  delayMicroseconds(numMicroseconds);
  digitalWrite(SCL, HIGH);
  delayMicroseconds(numMicroseconds);
  digitalWrite(SCL, LOW);
  delayMicroseconds(numMicroseconds);
//  pinMode(SDA,OUTPUT);
  delayMicroseconds(numMicroseconds);
 
  for (int i = 7; i >=0; i--) {
    digitalWrite(SCL, HIGH);
    delayMicroseconds(numMicroseconds);
    digitalWrite(SCL, LOW);
    delayMicroseconds(numMicroseconds);
  }
  pinMode(SDA,OUTPUT);
  delayMicroseconds(numMicroseconds);
  digitalWrite(SDA, HIGH);
  delayMicroseconds(numMicroseconds);
  digitalWrite(SCL, HIGH);
  delayMicroseconds(numMicroseconds);
  digitalWrite(SCL, LOW);
  delayMicroseconds(numMicroseconds);
  digitalWrite(SDA, LOW);
  delayMicroseconds(numMicroseconds);
  pinMode(SDA,OUTPUT);
  delayMicroseconds(numMicroseconds);
   
  //stop
  digitalWrite(SDA, LOW);
  delayMicroseconds(numMicroseconds);
  digitalWrite(SCL, HIGH);
  delayMicroseconds(numMicroseconds);
  digitalWrite(SDA, HIGH);


  delay(1000);                      // wait
}