help required for correct connection

Status
Not open for further replies.

urbanspaceman

Well-known member
Hi, i'm in trouble with my project.. i need help to find the right connections

i need to use at the same time:
- SPI Display (Gnd, Vcc, Clk, Din, Res, Dc)
This display, connected to teensy in this way, works: Clk = 13, Din = 11, Res = 8, Dc = 9
i use the u8g2 library, the call for the display is
Code:
U8G2_SSD1322_NHD_256X64_F_4W_HW_SPI u8g2(U8G2_R2, /* cs=*/ 11, /* dc=*/ 9, /* reset=*/ 8);
*the U8G2_SSD1322_NHD_256X64_F_4W_SW_SPI (software) it does not work for me, it's too slow
and HW works only on SPI pin (https://github.com/olikraus/u8g2/issues/479)

as you see, the display initialization use only 11/9 and 8 but if i doesn't use Clk the display doensn't works.​

- The Audio Board
The AB use the pin 9, 11, 13, 18, 19, 22, 23
the pin 11,13 are used by the display!!!​

On the audio board i also have the memory chip that use the pins 6, 7, 12, 14

i also need to use
- the teensy onboard sd card
- other i2c things
- MIDI in/out on 0 and 1 pins (or other pins)
- usb host
- 8 pin for 4 encoders
- 4 pin for encoder buttons

** extra buttons and leds on i2c bus with HT16K33 chip

can I get help on how to connect everything while avoiding conflicts?
thank you
 
Last edited:
Thanks defragster, I made this image to help myself during the breadboard stage...
but I don't understand well how to change Clk, Din and Dc that are already used by the audio board.
wiring.png
 
The I2S objects from the Audio Library need specific pins on the Teensy that are usually assigned to other functions (SPI, analog, etc). You can change the position of the conflicting SPI pins using SPI.setMOSI(7) and SPI.setSCK(14). For the Reset and DC pins you do not need to worry as they are normal digital pins, you can use any pin you want; just remember to call pinMode(pinNumber, OUTPUT) before using them. You can then change the constructor call by putting the updated pin number.

The Teensy 3.5/3.6 onboard SD card slot has dedicate pins that are not broken out for user connections, they can only be used with its SD slot, so no conflict there.

You can chain as much as 127 devices on one I2C bus as long as each device's I2C address is different; check the I2C devices' datasheets to see if there's any address conflict.

For MIDI IN/OUT, you need 2 DIN-5 connectors, one optoisolator (like a 6N138), a diode and 4 resistors; check this link for more info: https://www.pjrc.com/teensy/td_libs_MIDI.html

For USB host, the development is still in experimental phases as far as I'm concerned and it depends on what kind of device should the Teensy host.

On a personal note, I strongly suggest using displays that have Teensy-specific libraries, because they can be used much more efficiently than with non optimized libraries; the ILI9341 library is especially fast with the Teensy 3.5 and 3.6.
 
I'm trying to move the spi pins to alternate pin

default MOSI0 is pin 11, i want to move this pin to MOSI0 pin 28

in setup i have
Code:
void setup(){
  Serial.begin(9600);
  pinMode(28, OUTPUT);
  SPI.setMOSI(28);
  SPI.begin();

  }

but doesn't works

also this, doesn't works..

Code:
void setup(){
  Serial.begin(9600);
  pinMode(7, OUTPUT);
  SPI.setMOSI(7);
  SPI.begin();

  }
 
Yes
The code (at the end) is not complicated but (here is my error)
you have to initialize (move) the SPI pins before the initialization of the SPI device, in my case the OLED display.

In the setup function you need

Code:
setup(){
  Serial.begin(9600); 
  SPI.setMOSI(7); //set the MOSI pin to 7 (or 28 in teensy 3.5/3.6)
  SPI.begin();//initialize SPI
  U8g2.begin(); //initialize the display
  }
 
Status
Not open for further replies.
Back
Top