I2C on Edge2 IO module (magnetometer)

Which system do you use? Android, Ubuntu, OOWOW or others?

Ubuntu 22.04

Which version of system do you use? Khadas official images, self built images, or others?

Self built

Please describe your issue below:

I have a edge2 board, with the IO module and a magnetometer (Adafruit Triple-axis Magnetometer - LIS3MDL [STEMMA QT / Qwiic] : ID 4479 : Adafruit Industries, Unique & fun DIY electronics and kits) connected in i2c mode (SDA, SCL, VCC and GND of the gpio pins of the module)

I couldn’t find any documentation on the edge2 documentation pages on how to set it up to be able to read the measures from the sensor, or how to use the i2c pins on the gpio.
Is that documentation available somewhere ? Or has anyone done it before ?

Thanks for the help,
Paul

Hi @paul-biped

The Edge2 IO I2C is the device /dev/i2c-6 in linux, one method is you may need to create your own simple userspace driver to read and write from the i2c device.

You just need to do basic wiring between IO board and the I2C device.
SCL ↔ SCL
SDA ↔ SDA
GND ↔ GND
3.3v ↔ VIN

You can check out this document for some reference:
https://elinux.org/Interfacing_with_I2C_Devices

Also refer to the sensor datasheet to configure the device with correct parameters.

Perfect !
Couldn’t figure out which bus number it was from the docs.
I used the smbus2 python library and adapted this snippet and everything worked.
Thanks for the help !

1 Like