I2C with Touch Sensor. Why doesn't this work?

Hi,

I connected a touch sensor chip to my Arduino.

The chip is the Azoteq IQS156 (Datasheet)

When I am communicate via I2C it returns data that seems wrong.

For example, i’d like to read the Product Number. It is stored at register 0 and 8 Bits long. The value is always ‘11H’ for this chip.

In my code (underneath), I do the following:

  • I address the device with address 0x40 (64). It is found.

  • Set the register to 0 and request 1 byte.

  • Print the answer in DEcinal format to the serial monitor

But the answer (in Decimal) is always ‘28’. According to the datasheet, it should return 11H.

What am I doing wrong?

This is my code:

#include <Wire.h>
const int device_address = 64;  //I2C address (Device is found)

byte bcdToDec(byte val)
{
  return ( (val/16*10) + (val%16) );
}

void setup()
{
  Wire.begin();
  Serial.begin(9600); 
}


void loop() {

    Wire.beginTransmission(device_address);
    Wire.write(0);  //Set register to 0
    Wire.endTransmission(false);
    Wire.requestFrom(device_address, 1,true);  // Request 1 byte

  while(Wire.available())    // slave may send less than requested
  { 
    char c = Wire.read();    // receive a byte as character

    Serial.print(c,DEC);     //28

    Serial.print(bcdToDec(c));  //22

 }

Serial.print('\n');

delay(500);  
}

Thanks in advance for any help.

496808d8-16d6-485f-9a18-afadd0d1524f.jpg

With further research I found out that START and STOP conditions must be created to communicate with this chip.

The I2C pins need to go through this sequence to create the start conditon:

SDA - HIGH SCL = HIGH SDA = LOW SCL = LOW

And then one needs to poll and wait for the device to acknowledge. Once that is done, communication can start.

can you explain or post the example code, i'am here for try for Azoteq IQS227 without sucess

Thank you in advance !!