Skip to content

MXC_I2C_RevA_MasterTransaction Stale Data Reads #1488

@Max4well

Description

@Max4well

Hardware: MAX32672 (RevA I2C Peripheral)

Peripheral: LTC2991 ADC

Sampling Rate: 1000 Hz

Problem: When performing a standard I2C read (1-byte Write for register address followed by a 2-byte Read via Repeated Start), the driver eventually starts returning stale data. The values from the slave device stop updating (frozen), yet the function continues to return E_NO_ERROR. Data updates correctly for a period, then becomes "frozen" (stale). No communication error is reported.

int i2c_read( int address, unsigned char *data, unsigned char *reg, int length)
{

    mxc_i2c_req_t reqMaster;

    reqMaster.i2c = I2C_MASTER;
    reqMaster.addr = address;
    reqMaster.tx_buf = reg;
    reqMaster.tx_len = 1;
    reqMaster.rx_buf = (unsigned char *)data;
    reqMaster.rx_len = length;
    reqMaster.restart = 0;
    reqMaster.callback = NULL;

    return MXC_I2C_MasterTransaction(&reqMaster);

}

When I remove these lines inside the MXC_I2C_RevA_MasterTransaction

    if ((req->rx_len != 0) && (req->tx_len != 0)) {
        while (!(i2c->intfl0 & MXC_F_I2C_REVA_INTFL0_DONE)) {}
        // Wait for Transaction to finish

        i2c->intfl0 |= MXC_F_I2C_REVA_INTFL0_DONE;
    }

The transaction is stable at 1000 Hz, and data updates correctly without any freezes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions