Teensy ++2 and 3.2 with audio as master slave

Status
Not open for further replies.

toreil

Member
Hi Community.

Trying to set up a configuration in witch the teensy ++ is master, and comunicates with the slave (teensy 3.2).
Found out that the ++ is using port 0 and 1 and the 3.2 is using 18 and 19 for sda scl.
Problem is that I also has a audio bord piggybacked to the 3.2. so this pins are used up on the 3.2

Any one know how to solve this?? guess the audio boad has its own adress and i that i can set another adress to the 3.2 or ???

Or is there another way to set up com between to teensy ??


Best wiches

Tore
 
The Audio library uses the standard i2c bus to do some communication to the boards on the Audio shield. Whether you can switch the i2c bus from being master to slave and back, I dunno.

The Teensy 3.2 does have a secondary i2c port on the underneath pads #29 and #30. You would have to solder wires to connect those two pads, provide pull-up resistors, and use the teensy specific t3_i2c library (https://forum.pjrc.com/threads/21680-New-I2C-library-for-Teensy3).

However, there might be conflicts if you link in both the standard Wire library and the t3_i2c library. You might have to fix the control_sgtl5000.cpp and control_wm8731.cpp files to use the t3_i2c library instead of Wire.

Alternatively, you could restructure the communication, so that the Teensy 2.0++ is the slave. Then you can attach the Teensy 2.0++ to the regular Teensy 3.2 i2c bus (after you do the appropriate level shifting). You would have to avoid the 0x0A and 0x1A addresses, as those are used in the Audio library.

Or you can not use i2c at all. If your communication is really simple, such as on/off, just dedicate pins in both for each communication state. Or use the Serial UART at an agreed upon baud rate, such as 9600. You would connect pin 0 of the Teensy 3.2 (RX1) to to pin 3 of the Teensy 2.0++ (TX1), and also connect pin 1 of the Teensy 3.2 (TX) to pin2 of the Teensy 2.0++ (RX).

A final option might be to eliminate the Teensy 2.0++ completely, and do everything on the Teensy 3.2.
 
HI
Thanks for good info, No not possible to use ++2 as slave, but com is realy simpel just have to send on byte at the time to
triger an event on the 3.2 so it plays a file from a sd card.

So i look into just using std serial com..


Thanks

tore
 
If the communication is both ways, you might need to do a level conversion between RX on the 2++ and TX1 on the 3.2, since the 3.2 runs at 3.3v and the 2++ runs at 5v, and the 2++ might/might not register a 3.3v signal for receiving signals. The 3.1 and 3.2 are 5v tolerant, so you technically don't need it between the TX on the 2++ and RX1 on the 3.2, but it is likely a good idea to do this (the so-called 3.1++ future processor is not 5v tolerant, and if you have the older 3.0 chips, neither are they).
 
Hi..
more Complicated than i hoped for...

But this issue 5v vs 3.3v does this apply to all of the digital ports, or is it spessific to tx/rx.

Its not many funksjons i need to send, so if i just use 4 std i/o ports i get 15 selections and thats enough.
set the ports ex 0110 on master and read them of on the slave ...
Not elegant, but an solution in this case..

tore
 
fwiw, as for the UART(s), this should work without level conversion. I have had no issues sending/receiving from an atmega328 (@5v) and teensy 3.1 (HWSERIAL Serial1) running some audio lib stuff
 
Teensy++ 2.0 can indeed work as a I2C slave. That's probably the simplest way.

In theory, I2C should be able to work as slave and master at different times on the same chip. In practice, very few (if any) people have really tried this. Odds are slim the Wire library is bug free for those uses. But Wire does work well as master only or slave only. Since you're already using Teensy 3.2 as the master, configuring Teensy++ 2.0 as a I2C slave makes the most sense.

The other alternative would be to use Serial1 instead of Wire.
 
Hi..
more Complicated than i hoped for...

But this issue 5v vs 3.3v does this apply to all of the digital ports, or is it spessific to tx/rx.

Its not many funksjons i need to send, so if i just use 4 std i/o ports i get 15 selections and thats enough.
set the ports ex 0110 on master and read them of on the slave ...
Not elegant, but an solution in this case..

tore

Unless you delve into the port layout of the Teensy 3.2, you might want to add another pin or two for clocking. If you do separate digitalWrite's, there is a chance that the remote board will do a read in between writing the 4 pin states. A clock pin that is set when all 4 pins are written could be used to signal that it is ok for the remote board to read the 4 pins. I could imagine using a second pin for the remote board to signal it is ready to read.

Alternatively, if you delve into both boards I/O architecture, you can find 4 pins that are controlled by the same I/O register, and using C bit operations you can reset the fields in one write operation, so that there is no chance for things to be in intermediate states.
 
Status
Not open for further replies.
Back
Top