Hello,
we were using a code to read I2C data on MKR1010, it was working well.
We had to replace MKR1010 by Portenta C33. using the same code works 95% of the time, and sometimes we have kind of random reading.
We never had this kind of issue using MKR1010 with the same code.
This goes back to normal if we reboot the C33, but after few readings (or sometimes immediately), we have the same issue.
void read_page(unsigned char addr_page, char *buff) {
analogWrite(LEDR_PIN, RED_VAL_2);
analogWrite(LEDG_PIN, GREEN_VAL_2);
analogWrite(LEDB_PIN, BLUE_VAL_2);
Wire.beginTransmission(addr_page);
Wire.write(0x00); // select starting register
Wire.endTransmission(); // end write operation, as we just wanted to select the starting register
delay(10);
Wire.requestFrom(addr_page, 128, true); // stop the transmission
while (Wire.available()) {
*buff = Wire.read();
delay(i2c_delay_);
mqtt_client.loop();
buff++;
}
delay(10);
Wire.beginTransmission(addr_page);
Wire.write(0x80); // select starting register
Wire.endTransmission(); // end write operation, as we just wanted to select the starting register
delay(10);
Wire.requestFrom(addr_page, 128, true); // stop the transmission
while (Wire.available()) {
*buff = Wire.read();
delay(i2c_delay_);
mqtt_client.loop();
buff++;
}
analogWrite(LEDR_PIN, RED_VAL_1);
analogWrite(LEDG_PIN, GREEN_VAL_1);
analogWrite(LEDB_PIN, BLUE_VAL_1);
}
Best,
Jeremy