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.

MSP430F168: Probing I2C SCL line from CRO causing I2C to stop working

Part Number: MSP430F168
Other Parts Discussed in Thread: TMP100, PCF8574, DAC8571

Dear sir,

In I2C we are fessing some problems (100KHz only)

ie . 1. some PCB's working properly and some  PCB's it is not working and in not working pcb if we connect CRO it is working and in working pcb CRO connecting time it is failing and CLK going to LOW

2. in some PCB's not working and putting CRO also it is nit working.

3. in SDA pin putting 100nf to ground then it is working.

In PCB tracks lent matching is OK and we are tried inter phasing externally with wires also not working.

Can we try in former ware side?

 My Mail ID : nsprateep@sirveen.com

  • Hi,

    what do you mean by "CRO"?

    Both communication lines, SDA and SCL, need an external pull-up resistor in the range of 1k-10kOhm, typically 4.7kOhm. Adding capacitance to either of the lines is not recommended as this capacitance will have an negative impact of the clock and data signals. The "squares" will become round-shaped and the communication speed needs to be lowered.

    Please also check chapter 5 of this application note: Solutions to Common eUSCI and USCI Serial Communication Issues on MSP430™ MCUs

    Best regards,

    Andre

  • Dear Sir,

    Thank you to reply me.

    CRO  is a Oscilloscope, with this we are checking wave forms.

    I tried with 1K Pull up's and 4.7K pull up's also.but it has same behavior.  

  • Hi,
    Have you read the document I proposed in my earlier thread? It covers quite a lot common issues why communication is not working.

    Best regards,
    Andre
  • Hi,

    do you have further questions regarding this topic? If not, please select "Resolved" for the post that solved your issue so this thread can be closed out. If you have a different question please select "Ask a related question" or " Ask a new question".
    Thanks a lot!

    Best regards,
    Andre
  • void i2c_start()
    {
    DATA_LOW;
    delay(60);
    CLK_LOW;

    }

    void i2c_stop()
    {
    CLK_HIGH;
    delay(60);
    DATA_HIGH;
    }

    int eepwrite_byte(int data)
    {
    char ii;
    int tmout=19800*10;//5mspp


    printf("0X%x ",data);
    DATA_PIN_OUTPUT;
    for(ii=0; ii<8; ii++)
    {
    CLK_LOW;
    if(data & 0x80)
    DATA_HIGH;
    else
    DATA_LOW;
    data <<= 1;
    delay(15); //delay Tdc = 200ns
    CLK_HIGH;
    delay(15); //delay Tcdh = 280ns
    }
    delay(15);
    CLK_LOW;
    delay(15); //Tcwh = 4us
    CLK_HIGH;

    DATA_PIN_INPUT;


    while(tmout--) //wating for acknowledgement
    {
    if(!(GPIOPINRD & DATA_PIN))
    {
    DATA_PIN_OUTPUT;

    printf("i2c_ACK SUCESS\r\n");
    return 1;
    }
    }
    printf("i2c_tmout happen \r\n");

    DATA_PIN_OUTPUT;

    }


    static int32_t pageWrite(uint16_t addr, uint8_t *data, int32_t numbytes)
    {
    uint32_t tmout;
    volatile uint32_t dummy;
    uint8_t msb;


    i2c_start();

    eepwrite_byte(0xa0); //writing address,slave select
    msb=(addr & 0xFF00)>>8;
    printf("msb=%x ",msb);
    eepwrite_byte(msb); // MSB ADDRESS
    msb=(addr & 0x00ff);
    printf("lsb=%x ",msb);
    eepwrite_byte(msb);

    //i2c_start();
    while(numbytes)
    {
    eepwrite_byte( *data++);
    numbytes--;
    }
    i2c_stop();
    return 0;
    }

  • Dear sir Please current me, we are trying to this code .Now we are able to see the wave forms in oscilloscope,But read write functions not getting sexes. is there any corrections in the above code?
  • Hi,

    Looking at your code it is hard to tell what is going wrong.  Your are doing bitbanging to do I2C communication. Although this is one way to do it, I would recommend to go utilize the respective peripheral. The USART module has an integrated I2C interface to help with communication. Please check out the code examples we provide to show how we do communications. You can find them on the product folder MSP430F168 under the tab "Tools & software" tab.

    These are the examples we provide for I2C communication.

     fet140_i2c_01.c I2C, Master Intf. to TMP100, Set P1.0 if Temp > 28C

     fet140_i2c_02.c I2C, Master Interface to PCF8574, Read/Write

     fet140_i2c_03.c I2C, Master Interface to DAC8571 in Repeat Mode

     fet140_i2c_04.c I2C, Master Reads from MSP430 Slave

     fet140_i2c_05.c I2C, Slave Transmits to MSP430 Master

     fet140_i2c_06.c I2C, Master Transmits to MSP430 Slave RX

     fet140_i2c_07.c I2C, Slave Reads from MSP430 Master

     fet140_i2c_08.c I2C, Master Writes Multiple Bytes to MSP430 Slave

     fet140_i2c_09.c I2C, Master Reads from MSP430 Slave in Repeat Mode

     fet140_i2c_10.c I2C, Slave Writes to MSP430 Master RX in Repeat Mode

     fet140_i2c_12.c I2C, Master Interface to DAC8571, Write

     fet140_i2c_13.c I2C, Master Interface to DAC8571, Read/Write

     fet140_i2c_14.c Switch Between UART0 & Master I2C Transmitter

     fet140_i2c_15.c I2C, Slave TMP100 Emulation II

     fet140_i2c_16.c I2C, Master Writes/Reads with Slave, Rptd Start

     fet140_i2c_17.c I2C, Slave Reads/Writes with Master, Rptd Start

    Best regards,

    Andre

  • Hi,

    do you have further questions regarding this topic? If not, please select "Resolved" for the post that solved your issue so this thread can be closed out. If you have a different question, please select "Ask a related question" or " Ask a new question".
    Thanks a lot!

    Best regards,
    Andre
  • Thank you sir,

    now we are continuing with poling method only.

**Attention** This is a public forum