What type of cable to use

A6_quattro

Active member
Hi

Maby a dumb question but I'm just an newbie on this, but could anyone recommend me a specific cable to use for my Teensy to connect via SPI an so on?

I've tried to search for a web shop in Europe to order from but without success, mainly do to my lack of knowledge...

/Hans
 
Sorry, not sure what you are asking?

SPI to connect to what? At least for experimenting, I will often start off with my Teensy plugged into a breadboard, and then use some form of breadboard wires to connect it to whatever devices I am experimenting with.

My last set of different breadboard connections was with some of these: https://smile.amazon.com/gp/product/B089FZ79CS/

Not sure how good they are yet, but at least I try to get some fresh ones from time to time.

But for SPI on my Teensy boards connect to pins 11-13 plus at least one other pin for chip select and of course a ground and most devices will want some form of power.
 
SPI is for short distances only, same PCB or a nearby module. Thus there's no connector standard for it.
 
If you are trying to use an SPI display over a wire, i'm doing the same. I'm using Cat5 ethernet cable and have been able to use cable distance of 20 feet--however my standard setup is around 4 feet in an electrically noisy electric race car. The remote display PCB has a few push buttons for menus and such. i've implemented a Teensy 3.2, an ILI9341 2.4 inch display, custom printed PCB board RJ45 connectors

A few tricks I'm doing

1. gnd and MOSI are on one twisted pair -- an absolute must
2. SCK and Vcc are on another twisted pair -- pretty sure this is a must (I'm mainly trying to wrap key lines around some type of barrier)
3. inline 100 ohm resistors on the MOSI and SCK lines at the MCU side--I found not really needed but many claim it helps counteract wire capacitance
4. 4K7 pullups on SCK and MOSI located at the display side
5. periodically i'll call display.begin() to reset display if any screen anomalies appear
 
Hi

Yes, having some weird issues when running FT5206_touchScreen.ino from the Teensuino library.

Sometimes the screen work properly but if restarted it don't work. I think the connections are ok and now I suspect the poor cable I'm using between the Teensy and the display.

The display is the ER-TFTM070-5. Have measured all connection also with a multimeter.
 
Normally SPI isn't used over cables. It's really meant for connecting chips together on a circuit board over relatively short distance.
 
Note, if the touch system uses the same SPI bus as the display, you might need to add pull-up resistors on the two CS pins (display & touch):

Particularly if you are running a Teensy 4.0 or 4.1, you might also need to adjust the SPI bus speed, since the faster Teensys might run too fast for the display. I've had two displays on the same SPI bus (running the uncanny eyes program) that initially I needed to dial down the speed to prevent glitching when I moved from a Teensy 3.2 to a Teensy 3.6. Adding the pull-up resistors allowed me to increase the SPI clock speed, but there was a point where I couldn't run it any faster. I have several displays from different vendors, and the speeds were slightly different for each manufacturer. Once I did the testing, I just set the speed to match the slowest display I had on hand.
 
Thank you all for your valuable input!


@Paul
I really want to use my Teensy in my little project with a display, so do you have any other suggestions?
I would gladly pay someone to do a circuit board that connects to my display and Teensy like buydisplay.com seems to have for Arduino. Looks like plug and play.
I'm more into the coding than build electrinics part together. :)

Again, many thanks for your fast respons.
 
I'm using Cat5 ethernet cable and have been able to use cable distance of 20 feet--however my standard setup is around 4 feet in an electrically noisy electric race car. The remote display PCB has a few push buttons for menus and such. i've implemented a Teensy 3.2, an ILI9341 2.4 inch display, custom printed PCB board RJ45 connectors

@ KrisKasprzak
About your solution with the RJ45 connectors, any chance you have it online to look at it? I think That is the sort of thing I need, Im also with a ILI9341 but with ribbon cable, and works sometimes... hope to fix it using all your recommendations... in fact, counting cables, following what you say, I get the 13 connections without IRQ pin to 9, what do you do with the +1 on the 8 lines on the ethernet cable? Im gonna do MOSI-GND, SCK-Vin, 3.3-CS, MISO-T-CS, but the DC?
 
Last edited:
@leacolumbi

yea see attached partial schematic.

The environment my display is in, is a telemetry system for an electric race--brushed DC motor, relays, buzzers, nasty EMI and noise. I've tried everything, but displays with 4 foot cords seemed to lock up the MCU. I came across a post where someone suggested to use cat5 and make sure data lines were twisted with ground. When we layed out the schematic, we messed up and twisted DC with MOSI, and GND with SCK. However the display works. However, due to the noise I do restart the display (.init()) on every draw (init() every second that is). that way any EMI that does creep through and draw glitches on the screen, get erased with the Display.init() on every screen redraw. I know some are laughing and cringing, but put a sensitive wire on a steel frame with a brushed DC motor pulling 60 amps, and suggest a better way :)

Hope this helps.


rj_pins.JPG
 
@leacolumbi

yea see attached partial schematic.

The environment my display is in, is a telemetry system for an electric race--brushed DC motor, relays, buzzers, nasty EMI and noise. I've tried everything, but displays with 4 foot cords seemed to lock up the MCU. I came across a post where someone suggested to use cat5 and make sure data lines were twisted with ground. When we layed out the schematic, we messed up and twisted DC with MOSI, and GND with SCK. However the display works. However, due to the noise I do restart the display (.init()) on every draw (init() every second that is). that way any EMI that does creep through and draw glitches on the screen, get erased with the Display.init() on every screen redraw. I know some are laughing and cringing, but put a sensitive wire on a steel frame with a brushed DC motor pulling 60 amps, and suggest a better way :)

Hope this helps.


View attachment 22678

Oh I see, your 9341 isnt with touch, so you dont need the 8 cables... 60amps, that is rough!!! I get a good feeling using your approach will work for me if it has worked on your extreme conditions... I dont know what to do with the 9th cable... have to do tests...
although, the 4.7k of SCK and MISO on the display side go to GND or 3.3 as the CS? do you think pulling up the CS on the Display side is a good approach?
and do you state on setup CS pin INPUT_PULLUP? or just physical? As all the 9341 libs deal internally with the pins, I dont know if it has any meaning to state the pins on setup, or how to make it matter if it is needed...

thank you for the schematic!!
 
Last edited:
9the cable? Do you mean the cable shielding? If CAT5 had 9 cables, i would have include touch capability. Now I do plan on exploring a touch display and only using T_CS and MISO lines (attempt to ignore T_INT) , but i've got to find a display with tri-state MISO. I have tried ground the shielding and all hell broke lose, I guess it acted like a giant antenna conducting noise to my boards. I tried 1M resistors and caps on shielding--no luck. so i leave shielding totally unconnected. Since I can't use touch, i use push buttons--consuming the other 2 lines.

Attached is my schematic for the display

1. pullup (connected to 3v3) on CS is a real resistor on the MCU side of the cable--no need for INPUT_PULLUP
2. pullups (connected to 3v3) on SCK and MOSI are on the display side
3. note how i'm handling RESET. To save a cable (that I don't have) sometimes RESET connected directly to 3v3 will white screen the display. This "low pass" filter slows the change to RESET and is very reliable in firing up the display.
4. Hard wired LED, but you can alwasy connect to pot for varying the brightness
5. also some caps to help filter incoming power (caps on pushbuttons are my version of hardware debouncing--I still have software debouncing as well)


display.JPG
 
9the cable? Do you mean the cable shielding? If CAT5 had 9 cables, i would have include touch capability. Now I do plan on exploring a touch display and only using T_CS and MISO lines (attempt to ignore T_INT) , but i've got to find a display with tri-state MISO. I have tried ground the shielding and all hell broke lose, I guess it acted like a giant antenna conducting noise to my boards. I tried 1M resistors and caps on shielding--no luck. so i leave shielding totally unconnected. Since I can't use touch, i use push buttons--consuming the other 2 lines.

Attached is my schematic for the display

1. pullup (connected to 3v3) on CS is a real resistor on the MCU side of the cable--no need for INPUT_PULLUP
2. pullups (connected to 3v3) on SCK and MOSI are on the display side
3. note how i'm handling RESET. To save a cable (that I don't have) sometimes RESET connected directly to 3v3 will white screen the display. This "low pass" filter slows the change to RESET and is very reliable in firing up the display.
4. Hard wired LED, but you can alwasy connect to pot for varying the brightness
5. also some caps to help filter incoming power (caps on pushbuttons are my version of hardware debouncing--I still have software debouncing as well)


View attachment 22700

Thank you again, Ive been using your schematics to put up my solution... and so, I got some questions, allright with 1 and 2, but on 3 your approach to RESET, I got a little confused with the 1K0, you mean 1000 ohms or 10 000ohms? and as I see, C1 and C4 are the only caps of 10uF the rest are 1uF, am I seeing correctly? I was just driving RESET through a 10K to 3.3v, guess with the GND connection your "low-pass" must be nice!
About 4, Your TFT does have a 100R ? mine doesnt, so I'm going as the Paul S page recommended https://www.pjrc.com/store/display_ili9341_touch.html , would be nice a pot, but not my priority now.

And about the "giant antenna" I've been reading this post on "termination" and SPI and as user3624 point out, seems the shielding should go to another path, not normal GND, halved. From my understanding maybe the same but after the MCUS with a diode? they point it should only connect on the exit point, allowing to collect waves on the upper part in any way... umm sorry, think I'm mixing with some other forum I found about manually shielding... but it gets me to other thing I researched about FTP ethernet cable, it has 9 cables and a metal jacket, ofcourse we dont have access to the 9th because it is with the metaljacket... thinking you could try that way...

Im doing a 5 twisted pair with double GND and all the 9 connections from the display, will report how it works!!
Thanks again:eek:
 
Regarding RESET the resistor is 1000 ohm, and the cap is a 10 uF--yea sounds huge, but the 2.2 TFT's used here were very finicky. You may have to adjust these values, hence, pushing 3v3 through a 10K may work as well. The other 10 uF is just for power supply stabilizing--not sure it really helps, but makes me feel better.

I just push 3v3 right to LED, maybe better to have a 100R resistor, i'll look at that.

Yea let me know what you do around grounding the shield.
 
CAT5 cable and RJ45

Kris,
Nice job on extending an interface that is designed to be chip to chip, to a product to product application, and a very electrically noisy one at that! So really I have a thank you for your imaginative solution, and couple of questions. Have you had any update to the design, any tweaks you find that improved robustness? I would think that RS485 drivers would improved signal to noise some, but I have not tested that theory.

Have you (or anyone you know about) added some of the circuitry to Pauls ILI9341 LCD board that your design calls for and makes the display plug and play? I'm going to steal (borrow) your design for a BMS based on my own DKblock using the display and T3.2, and I am about ready to build a carrier board for the LCD with the RJ45, and some R's and C's for decoupling, pull-up, etc. I'm using a MAX17263 fuel gauge chip that has it's own voltage and current signal conditioning, and then connecting that chip to the teensy through a digital isolator. That is alot cheaper than going all analog up the Teensy, and actually more accurate too.

Also used your github code to edit/write a state-of-charge meter and it's early days, but it gives a good indication of remaining charge. I'll add some text, for folks who are more digital, but I just love the look of an analog meter!
Tim
Offgrid Systems LLC
image_2021-09-06_120326.png
 
That display is very similar to the ones I use. Mine are 2.4" and 2.2" (mainly due to space requirements). I've not made any updates--the thing works and after a few years of fighting noise issues, I'll let sleeping dogs lie. I'm considering adding touch though. Since have have 2wires used for physical buttons, I may be able to to use them for the touch_CS and touch_MISO, leaving IRQ unconnected. Breadboard testing with a 2.8" indicates I can omit IRQ. Touch on a 2.4" may be asking too much.
 
KrisKasprzak and offgrid, it's been quite some time since I implemented my version of the solution of Kris, the only thing is I haven't been able to test it during long periods, but, let me tell you>

Quite nice!! Didn't use ethernet connections, only normal breadboard headers, and as I wanted the touch on the display I needed 9 connections, so Im sending a threaded line of 5 twisted pairs, made of ethernet pairs cable, only without the rubber protection because of the extra pair that wouldnt fit... I have two grounds repeated, to make sure every connection went with a pair...

if interested, I can take pictures, but overall, thank you very much KrisKasprzak!! for your knowledge and patience!!!
 
I don't have anything to offer regarding really long SPI runs like 20' but I do have tons of experience running SPI between circuit boards from a few inches to three to four feet. I've had solid results using unshielded runs with a clock speed of 5 Mhz to 10 Mhz for these relatively short distances. Consider differential drivers and receivers with lower clock speeds as required for much longer distances. My circuits for virtual pipe organs typically move 128 bits at a time depending on the FIFO size of the MCU and of course it's easy to run multiple SPI channels concurrently. Using multiple SPI modules or multiplexing it's easy to handle 1000 inputs and outputs every millisecond without errors.
 
Back
Top