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.

MSP430FR2355: I2C master

Part Number: MSP430FR2355

I wrote code for a I2C master on the FR2155 which works fine.

I use the code in an other uP fr2355 and now it does not work.

when I come to the start condition line

    UCB1CTLW0 |= UCTR + UCTXSTT;             // I2C TX, start condition

, no start condition is issued (checked with scope)

I also did a manual test (writing to the Port registers) of the pins, to see if the hardware is connected.

GIE and UCB1TXIE is 1""

any ideas?

thanks for your help

best regards

kurt

  • Hi,
    Can you post the wave using oscilloscope?
    Have you use a pull up resistor?
    Eason
  • Hi Eason,

    scope shows 3.3V, straight line on both signals SDA and SCL

    both signals have 10k pull up

    best regards
    Kurt
  • Hi,
    Have you make a compare with our sample code?
    If you still can't solve it, please post your code.
    Eason
  • Hi Eason,

    very strange, I used an old version HW with the same software and it works.


    here is the init code for the module

    void Init_MASTER(void){
    MasterMode = MASTER_IDLE;
    UCB1CTLW0 = UCSWRST; // put eUSCI_B in reset state
    UCB1CTLW0 |= UCMODE_3 + +UCSYNC + UCMST + UCSSEL1 + UCSSEL0; // I2C master mode
    UCB1BRW = 0x5A; // 0x5A pulse width H or L >4.7us!
    UCB1CTLW0 &= ~UCSWRST; // eUSCI_B in operational state
    UCB1IE |= UCNACKIE;
    }


    here is the TX code

    void I2C_Master_ReadReg(unsigned char dev_addr, \
    unsigned char reg_addr, \
    unsigned char count,
    unsigned char *pData, \
    I2C_Callback Sub){
    while(!(MasterMode == MASTER_IDLE)); //Wait till I2C ready
    MasterMode = TX_REG_ADDRESS_MODE; // Initialize state machine
    MasterTransmitRegAddr = reg_addr; // Register address to start to read from
    MasterRXByteCtr = count; // How many Bytes to read
    pMasterRXDATA = pData; // Set pointer to receive buffer
    RXFunc = Sub; // Function to run after bytes received
    UCB1I2CSA = dev_addr; // Set slave address
    MasterTXByteCtr = 0;
    UCB1IFG &= ~(UCTXIFG + UCRXIFG); // Clear any pending interrupts
    UCB1IE &= ~UCRXIE; // Disable RX interrupt
    UCB1IE |= UCTXIE; // Enable TX interrupt
    UCB1CTLW0 |= UCTR + UCTXSTT; // I2C TX, start condition
    }



    on the new PCB the UCBBUSY in the UCB1STATW register is set as soon as UCSWRT goes low. I assume when the UCBBUSY BIT is high you can't send any start/stop or bytes?

    on the old PCB the UCBBUSY goes only high after the UCB1CTLW0 |= UCTR + UCTXSTT line

    I assume there is something wrong with the chip???? = brand new out of the box! I hand soldered it, maybe tooo hot?

    thanks for your help
    Kurt
  • Hi Eason,

    an other possibility:

    the slave's GND was not connected, it could have put out ~7V on to the I2C bus, which I am sure broke the Pins.

    my question is:
    if the Pins are broken in I2C mode (P4SEL0 = 1), can they still work as IO (P4SEL0=0), as they do?

    best regards
    Kurt
  • Hi,

    1. I am not sure. It is hard to judge whether this pin is still can work, because you have been too much over spec.

    2. I advice you have a try.

    Eason

  • Eason,

    resoldering the slave and replacing the MSP430 fixed the problem.

    bets regards
    Kurt

**Attention** This is a public forum