Changing I2C outputs on-the-fly

Status
Not open for further replies.
Hello

I'm having problems with a multiplexer i'm using and i'm looking for alternatives. I've noticed that the teensy 3.6 which im using has 5 different ports for the I2C 0 bus. As my setup would be pretty difficult to test, i just want to be sure beforehand, would it be possible to switch the ports being used by the I2C bus on the fly? Or would it require to reboot the microproccesor?

Thanks for the info!
 
You mean the alternate pins? Yes they can be dynamically changed via setSCL and setSDA (provided the library doesnt reset anything else in the process of course)

for i2c_t3:

Code:
    inline void setSCL(uint8_t pin) { pinConfigure_(i2c, bus, pin, i2c->currentSDA, i2c->currentPullup, 1); }
    inline void setSDA(uint8_t pin) { pinConfigure_(i2c, bus, i2c->currentSCL, pin, i2c->currentPullup, 1); }

you should be fine just changing the pins at will
 
You mean the alternate pins? Yes they can be dynamically changed via setSCL and setSDA (provided the library doesnt reset anything else in the process of course)
Yes!
Okay, i thought by reading the wire documentation that it should be possible but I wanted to be sure before starting soldering everything. I'll make a small scale test though.

Thanks!
 
I would imagine you will need pull-up resistors between each of the SCL/SDA pins and 3.3v. And obviously you would need to wait for all i2c transactions to finish before switching the SCL/SCA pins.

There are these 3 boards to give you access to the solder pins underneath the Teensy, if you want to access the pins via male/female headers:

And of course remember, if you can modify the library accessing your devices to take a pointer to the Wire/i2c_t3 device, you have 3 additional i2c buses.
 
I would imagine you will need pull-up resistors between each of the SCL/SDA pins and 3.3v. And obviously you would need to wait for all i2c transactions to finish before switching the SCL/SCA pins.

There are these 3 boards to give you access to the solder pins underneath the Teensy, if you want to access the pins via male/female headers:

And of course remember, if you can modify the library accessing your devices to take a pointer to the Wire/i2c_t3 device, you have 3 additional i2c buses.

Thanks for the boards, will check them if we have to make a PCB out of the idea. Will also make sure that every i2c transaction has ended (should be easy, just wait for the last request to be read, as i will just have a lot of ADCs on the i2c buses)

Do you think i can only multiplex the SDA lines? as the SCL is controlled by the master, it should not matter which pin it is on, isnt' it?

Also, slightly off topic, can I ask general electronic project questions in this forum or just teensy-related ones?

Thanks for the fast answers!
 
Thanks for the boards, will check them if we have to make a PCB out of the idea. Will also make sure that every i2c transaction has ended (should be easy, just wait for the last request to be read, as i will just have a lot of ADCs on the i2c buses)
I was thinking that perhaps i2c_t3 might have asynchronous support, but I don't know.

Do you think i can only multiplex the SDA lines? as the SCL is controlled by the master, it should not matter which pin it is on, isnt' it?
I'm out of my depth at this point, perhaps somebody else can chime in.

Also, slightly off topic, can I ask general electronic project questions in this forum or just teensy-related ones?

Thanks for the fast answers!
I would imagine so as long as you are using a Teensy in the project. But it may make sense to look for other forums that have more specialists if you are doing complex things.
 
Do you think i can only multiplex the SDA lines? as the SCL is controlled by the master, it should not matter which pin it is on, isnt' it?

I believe this should work if you only connect ordinary I2C (slave mode) chips, and you don't try to push it beyond the I2C capacitance limit with far too many chips.

can I ask general electronic project questions in this forum or just teensy-related ones?

Usually yes, just don't overdo it.
 
Status
Not open for further replies.
Back
Top