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 receive going bonkers with change in SMCLK (eUSCI)

Other Parts Discussed in Thread: TMP275, MSP430F6736

Hi,

I am reading multiple TMP275 devices over I2C on an MSP430F6736. I read 2 consecutive bytes for the temperature reading. I have been successful with the default 32xDCO SMCLK + MCLK settings.

But, as soon as I change the MCLK to 12MHz (11.993088MHz to be precise), and the SMCLK to 749,568Hz (dividing by 16), I2C reception goes bonkers!! The first byte is received alright but the second read somehow manages to flood the MSP with RXIFG interrupts and fills my receive array (and bytes beyond it) with 0xFFs!

UCS_getSMCLK() and UCS_getMCLK() confirm the frequency that I am able to get. And, I have increased the core voltage using:

PMM_setVCore(PMM_CORE_LEVEL_2);

This is how I configure the I2C interface:

EUSCI_B_I2C_initMasterParam param = { 0 };
param.selectClockSource = EUSCI_B_I2C_CLOCKSOURCE_SMCLK;
param.i2cClk = UCS_getSMCLK();
param.dataRate = EUSCI_B_I2C_SET_DATA_RATE_100KBPS;
param.byteCounterThreshold = 0;
param.autoSTOPGeneration = EUSCI_B_I2C_NO_AUTO_STOP;

My scope confirms that the frequency generated on the SCL is about 100kHz.

Any pointers would be highly appreciated as I have possibly exhausted all my powers of reasoning this one out!

Any example code that reads multiple bytes over I2C using interrupts on eUSCI would also be great if they are using higher frequencies for the MCLK/SMCLK.

  • Solved!

    At slower speed (1MHz), this was working:

    EUSCI_B_I2C_masterReceiveStart(EUSCI_B0_BASE);
    EUSCI_B_I2C_masterMultiByteReceiveStop(EUSCI_B0_BASE);

    At 12MHz, I had to use:

    EUSCI_B_I2C_masterReceiveStart(EUSCI_B0_BASE);
    while(EUSCI_B_I2C_masterIsStartSent(EUSCI_B0_BASE));
    EUSCI_B_I2C_masterMultiByteReceiveStop(EUSCI_B0_BASE);

    So, my STOP bit was getting set too fast at 12MHz, which I had to put a check for.

**Attention** This is a public forum