Just wanted to follow up on this in case anyone else runs into a similar issue.
As it turns out, the problem was due to a mismatch in the I2C pin definitions — the SDA
and SCL
were swapped. Big thanks to @grobasoz for spotting the issue!
For anyone using the XIAO MG24 with the Arduino framework: the comment for the I2C pin definitions might be incorrect, which I had used as a source. According to the official XIAO MG24 schematic (KiCAD PDF), the correct wiring is:
#define SL_I2CSPM_I2C_PERIPHERAL I2C0
#define SL_I2CSPM_I2C_PERIPHERAL_NO 1
#define SL_I2CSPM_I2C_SCL_PORT gpioPortB
#define SL_I2CSPM_I2C_SCL_PIN 3
#define SL_I2CSPM_I2C_SDA_PORT gpioPortB
#define SL_I2CSPM_I2C_SDA_PIN 2
Thanks again, @grobasoz — your help saved me a lot of time!