
Originally Posted by
sid8580
Hello,
How would I use the additional I2C busses on the Teensy 4.0, without something like the i2c_t3 library I'd been using with the T3.6? I don't know how to avoid being limited to SCA/SDL 0. The T4.0 has several sets of I2C, is it possible to use them at this point?
Worst case, I will have to try running everything off 1 I2C bus and use a multiplexer if I run into overlapping addresses. Was hoping not to though, I've got a couple of sensors that probably each utilize most of the bandwidth of a bus on their own and I've (foolishly) done a complete rebuild of a huge project using the 4.0... kicking myself for not having checked up on compatibility first, whoops...
Glancing at the code for Wire indeed the T4 code shows support in \hardware\teensy\avr\libraries\Wire\WireIMXRT.h for:
Code:
extern TwoWire Wire;
extern TwoWire Wire1;
extern TwoWire Wire2;
and in :: \hardware\teensy\avr\libraries\Wire\WireIMXRT.cpp
Code:
TwoWire Wire(&IMXRT_LPI2C1, TwoWire::i2c1_hardware);
TwoWire Wire1(&IMXRT_LPI2C3, TwoWire::i2c3_hardware);
TwoWire Wire2(&IMXRT_LPI2C4, TwoWire::i2c4_hardware);
That is the normal convention for accessing alternate i2c ports.