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 Busy Bit doesn’t clear after reset in CC2538

Hi,

 

I try to get I2C working but I noticed the Busy Bit in Register I2CM_STAT keeps staying 1 regardless what I do.  I see the value in the Debugger and also in a separate Variable in the code below.

 

In the Datasheet (at Page 449) is written that the reset value should be 0. Can you help me to reset this Bit?

Thanks in advance,

Max

uint32_t debug1;
int main() {
  debug1 = HWREG(I2CM_STAT);
  if(debug1) { 
    __no_operation();
  }
}

  • Max,

    are you connecting the I2C pins with external pull-up? If not, it could be the reason since the module sees the pin state is low.

  • Hi Leo,

     

    Thanks for the reply. I have connected the two Pins with external pull ups.

  • Hi,

     

    now I have managed that I got my code running. But still can’t see any action on the SCL/SDA pins.

    I don’t know what I’m doing wrong. Maybe one of you knows it.

    SysCtrlClockSet(false, true, SYS_CTRL_SYSDIV_16MHZ);
    SysCtrlIOClockSet(SYS_CTRL_SYSDIV_16MHZ);
      
    //Turn on the i2c clock in all states
    HWREG(SYS_CTRL_RCGCI2C) |= 0x0001;
    HWREG(SYS_CTRL_SCGCI2C) |= 0x0001;
    HWREG(SYS_CTRL_DCGCI2C) |= 0x0001;
      
    //Setup the SDA and SCL to the right port functions
    GPIOPinTypeI2C(          GPIO_B_BASE, GPIO_PIN_1);
    IOCPinConfigPeriphOutput(GPIO_B_BASE, GPIO_PIN_1, IOC_MUX_OUT_SEL_I2C_CMSSDA);
    IOCPinConfigPeriphInput( GPIO_B_BASE, GPIO_PIN_1, IOC_I2CMSSDA);
      
    GPIOPinTypeI2C(          GPIO_B_BASE, GPIO_PIN_2);
    IOCPinConfigPeriphOutput(GPIO_B_BASE, GPIO_PIN_2, IOC_MUX_OUT_SEL_I2C_CMSSCL);
    IOCPinConfigPeriphInput( GPIO_B_BASE, GPIO_PIN_2, IOC_I2CMSSCL);
    
    //Enable Master Block
    I2CMasterEnable(); //HWREG(I2CM_CR) |=  0x00000010;
     
    // Get the desired SCL speed.
    I2CMasterInitExpClk(SysCtrlClockGet(), false); //slow transfer
      
    //Slave Address
    I2CMasterSlaveAddrSet(0x60, false);
      
    I2CMasterDataPut(0xAA);
      
    I2CMasterControl(I2C_MASTER_CMD_SINGLE_SEND);
        
    //wait on busy then check error flag
    while( (HWREG(I2CM_STAT) & I2CM_STAT_BUSY) );
    while(!HWREG(I2CM_RIS));
    HWREG(I2CM_ICR) |= 0x01;