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.

Problem with CC3200 I2C Slave

Other Parts Discussed in Thread: CC3200

Hi, everyone

i'm trying to use CC3200 as I2C Slave . i set the i2c slave address to #5, and enable I2C_SLAVE_INT_DATA interrupt, but i found that, when i used other MCU to  keep writing data to another address , for example, #127, CC3200 will also enter intterrupt  and SCSR register shows the cause is  I2C_SCSR_TREQ .

below is my code, any help is appreciated greatly.

void I2C_Init(void)
{
PRCMPeripheralClkEnable(PRCM_I2CA0, PRCM_RUN_MODE_CLK);
PRCMPeripheralReset(PRCM_I2CA0);
I2CSlaveInit(I2CA0_BASE, MASTER_I2C_ADDR);
I2CSlaveFIFODisable(I2CA0_BASE);
I2CSlaveIntEnableEx(I2CA0_BASE, I2C_SLAVE_INT_DATA);
I2CIntRegister(I2CA0_BASE, I2C0_IRQHandler);

//I2CMasterInitExpClk(I2CA0_BASE,80000000,false);

I2CSlaveDataGet(I2CA0_BASE);

IntEnable(INT_I2CA0);
}

void I2C0_IRQHandler(void)

{

uiStatus = I2CSlaveStatus(I2CA0_BASE);

I2CSlaveIntClearEx(I2CA0_BASE, I2C_SLAVE_INT_DATA);

if(uiStatus & I2C_SCSR_DA)

{

...

}

else if(uiStatus & I2C_SCSR_TREQ)

{

//enter here

...

}

}

  • Hi Eugene,

    Assuming you have defined MASTER_I2C_ADDR as 0x5, I just used your code above to initialize the I2C slave. But I am not able to re-create your issue, sending 127 from another master didn't make the CC3200 I2C slave invoke the interrupt handler.

    What are your pinmux configuration? Can you post the different addresses you have tried on you setup ? also the external MCU detail.

    Thanks and Regards,

    Praveen

  • Hi, Praveen 

    Thanks for the swift reply. i've found the cause was the voltage didn't reach 3V, (i didn't use hardware pull-up register, i used mcu internal pull-up register in Freescale KL05). It's my thoughtlessness, thanks for your help.

    and i have a  further question,  if i use CC3200 as I2C Slave, use another MCU to read from CC3200 via i2c, on which register could i know the I2C master gives the ACK or NACK signal to CC3200? i've tested with the register I2CMCS and I2CSACKCTL, whatever i gave ACK or NACK on i2c matser device, i didn't find any change in these two registers on CC3200.

    really thank you.

    Best Regards,

    Eugene.

  • Eugene,

    ACK or NACK are not related to MASTER or SLAVE but TRANSMITTER and RECEIVER.

    If a Transmitter (either Master or Slave) sends data to a Receiver it expects at the end an ACK from the Receiver, at the Receiver side there is no change in state.

    Tries to find a document explaining the I2C protocol.

    Leo.

  • Hi,Leo

    Thanks for your reply. you're right, ACK or NACK are given by Reveiver, but for the transmitter, there might be a register to tell whether the transmission is successful or failed, which may depend on receiving ACK or NACK. 

    for example, on the MCU Freescale KL05, when it finishes sending one data byte, one of its register will show the transmitter get ACK or NACK, what about CC3200?

  • The CC3200 has it all and much more, see the “Technical Reference Manual SWRU367”.