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.

F28M35 I2c error

I am using the concerto experimenter kit writing and reading I2C to the eeprom. When I do a read I am getting a return = 12 on I2CMasterERR . I can do a SysCtlPeripheralReset (i2c) and the read will then work properly but it happens quite frequently and seems like a rather harsh way to clear an error. I get the error after setting up the eeprom address to align it for the read

i2cCurrentAddress = I2C_SLV_ADDR_EEPROM;

I2CMasterSlaveAddrSet(I2C0_MASTER_BASE, I2C_SLV_ADDR_EEPROM, I2C_WRITE);

while (I2CMasterBusy(I2C0_MASTER_BASE)) {}

// Dummy Write to set the future read address

I2CMasterDataPut(I2C0_MASTER_BASE, high_addr); // high address

I2CMasterControl(I2C0_MASTER_BASE, I2C_MASTER_CMD_BURST_SEND_START);

while (I2CMasterBusy(I2C0_MASTER_BASE)) {}

err =I2CMasterErr(I2C0_MASTER_BASE); //ERROR found here =12

My questions is there a better method to clear this data ack, addr ack, error then to reset the i2c periphearal?

I tried sending I2C_MASTER_CMD_BURST_RECEIVE_ERROR_STOP (0x04) didn't seem to help

When looking at the I2CMCS register in debug is this the read-only register?

Thanks in advance for your advice


 




 
  • i am experiencing the same problem!

    I2C1 is connected to microchip PortExpender MCP23018.

    the error occures during register write.

    any response will be highly appreciated.

  • I do a reset and then retry; seems to work well on the bench will see how it holds up in the field.

        err = I2CMasterErr(I2C0_MASTER_BASE);
        if (err !=0)
        {
            I2CMasterControl(I2C0_MASTER_BASE,I2C_MASTER_CMD_BURST_SEND_ERROR_STOP);
            SysCtlPeripheralReset(SYSCTL_PERIPH_I2C0);
            I2CMasterInitExpClk(I2C0_MASTER_BASE, SysCtlClockGet(
                                    SYSTEM_CLOCK_SPEED), false);
            ul_i2c_timeout=0;
            while (I2CMasterBusy(I2C0_MASTER_BASE))    //wait till done
            {
                ul_i2c_timeout++;
                if(ul_i2c_timeout > I2C_TIMEOUT_MAX){break;}
            }
            I2CMasterSlaveAddrSet(I2C0_MASTER_BASE, i2cCurrentAddress, I2C_WRITE);
            err = I2CMasterErr(I2C0_MASTER_BASE);
            if (err==0)        //reset successful
            {
                err=2;    //retry
            }

  • Hi Dan,

    I can see you're using some code I posted here before, I'm glad it's helping other people.

    I remember I struggle for long time to make it work because of this line necessary during the I2C Setup, before calling GPIOPinConfigure:

    GPIOPinUnlock(GPIO_PORTB_BASE, GPIO_PIN_7); // I hate so much TI for this function, so necessary and so poorly documented!

    yes, that is the real comment on my code.

    hope it helps