I2C protocol: trying to communicate with FT6206 capacitive touch screen

Hello,

I've been trying to find what's wrong but no luck. Here is the situation.

I have this display: link to buydisplay.com

It is the version with a capacitive touch screen (ILI9341 controller with FT6206 touch controller).

Problem:

I want communicate with FT6206 through I2C protocol but when I read a register of it I always get the response 255.

The wiring must be correct. I'm using Arduino Due (SDA 20 , SCL 21). And I connect these to the displays SDA, SCL pins.

I am using adafruit's library: library
I am trying to run the example, but it fails on ctp.begin(40) example

I uncommented the debug serial prints here adafruit_FT6206.cpp

Every call such as this returns 255: readRegister8(FT6206_REG_VENDID).

First I thought the problem is the I2C address. I am still not sure if it is a problem or not. The thing is that there is an example code at buydisplay.com. And in that code it shows 2 addresses:

#define WRITE_ADD 0x70
#define READ_ADD 0x71

In the FT6206 datasheet it also talks about the last READ/WRITE bit: FT6206 - Page 4

So this is the 8-bit addressing..I guess.

But the Wire.h that is used by the adafruit library uses 7-bit adressing. So on the top of Adafruit_FT6206 it only says

#define FT6206_ADDR 0x38

This is the shifted address. 0111 000(0/1) --> 00111000. This page also mentions 0x38 I2C address table

Question. Is this cool? The datasheet says it needs the last bit, but we don't provide it. Should it work like that, with 0x38? I found this: link, on the bottom it says that this is cool because the last bit will be added automatically. Although I cannot see anything like that in the wire.cpp, wire.h, twi.c or twi.cpp

Okay so if it is not the address then what?

I also found this thread: due i2c not working thread people talking about I2C not working properly on DUE.

Noo, don't want to believe that! :slight_smile:

BTW I have Arduino 1.6.9 installed. So it is the newest.

So any ideas? What can I do? I will try this I2C scanner thing shortly, but don't have high exceptations.

Thanks,
Levente

Jesus Christ!

I found the problem after days and days of debugging and sweating. The program tried to use SDA1, SLC1 pins, instead of 20 (SDA), 21 (SCL) pins.
This is because the following lines in the file (C:\Users-----user------\Documents\Arduino\libraries\Adafruit_FT6206_Library-master\Adafruit_FT6206.cpp):

#if defined(SAM3X8E)
#define Wire Wire1
#endif

SAM3X8E is indeed defined (see VisualStudio | Project right click | Properties | Configuration Properties | C/C++ | Preprocessor | Preprocessor Definitions

So Wire1 is pointing to the SDA1, SLC1 pins or something. So I just commented out those 3 lines. And everything works.

So now the example little app called CapTouchPaint works fine.

Well, I also had to define my RESET pin when instantiating the Adafruit_ILI9341 class:

Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, 22); //I am using pin 22 for the reset pin

Oh and yes the code uses only one I2C address, it is the 0x38, works fine.

Thanks Levente for helping me :),

Levente