HX8357 SPI frequency with Teensy 4.1 (re-post from Adafruit forum)

Status
Not open for further replies.

KD0RC

Well-known member
I am trying to understand the proper SPI frequency to use with an Adafruit HX8357 and a Teensy 4.1. I am using the Teensy libraries and currently have SPIClock set to 40 MHz. This works great on my project. I have a friend who is duplicating the project and is using the same components from the same source (direct from Adafruit and PJRC) and can only get 20 or 24 MHz to work. Mine will work up to 46 MHz, but will not work at 24 or 26 MHz but will work at 20 MHz and lower. Seems odd that there are ranges that don't work on one implementation, but do work on the other and some that work on both. The tft display is my only SPI device, so I don't think I have any bus contention issues.

We both have a rat's nest of wiring connecting the display and a bunch of encoders to the Teensy. SPI connecting wire length and proximity to other signals are the only variables that I can think of that differ between the two implementations.

Is there some relation to MCU speed (T4.1 at 600 MHz) that I should consider? Am I operating the HX8357 too close to some upper limit? Are there "magic" frequencies that work and others that don't? Is this related to SPI connection wire length? Do I need pull up (or down) resistors on the SPI lines?

Sorry for the long list of questions, but these are the things that I can think of that might be related to the problem.

Code:
#include <SPI.h>

#include "HX8357_t3n.h"
#include "ili9341_t3n_font_Arial.h"       // for the HX8357, not ili9341
#include "ili9341_t3n_font_ArialBold.h"   // for the HX8357, not ili9341
#include <ILI9341_t3n_font_ComicSansMS.h> // for the HX8357, not ili9341

  tft.begin(SPIClock);    // SPIClock = 40000000

Any insight would be much appreciated as I anticipate others building this thing. I want to be sure I have a solution that does not require a bunch of tweaking and frustration on the builder's part to make it work.

Thanks,
Len
 
We both have a rat's nest of wiring connecting the display and a bunch of encoders to the Teensy.
Any insight would be much appreciated as I anticipate others building this thing. I want to be sure I have a solution that does not require a bunch of tweaking and frustration on the builder's part to make it work.
Then you must get rid of the rat's nest and use a PCB. This is 95% the reason that it is unreliable. So, make a PCB with short connections (esp for the fast SPI signals) and proper grounding.
Or maybe use an 8-BIT Arduino which is some 100times slower and this way prevents such problems.
 
Status
Not open for further replies.
Back
Top