tinygo icon indicating copy to clipboard operation
tinygo copied to clipboard

xiao-ble (sense), nrf52840 misleading I2C0 comment

Open gen2thomas opened this issue 7 months ago • 5 comments

The comment // I2C0 (external) pins is misleading, because although configuring the bus with machine.I2C0.Configure(machine.I2CConfig{}) the external pins will not be used. The reason seems to be the same code for all "I2Cx" together with the defaulting to internal.

To get the external pins to work you need to set the pins explicitly like this: machine.I2C0.Configure(machine.I2CConfig{SCL: machine.SCL0_PIN, SDA: machine.SDA0_PIN}).

gen2thomas avatar Jun 06 '25 11:06 gen2thomas

Should we change the comment, or change the default values?

deadprogram avatar Jun 08 '25 07:06 deadprogram

It would be nice, if the comment will be implemented. This means I2C0 would have the external pins per default and the I2C1 would have the internal pins per default. The internal pins are needed to access the IMU (LSM6DS3TR) in the "Sense"-version of the MCU. For the normal version only the external pins are needed.

This suggestion leads to a small problem with the existing example for IMU-driver, which uses the I2C0.

gen2thomas avatar Jun 08 '25 08:06 gen2thomas

This suggestion leads to a small problem with the existing example for IMU-driver, which uses the I2C0

So what is the best solution for the most users, do you think?

deadprogram avatar Jun 09 '25 05:06 deadprogram

Because the example is used for all MCU's and the xiao-ble sense is just one exception, I think implementing my suggestion would help the users of xiao-ble with and without sense a lot. A comment in the example could close the gap.

I have no knowledge about the "Seeed XIAO ESP32 Sense" variant at all.

gen2thomas avatar Jun 09 '25 07:06 gen2thomas

A comment in the example could close the gap.

Sounds good. Can you please submit a PR with your proposed language?

deadprogram avatar Jun 09 '25 13:06 deadprogram

To me it seems like dropping "I2C0" and "I2C1" from the pin description comments will be enough to de-confuse.

ysoldak avatar Jun 19 '25 20:06 ysoldak