Wire3 on teensy 3.6?

Status
Not open for further replies.

Frassil

Member
Hi!

Im currently working on a project where it would be very beneficial to use all 4 I2C on the teensy 3.6.

However,

Wire.begin() //Works fine
Wire1.begin() //Works fine
Wire2.begin() //Works fine
Wire3.begin() //'Wire3 was not declared in this scope

Tested on both Platformio and Arduino ide with latest Teensyduino installed. Wire3 even gets highlighted in Arduino Ide, but it doesnt work.

Any thoughts?
 
Go into the Wire library into the file WireKenitis.h

You will see the section for T3.6
Code:
// Teensy 3.6
#elif defined(__MK66FX1M0__)
#define WIRE_IMPLEMENT_WIRE
#define WIRE_IMPLEMENT_WIRE1
#define WIRE_IMPLEMENT_WIRE2
//Wire3 is seldom used on Teensy 3.6
//#define WIRE_IMPLEMENT_WIRE3
#define WIRE_HAS_START_INTERRUPT
#define WIRE_HAS_STOP_INTERRUPT
Uncomment the define and you will have Wire3
 
It was commented out because each declared WIRE instance eats up a few system resources, if used afterwards or not. And WIRE3 is a fourth I2C bus. Seen that each bus can theoretically handle 120 devices, under condition of thoughtful addressing, this fourth wire instance would only be needed from the 361st peripheral...
 
Wonder why it was commented out?

As mentioned earlier, each one eats up some RAM even if not used.

Almost nobody uses Wire3, parly because Wire, Wire1 and Wire2 meet almost everyone's needed, but also because Wire3's pins are only on the bottom side pads.

In fact, as far as I can recall, this is the first time in 2 years anyone has even asked about how to use Wire3.
 
Hi Paul,

i want to use wire3, because the other wires use pins, witch are shared with functions i need.

But i will commen out wire1 and wire 2.

Thank You
Lothar
 
Wondering what would happen if we moved each of the wire objects with their own ISR to their own .cpp file. Then hopefully only those objects actually referenced would be created and use memory?
 
Hi,uncomment the "#define WIRE_IMPLEMENT_WIRE3" from the file "WireKenitis.h" but when i do compile i get an error message:

'Wire3' was not declared in this scope.
 
Works for me...

However make you are editing the version of the library being used...

That is when I edited it, I changed it in my <documents>/Arduino/libraries/wire directory as I have a private version (github current up to date version) installed. Editing it where Arduino/Teensy installed in my case would not have been picked up.
 
Status
Not open for further replies.
Back
Top