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.

TM4C123GH6PM I2C Capacitive Touchscreen

Other Parts Discussed in Thread: EK-TM4C123GXL

Hello,

About 1 month ago i ask your help for initializing an round display for a smartwatch.

Now i am trying to make the touchscreen work but i had no luck.

Its datasheet is not very explicit. I am using I2C for it, but i have some questions:

Its address is : 1000100, with a R/W bit, R=0,W=1 and 8 bits after that should be the read value.

I will attach the datasheet.

My code is a little bit complex (got over 2500 lines) so it doesn t make sense to post it all.

My touchscreen is connected to PB2 and PB3. So its I2C0 module.

#define SLAVE_ADDRESS 0x8C

void I2C_Init()
{

ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); //Enable GPIOB// this line is not actually here, its in the main

ROM_SysCtlPeripheralEnable (SYSCTL_PERIPH_I2C0);


GPIOPinTypeI2CSCL(GPIO_PORTB_BASE, GPIO_PIN_2);
GPIOPinTypeI2C(GPIO_PORTB_BASE, GPIO_PIN_3);
GPIOPinConfigure (GPIO_PB2_I2C0SCL);
GPIOPinConfigure (GPIO_PB3_I2C0SDA);
I2CMasterInitExpClk(I2C0_BASE, SysCtlClockGet(), false); //DE CE TRUW!?!?!?
I2CMasterEnable (I2C0_BASE);
}

uint32_t I2CReceive(uint32_t slave_addr, uint8_t reg)
{
//specify that we are writing (a register address) to the
//slave device
I2CMasterSlaveAddrSet(I2C0_BASE, slave_addr, false);

//specify register to be read
I2CMasterDataPut(I2C0_BASE, reg);

//send control byte and register address byte to slave device
I2CMasterControl(I2C0_BASE, I2C_MASTER_CMD_SINGLE_SEND);

//wait for MCU to finish transaction
while(I2CMasterBusy(I2C0_BASE));

//specify that we are going to read from slave device
I2CMasterSlaveAddrSet(I2C0_BASE, slave_addr, true);

//send control byte and read from the register we
//specified
I2CMasterControl(I2C0_BASE, I2C_MASTER_CMD_SINGLE_RECEIVE);

//wait for MCU to finish transaction
while(I2CMasterBusy(I2C0_BASE));

//return data pulled from the specified register
return I2CMasterDataGet(I2C0_BASE);
}

This function I2CReceive(SLAVE_ADDRESS,reg); returns always the same value no matter where i touch the CTP (Capacitive Touchscreen Panel). Can anyone help me? Some ideas?

Thank you! I don t have an oscilloscope right now so i can view the signals.

IT7258_A_V0.2.6_120414---CTP driver IC.pdf

  • Iliescu Mihai said:
    with a R/W bit, R=0,W=1

    That R=0 and W=1 is contrary to every other implementation I've seen - going back to the early '80's!

    You describe an "attachment" - none appears!    And then a "web-site" - again, none appears.

    Have you tested that specific I2C port w/a simpler interface?   (we always start w/a small capacity I2C memory - which insures that we can both read & write via I2C)

    Managing that interface w/out a scope is not pleasant - nor quick - nor easy...   IIRC - there are a few basic I2C diagnostic methods which employed the PC's printer port.   Few have PCs containing those - yet "something" beats "nothing."

  • Hello Illiescu,

    Would it not be good to have critical info (scope) in place for a debug, rather than shooting in the dark.

    Regards
    Amit
  • I know, i have oscilloscopes at my work place and at my university, but right now i am far away (500 miles) and i will get home in about a week.

    Do you have any ideea what the problem could be?

    When i give the address, it has to be 7 bit long or 8 bit long? ( i mean, i have to include the R/W in the address, or no?)
    I don't know exactly how i2c module from tiva works. its adding the read/write bit after the address or it should be included?
  • Hello Illiescu

    Address on I2C is always 7 bit, 1 bit for direction and 1 bit for ACK.

    www.ti.com/.../spma073.pdf

    My best bet would be a slave NAK if the Pull up are correctly working.

    Regards
    Amit
  • I got 4k7 pull-ups, its not enough?
  • Hello Iliescu

    That is good enough. So most probably you may be getting a NAK and only a scope will tell you what is happening on the bus.

    Regards
    Amit
  • There ARE times when a Scope or Logic Analyzer are unavailable and/or inconvenient. (i.e. when "away" from AC power (the field))

    Firm/I have always believed that a small, battery powered MCU - properly programmed & populated - could prove an effective, diagnostic tool. And one especially suited for I2C, SPI, even UART. A small text display could aid set-up and display results - enabling diagnosis - perhaps even (outperforming) the "entirely manual" Scope Analysis.

    Sub 1 (USD) Cortex M0 MCU should prove adequate for such role. Firm/I have contemplated such a product - which could include other (usual & desired) functions - as well.

    As this suggestion has (now) landed - might any here w/knowledge of (similar) diagnostic devices - share their findings - right here? (re-inventing an "existing" wheel - unless we can do that far better & at lower cost - does not excite our investor group...)
  • Hello cb1

    Indeed sir. We are working on converting a EK-TM4C123GXL for the same ends.

    Regards
    Amit
  • Hi Amit,

    That conversion could work - but the presence of the ICDI - the inability to directly "plug-in" to a text display - and the LARGE Size of that EK board - seem to work against such an implementation.

    Instead - we envision a (far) lower cost M0 MCU upon a "purpose design/built pcb" - all built w/in the "shadow" of a small, low cost text display & battery powered.   (like this)  

    The (5 Way) "Navigation Switch" enables smallest size - yet provides quick screen set-up & precise control.   The M0 ARM controller fits (fully) w/in the "shadow" of the pictured display - small size is a key factor - we believe...

  • Hello cb1

    Great. We do not plan to use the ICDI, but the USB port to the device.

    Regards
    Amit
  • Hello Iliescu,

    did you manage to run the touchscreen?

    I'm currently trying to use it with one of my projects. So far I'm able to communicate with the IT7258 Touchscreen controller via I2C.

    The problem I have is that  most of the time  it responses as "Busy" when I read the query buffer. Also I'm not able to get the CapSens Version from the chip, it returns always zeros. Is there some kind of firmware needed to run this touchscreen controller?

    Waiting for query buffer to return not busy and writing cmd to cmd buffer:

    reading cmd response buffer: