You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Whilst writing to an I2C EEPROM it's necessary to write eeprom memory address followed by the data to write without a STOP between the address and the data. A typical write function would accept a memory address and data as separate parameters. This is best written to the EEPROM in 2 API calls:
1st: Sends device address and eeprom memory address
2nd: Sends data, followed by a STOP
The only achievable way is using the following APIs:
// nostop is true so STOP isn't sent allowing data bytes to follow immediately
i2c_write_blocking(m_instance, m_devAddr, &address, 1, true);
i2c_write_raw_blocking(m_instance, &data, sizeof(data));
However, i2c_write_raw_blocking does not write a STOP.
It would be helpful to include the nostop paramter to i2c_write_raw_blocking function:
static inline void i2c_write_raw_blocking(i2c_inst_t *i2c, const uint8_t *src, size_t len, bool nostop) {
for (size_t i = 0; i < len; ++i) {
bool last = i == len - 1;
// TODO NACK or STOP on end?
while (!i2c_get_write_available(i2c))
tight_loop_contents();
i2c_get_hw(i2c)->data_cmd =
bool_to_bit(last && !nostop) << I2C_IC_DATA_CMD_STOP_LSB |
*src++;
}
}
There's already a comment in there about this.
The text was updated successfully, but these errors were encountered:
Whilst writing to an I2C EEPROM it's necessary to write eeprom memory address followed by the data to write without a STOP between the address and the data. A typical write function would accept a memory address and data as separate parameters. This is best written to the EEPROM in 2 API calls:
1st: Sends device address and eeprom memory address
2nd: Sends data, followed by a STOP
The only achievable way is using the following APIs:
However,
i2c_write_raw_blocking
does not write a STOP.It would be helpful to include the
nostop
paramter toi2c_write_raw_blocking
function:There's already a comment in there about this.
The text was updated successfully, but these errors were encountered: