Re: Private: Re: [Zephyr-users] Same I2C bus on different pins #driver #i2c

Adam Podogrocki

Hi Nikolaus,

I assume that your MCU allows alternative SDA/SCL configurations but not simultaneous, i.e. you can decide on which SDA/SCL pair of pins you can have I2C bus, but not on all pairs at the same time.


On Sat, 21 Nov 2020 at 00:52, Nikolaus Huber <nikolaus.huber@...> wrote:

Thanks for your reply! The specific chip on that board has two I2C peripherals. However, all the sensors I’m interested in are on one (i2c_1). The chip allows routing the same I2C peripheral to multiple pins, i.e. the same SDA and SCL line is available on different pins. Every set of (SDA, SCL) pins still needs to be configured though. For the two pins that are listed in the device tree (the one in the board.dts file just uses those that are connected to one specific sensor), this happens in the init function of the i2c driver. The other pins (which are theoretically also connected to that I2C peripheral) are thus never configured, therefore any sensors connected to them won’t work. I could probably configure those pins manually, but then that solution doesn’t seem very nice (i.e. I would need to adjust the device tree according to which set of sensors I want to reach for each application). So what I’m trying to achieve is, that whenever I do something like i2c_write(i2c_1_dev, …) this actually happens on all pins, that are connected to the i2c_1 peripheral. 

I’m asking if anyone maybe had a similar situation (it is the first time for me that a microcontroller allows routing the same signal to multiple pins), and how to do this so that it plays nicely with the zephyr API. 

Thank’s for your input again!

On 21 Nov 2020, at 00:26, Erik Englund <erik.englund@...> wrote:


It´s a bit unclear what you´re asking.

Most MCUs require you to define what pins to use for a specific peripheral, in your case i2c_1.

If  you have several I2C peripherals(in the MCU) you may connect sensors/other-chips to whatever pins are configurable to that peripheral.

Please elaborate what the problem is.

Med vänlig hälsning
Erik Englund

Innoware Development AB
Hyttvägen 13
73338 SALA

+46(0)707319440 556790-2977

När du har kontakt med oss på Uppsala universitet med e-post så innebär det att vi behandlar dina personuppgifter. För att läsa mer om hur vi gör det kan du läsa här:

E-mailing Uppsala University means that we will process your personal data. For more information on how this is performed, please read here:

Join to automatically receive all group messages.