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.

MSP430FR2311: SCL Clock

Part Number: MSP430FR2311
Other Parts Discussed in Thread: MSP430G2553

I have a configure a USCI  Module as a I2C.

Can I See clock of that module on SCL Pin?

  • Hello Kelvin,

    If you have configured the USCIB0 in I2C Master mode, You should be able to see clock on P1.3/UCB0SOMI/UCB0SCL/OA0O/A3  in MSP430FR2311.

    Regards,

    Vikas Chola

  • I have a configured MSP430G2553 uc as I2C Master mode and I am seeing clock on P1.6 pin. But it is not available...
  • For Testing the Clock I am using Demo code from Ti uc.
  • Below Code I am Using:

    #include <msp430.h>

    unsigned char *PTxData; // Pointer to TX data
    unsigned char TXByteCtr;
    const unsigned char TxData[] = // Table of data to transmit
    {
    0x11,
    0x22,
    0x33,
    0x44,
    0x55
    };

    int main(void)
    {
    WDTCTL = WDTPW + WDTHOLD; // Stop WDT
    P1SEL |= BIT6 + BIT7; // Assign I2C pins to USCI_B0
    P1SEL2|= BIT6 + BIT7; // 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 = 0x48; // Slave Address is 048h
    UCB0CTL1 &= ~UCSWRST; // Clear SW reset, resume operation
    IE2 |= UCB0TXIE; // Enable TX interrupt

    while (1)
    {
    PTxData = (unsigned char *)TxData; // TX array start address
    TXByteCtr = sizeof TxData; // Load TX byte counter
    while (UCB0CTL1 & UCTXSTP); // Ensure stop condition got sent
    UCB0CTL1 |= UCTR + UCTXSTT; // I2C TX, start condition
    __bis_SR_register(CPUOFF + GIE); // Enter LPM0 w/ interrupts
    // Remain in LPM0 until all data
    // is TX'd
    }
    }

    //------------------------------------------------------------------------------
    // The USCIAB0TX_ISR is structured such that it can be used to transmit any
    // number of bytes by pre-loading TXByteCtr with the byte count. Also, TXData
    // points to the next byte to transmit.
    //------------------------------------------------------------------------------
    #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
    #pragma vector = USCIAB0TX_VECTOR
    __interrupt void USCIAB0TX_ISR(void)
    #elif defined(__GNUC__)
    void __attribute__ ((interrupt(USCIAB0TX_VECTOR))) USCIAB0TX_ISR (void)
    #else
    #error Compiler not supported!
    #endif
    {
    if (TXByteCtr) // Check TX byte counter
    {
    UCB0TXBUF = *PTxData++; // Load TX buffer
    TXByteCtr--; // Decrement TX byte counter
    }
    else
    {
    UCB0CTL1 |= UCTXSTP; // I2C stop condition
    IFG2 &= ~UCB0TXIFG; // Clear USCI_B0 TX int flag
    __bic_SR_register_on_exit(CPUOFF); // Exit LPM0
    }
    }
  • Where did you get that example from?

    You are not clearing LOCKLPM5.
  • Above Example is Demo Code from TI
  • LOCKLPM5 is not applicable for MSP430G2553
  • LOCKLPM5 is applicate for the MCU that you have selected for the question.

    Anyway, what do you have connected to the pin? I²C needs at least a pull-up resistor.

**Attention** This is a public forum