Teensy 3.6 I2C port 3

Status
Not open for further replies.

BriComp

Well-known member
Can anyone tell me how to access I2C port 3 (SCL3,SDA3) on Teensy 3.6, Wire3 does not exist.
I guess the pins could be assigned, but what if you want to use 4 I2C devices with Teensy3.6?
 
Can anyone tell me how to access I2C port 3 (SCL3,SDA3) on Teensy 3.6, Wire3 does not exist.
I guess the pins could be assigned, but what if you want to use 4 I2C devices with Teensy3.6?

I2C is a shared bus system. If each device has a different address, you just put them on the same bus. Each I2C device will only answer when a query is sent to that address. Many devices have solder pads or similar mechanisms to control what the address is.

If you are trying to use devices with fixed addresses that can't be changed, you can get I2C multiplexers that connect up to 8 separate I2C buses. You use an I2C command to switch which line the multiplexer is talking to.

Looking at the pinout card for the Teensy 3.6, there are 4 I2C buses:
  • SDA0/SCL0 -- Pins 19/18;
  • SDA1/SCL1 -- Pins 38/37;
  • SDA2/SCL2 -- Pins 4/3; (and)
  • SDA3/SCL3 -- Solder pads 56 and 57 underneath the Teensy.

In addition, the Teensy supports alternate pins for several of the I2C buses. You could presumably re-init the I2C bus and use the functions to change to the alternate pins between device queries. How well this works in practice, I don't know. I suspect an I2C multiplexer would be simpler to use:
  • SDA0/SCL0 -- Alternate pins 16/17, 8/7, 34/33, and solder pads 48/47;
  • SCL2 -- Alternate pin 26.
 
Wire, Wire1, and Wire2 are available for the various channels but there is NO Wire3 for the Teensy 3.6 which HAS 4 I2C channels.

I know all about I2C but there would seem to be NO support for the 4 Teensy 3.6 channels, only 3.
 
The i2c_t3 library provides access to Wire3. See the example scanner in examples/i2c_t3/advanced_scanner which scans all four I2C busses.

Pete
 
Thanks Pete, yes I see that that works but I was importing the Wire library and trying to use it with Wire3 as below which produced the following error "error: 'Wire3' was not declared in this scope".

I thought that Wire was the default library to use for I2C. It is certainly the library referenced on the PJRC web site.
Code:
Wire3.begin();
 
Status
Not open for further replies.
Back
Top