Good morning CircuitDojo Forum,
I’m working on an out-of-tree Zephyr device driver, and have a fair grasp of the Device Tree and DTS facets involved in drivers for Zephyr apps. I’ve recently learned that the accelerometer for which I’m developing a driver has potentially, effectively two I2C addresses. This is described in Kionix’s datasheet addendum:
Device Tree’s paradigm sets I2C addresses in
.overlay files at compile time. There does not appear to be a ready way to change a given sensor’s I2C address at run time, when it’s been associated in the device tree with a particular node there and fixed I2C address.
I am aware that there are some multi-sensor devices with two I2C addresses, allowing developers to address two different sensors in one physical package, which provides just a single wire pair for the I2C bus. Bosch’ BMI088 accelerometer plus gyroscope works this way. But in Kionix’ case the sensor is one and the same, and may power up with one of two addresses.
Is the best or only practical way to talk this sensor – in a Zephyr app context – to create a second Device Tree node with just the node label differentiated and the alternate I2C address? All other DTS node key value pairs held the same?