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

Hi,

i have some problems with the hardware, i use the program example (i2c_examples 4 & 5) and i make the conection that apears in the example, however i can`t  see anything on the oscilloscope, i mind i can`t see the data and clock lines, is all the time vcc (3.3 V).

What i`m doing wrong?

Thanks.

Gaston

  • Would you provide the specific device you are targeting and the source of the code examples you are using?  There should be a literature number associated with the code examples.

    Secondly, if you could post your example code, that would help as well.

  • Hi BrandonAzbell ,

             i'm using  PCF8574P  to interface 7 segment display  with MSP430F2274 micro controller.  i am also  using a example  program  "msp430x22x4_uscib0_i2c_02 "  from " slac123d.zib "  zib file. As per the diagram in the program i have connected the hardware.  

     

    Hardware details:

    Pullup resistors = 10k(for scl),10k(for sda) , connected with VCC of 2274 (refered  diagram in the program)

    PCF8574p slave address : 0x20 ->>>  A0=A1=A2=VSS, grounded

    P0 pin of PCF8574P is connected to ground, [VSS]

    p1,p2,p3  pins of PCF8574P is connected to supply [VCC]

    p4-p7 pins of PCF8574P is connected to 4 pins of 7 segment display , the common pin of 7 segment display is connected to supply

    according to the program  if PCF8574P IC  gets  zero voltage in P0/p1/p2/P3 then one of this segment in P4/P5/P6/P7 segment must glow [ 7 segment is common anode type ].but  if  I run the program the I/O pins PCF8574 P0-P7 is getting voltage 3.35V [ VCC]

    so, no 7segment is glowing??????????

    can somebody provide me the reason for the problem or the proper Master( Transmit mode ) code with PCF interface .....

     

     

     

     

    //******************************************************************************
    //  MSP430F22x4 Demo - USCI_B0 I2C Master Interface to PCF8574, Read/Write
    //
    //  Description: I2C communication with a PCF8574 in read and write mode is
    //  demonstrated. PCF8574 port P is configured with P0-P3 input, P4-P7. Read
    //  P0-P3 input data is written back to Port P4-P7. This example uses the
    //  RX ISR and generates an I2C restart condition while switching from
    //  master receiver to master transmitter.
    //  ACLK = n/a, MCLK = SMCLK = TACLK = BRCLK = default DCO = ~1.2MHz
    //
    //                                MSP430F22x4
    //                              -----------------
    //                  /|\ /|\ /|\|              XIN|-
    //                  10k 10k  | |                 |
    //       PCF8574     |   |   --|RST          XOUT|-
    //       ---------   |   |     |                 |
    //  --->|P0    SDA|<-|---+---->|P3.1/UCB0SDA     |
    //  --->|P1       |  |         |                 |
    //  --->|P2       |  |         |                 |
    //  --->|P3    SCL|<-+---------|P3.2/UCB0SCL     |
    //  <---|P4       |            |                 |
    //  <---|P5       |            |                 |
    //  <---|P6       |            |                 |
    //  <---|P7       |            |                 |
    //   +--|A0,A1,A2 |            |                 |
    //   |  |         |            |                 |
    //  \|/
    //
    //  Andreas Dannenberg
    //  Texas Instruments Inc.
    //  March 2006
    //  Built with CCE Version: 3.2.0 and IAR Embedded Workbench Version: 3.41A
    //******************************************************************************
    #include "msp430x22x4.h"

    void main(void)
    {
      WDTCTL = WDTPW + WDTHOLD;                 // Stop Watchdog Timer
      P3SEL |= 0x06;                            // Assign I2C pins to USCI_B0
      UCB0CTL1 |= UCSWRST;                      // Enable SW reset
      UCB0CTL0 = UCMST+UCMODE_3+UCSYNC;         // I2C Master, synchronous mode
      UCB0CTL1 = UCSSEL_2+UCSWRST;              // Use SMCLK, keep SW reset
      UCB0BR0 = 12;                             // fSCL = SMCLK/12 = ~100kHz
      UCB0BR1 = 0;
      UCB0I2CSA = 0x20;                         // Set slave address
      UCB0CTL1 &= ~UCSWRST;                     // Clear SW reset, resume operation
      IE2 |= UCB0RXIE;                          // Enable RX interrupt
      TACCTL0 = CCIE;                           // TACCR0 interrupt enabled
      TACTL = TASSEL_2 + MC_2;                  // SMCLK, contmode

      while (1)
      {
        __bis_SR_register(CPUOFF + GIE);        // CPU off, interrupts enabled
        UCB0CTL1 &= ~UCTR;                      // I2C RX
        UCB0CTL1 |= UCTXSTT;                    // I2C start condition
        while (UCB0CTL1 & UCTXSTT);             // Loop until I2C STT is sent
        UCB0CTL1 |= UCTR + UCTXSTT;             // I2C TX, start condition
        __bis_SR_register(CPUOFF + GIE);        // CPU off, interrupts enabled
        while (UCB0CTL1 & UCTXSTT);             // Loop until I2C STT is sent
        UCB0CTL1 |= UCTXSTP;                    // I2C stop condition after 1st TX
      }
    }

    #pragma vector = TIMERA0_VECTOR
    __interrupt void TA0_ISR(void)
    {
      __bic_SR_register_on_exit(CPUOFF);        // Exit LPM0
    }

    // USCI_B0 Data ISR
    #pragma vector = USCIAB0TX_VECTOR
    __interrupt void USCIAB0TX_ISR(void)
    {
      UCB0TXBUF = (UCB0RXBUF << 4) | 0x0f;      // Move RX data to TX
      __bic_SR_register_on_exit(CPUOFF);        // Exit LPM0
    }

     

    any help could be welcomed on this issue.....

**Attention** This is a public forum