teensy 3.6 using A18,A19 as I2C along with audio shield

Status
Not open for further replies.

lazybaby7

Member
I am using A18,A19 on teensy 3.6 as I2C to drive another module along with the teensy audio shield(I think A4,A5 are reserved for the audio shield). I am using i2c_t3.h since my assumption is that the wire.h library would only allow one I2C module being driven. However, after I add <i2c_t3.h> or replace <wire.h> with <i2c_t3.h>, I start to receive compiling errors like "Wire.cpp:507: multiple definition of `Wire'" and "Wire.cpp:376: multiple definition of `i2c0_isr'".

May I ask if there is a way to use other i2c pins(A18,A19) as the audio shield is used?

I also attached a mic-check script and the code used to drive the other I2C device(a SparkFun FM module si4703) in case they are useful. All I want is to use the line-in of the audio shield to take audio frequency analog output from the FM module.

Thanks~

View attachment miccheck.ino View attachment fm.ino
 
Last edited:
May I ask if there is a way to use other i2c pins(A18,A19) as the audio shield is used?

I believe the Audio shield uses pins 18 and 19 as a normal i2c bus. As long as you don't use i2c devices with address 0xA and 0x1A, it should be fine to add more devices to the i2c bus. The schematic for the Audio shield shows that both pins 18 and 19 have 2.2K pull-up resistors, so you won't need to add extra resistors.

As you've discovered, if you use the i2c_t3 library, you have to go through all libraries, and change them to use i2c_t3. This would mean you can access the other 3 i2c buses on the Teensy 3.6 easily.
 
Hello Paul Stoffregen, are you suggesting I should use A4,A5 or I should be able to use A18,A19 with <wire.h>? If the latter one is the answer, may I ask if there are similar things as Wire1.begin() in <Wire.h> since A18 and A19 does not work proporely after I use wire.setSDA(A19) and wire.setSCL(A18). Thanks.
 
Hello Michael Meissner. Thanks for you comments. You are right, looks like i2c_t3 is a superset of wire.h. Probably I should have gone through the audio library.
 
Hello Paul Stoffregen, are you suggesting I should use A4,A5 or I should be able to use A18,A19 with <wire.h>? If the latter one is the answer, may I ask if there are similar things as Wire1.begin() in <Wire.h> since A18 and A19 does not work proporely after I use wire.setSDA(A19) and wire.setSCL(A18). Thanks.

I don't believe A18/A19 will work with wire.h and as you mentioned wire.setSDA(A18) will not work as A18 is on SDA1.

Currently only I2CT3 supports wire1... At one point I was building a version of wire.h which includes all of the busses, but never completed it.

Again I wish we would set up a way to make these two libraries would work better with each other. I know that there were some proposed hacks to allow you to mix. I don't remember too many of the details, but what I thought about trying was to maybe:

Create my own version of the wire library, where I put it into my <arduino sketch>/libraries folder, which more or less does nothing (but maybe include i2c_t3.h. And then lets the I2C_t3 library work, with the options. This might work as long as there are no libraries that use some of the interface differences like: wire.setSDA or wire.setSCL...
 
I have the same problem.
Im using the Audio shield and i need to turn the board into a slave_i2c device for external coms.
For doing this i use the "i2c_t3" library and change the pins to I2C_PINS_37_38.

When i try to compile i get errors like:
Code:
conflicting declaration 'TwoWire Wire'

 extern TwoWire Wire;

previous declaration as 'i2c_t3 Wire'

 extern i2c_t3 Wire;


conflicting declaration 'TwoWire Wire1'

 extern TwoWire Wire1;


I dont know what to do, should i dive inside audio.h and try to change the i2c config from using wire.h to using i2c_t3?
 
you can't use both wire.h and i2c_t3.h in the same sketch. wire.h supports Wire1 (pins 37, 38), e.g. Wire1.begin()
 
Status
Not open for further replies.
Back
Top