toggle quoted messageShow quoted text
I have yet to see a SOC that allows connecting one internal I2C controller to two sets of external pins at one time. Although theoretically possible it would be an unusual feature, and of very limited use. The usual solution is to have
multiple I2C controllers in the SOC, and allow routing of each controller to various pins on the SOC package.
I just had a quick read through the Mighty Gecko datasheet. The processor has two I2C controllers, which in Zephyr parlance will be I2C_1 and I2C_2. You need to define both controllers and their physical pins in your device tree overlay.
Then your software must open both controllers, and you must communicate with your peripherals through the correct I2C controller.
Hope this helps.
On Behalf Of
Monday, November 23, 2020 2:47 AM
Nikolaus Huber <nikolaus.huber@...>
Erik Englund <erik.englund@...>; users@...
Re: Private: Re: [Zephyr-users] Same I2C bus on different pins #driver #i2c
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.
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!
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.
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: