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.

MSP430FR5994: I2C BUSY issue

Part Number: MSP430FR5994

Hi,

I am using i2c based temperature IC in my project. After initializing i2c , the device continuously showing i2c busy just after initialization in debug mode.

This is my initialization function.

void i2c_init()
{
  P6SEL0 |= (BIT4| BIT5);   //selecting sda/scl pin
  P6SEL1 &= ~(BIT4| BIT5);

  P6DIR &= ~(I2C_SCL);    //as input
  P6DIR |= I2C_SDA;       //as output
 
  UCB3CTL1 |= UCSWRST;
  UCB3CTLW0 |= UCMODE_3 | UCMST | UCSYNC | UCSSEL__ACLK;
  UCB3BRW = 0x0008;
  UCB3CTL1 &= ~UCSWRST;
  UCB3IE |= UCTXIE0 | UCRXIE0 | UCSTTIE | UCNACKIE;
}

Am i doing something wrong here? Please help me in this.

  • Hi aditya,

    Does your code ever disable the GPIO power-on default high-impedance mode (PM5CTL0 &= ~LOCKLPM5;)? Please use UCB3CTLW0 instead of UCB3CTL1, this is not the issue with your code but it is a legacy nomenclature which should be avoided. Your I2C clock frequency is going to be quite slow if you are sourcing ACLK from the LFXT at 32 kHz, dividing by 8 results in 4 kHz whereas typical I2C communication is 100 kHz. If you do not have the proper I2C line pull-up resistors populated then the eUSCI will mistakenly think that the bus is busy and keep UCBBUSY set.

    Regards,
    Ryan
  • Hi Ryan,

    Thanks for your reply. I am disabling GPIO power-on default high-impedance mode (PM5CTL0 &= ~LOCKLPM5;) just before i2c initialization.
    And I am facing one more issue during debugging the code, stack pointer is outside the range.

    Fri Mar 17, 2017 09:27:30: Device : MSP430FR5994
    Fri Mar 17, 2017 09:27:32: Download complete.
    Fri Mar 17, 2017 09:27:32: Target reset
    Fri Mar 17, 2017 09:28:39: The stack pointer for stack 'Stack' (currently Memory:0x2B34) is outside the stack range (Memory:0x2B60 to Memory:0x2C00)
    Fri Mar 17, 2017 09:28:56: Target reset
    Fri Mar 17, 2017 09:43:54: Fet Connection Lost

    I am using default linker file for MSP430FR5994.

  • Hi aditya,

    What code did you add that causes the error to appear? Are you using a majority of your RAM space (lots of global & static variables and noinit pragmas) such that the stack has been reduced accordingly and is exceeded when attempting to run the application? Do you have an interrupt enabled but no ISR for it to service, or enter/exit LPM modes? You should take note of the CPU errata and see if any of them describe the issue you are experiencing.

    The stack size can be increased under Project Properties -> Build -> MSP430 Linker -> Basic Options but this won't do any good if you have too much of the RAM allocated.

    Regards,
    Ryan

**Attention** This is a public forum