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.

I2C Interfacing lpc111x with qt1050

Hi all,

I need to interface a cap-sensor, so i'm using a I2C bus to communicate between two controllers i.e.,

LPC111X[TARGET BOARD] to QT1050 [controller for touch sensor].

I have run through a simple code comparing the examples, and connected 4wires from target lpc111x to qt1050 i.e., as below:

SCL<-> SCL, SDA <-> SDA, VCC <-> VCC, GND <-> GND.

int main()
 {
	 while(1)
	 {
 i2c_lpc1_init(0x40);
//  PINSEL0 = 0x50
 LPC_I2C->SCLH = 75;
 LPC_I2C->SCLL = 75;
 LPC_I2C->CONSET = I2C_FLAG_I2EN;


 LPC_I2C->CONSET |= I2C_FLAG_STA;
 while(LPC_I2C->STAT != 0X08)


//  LPC_I2C->DAT = EEPROM_WRITE;
 LPC_I2C->CONCLR = I2C_FLAG_AA|I2C_FLAG_SI;
 while(LPC_I2C->STAT != 0X18);


 LPC_I2C->DAT = WORD_ADDR_MSB;
 LPC_I2C->CONCLR = I2C_FLAG_AA|I2C_FLAG_SI|I2C_FLAG_STA;
 while(LPC_I2C->STAT != 0X28);


 LPC_I2C->DAT = WORD_ADDR_LSB;
 LPC_I2C->CONCLR = I2C_FLAG_AA|I2C_FLAG_SI;
 while(LPC_I2C->STAT != 0X28);


//I2C0DAT = DATA;
//LPC_I2C->DAT = ICDATA;
 
 LPC_I2C->DAT |= TEST_LED1;//DAT
 delay(20);
 LPC_I2C->DAT &= ~TEST_LED1;
 delay(20);
 
 LPC_I2C->CONCLR = I2C_FLAG_AA|I2C_FLAG_SI;
 while(LPC_I2C->STAT != 0X28);


 LPC_I2C->CONSET = I2C_FLAG_STO;
 LPC_I2C->CONCLR = I2C_FLAG_AA|I2C_FLAG_SI;
 }

But my question is how to set the address pin for I2C in qt1050 controller and communicate that with target board[master & slave],

So can any one tell me how to communicate between this two controller.

Thanks in advance.

  • Hello Angiey,

    Thanks for the question.

    I am not familiar with either of these parts, and upon looking it up, it appears that you are talking about a NXP ARM processor with an Atmel touch controller. Since neither of these products are TI-based, I cannot provide much support (I do not know these products).

    However, to answer your question on how to set the address pin for the QT1050, it appears that if you go t othe QT1050 manual on page 12 (Section 4.2), it states that if you pull the ADDR_SEL to Ground, you get an I2C address of 0x41 (keep in mind that this is the 7-bit right justified address without the R/W bit!) and if you set ADDR_SEL to VCC (short it to VCC), then you get the I2C address of 0x46.

    If you are unaware of the 7-bit I2C addresses, know that when sending the address byte in I2C, you must also include the R/W bit at the end of the byte, letting the slave know if you wish to read or write to it. Please see my Application Note for more information about I2C bus transactions: www.ti.com/.../slva704.pdf
  • Hi,

    Thank you for information given.

    Yes I'm using ARM cortex M0 processor, which i'm trying to interface with qt1050 controller,and as per in the the datasheet given,

    should I connect thae addr_sel pin to the target chip,if yes which pin I should select in the target, sorry i'm very new to this I2c protocol

    so not getting much idea & one more thing how do I test the data transferred / received from master or slave.

    Thank you.

  • Angiey,

    Your ADDR_SEL pin typically gets connected directly to the VCC power rail (signifying a 1) or to ground (signifying a 0). They're used as CMOS inputs to let the device know which address it should respond to.

    If you are new to I2C protocol, I would highly suggest reading the short app note I posted, as it explains the basics of I2C, both at the electrical/phy layer, and the protocol level. www.ti.com/.../slva704.pdf

    I am not sure how you will test data sent to the QT1050 because it is not a Texas Instruments device. Typically, you write to an internal register (see the above app note for explanation on this), and then you may read from the same register to make sure you're getting the same data back.