-
Notifications
You must be signed in to change notification settings - Fork 122
Open
Description
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels