Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: Teensy 4.1 with HX8357 display issue

  1. #1
    Member KD0RC's Avatar
    Join Date
    May 2019
    Location
    Colorado, USA
    Posts
    81

    Teensy 4.1 with HX8357 display issue

    Hi Kurt E, I have a Teensy 4.1/Adafruit HX8357 project that uses your excellent HX8357_t3n.h library. My project is nearly done and working well (I'm at the code clean-up and documentation phase...). A couple of days ago, the display would occasionally fail to start properly, then the problem got progressively worse until it almost never starts. I have to unplug and very quickly re-plug it in to get it to work. I noticed that re-loading the firmware to the Teensy always started the display properly and so suspected that power was not settled. I tried a 5 second delay at the start of setup(), but it had no effect.

    I then poked around in HX8357_t3n.cpp and found the reset code in the begin() routine. I copied it and pasted it into the beginning of my setup(), and it fixed the problem! Not sure if this is a one-off kind of problem or something that regularly happens, so I thought I would post these results. If this is a common problem, a tft.reset() function might be one solution or two resets back-to-back in the .cpp file might be another (or perhaps the time that the reset pin is pulled low?). I will experiment with the reset timing to see if that makes a difference, or if it just needs two resets.

    I am also not sure if this issue is a symptom of pulling too much power from the Teensy. I am powering the display, STMPE-610 touch controller, two 16 channel MUX boards and two rotary encoders from the 3.3 v rail on the Teensy. I am afraid to power the display from 5 v as I don't know if the SPI and reset signals would go to 5 v. I have other Adafruit boards that allow 3 or 5 v operation and they must be powered by 3 v with the Teensy as Vcc determines signal voltage. I would be interested if you have any insight on using the display with 5 v.

    Thanks for this great display library, I could not have done this project without it.

    Len

    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
    
    #include <SD.h>
    #include "NativeEthernet.h"
    #include <FlexRigTeensy.h>
    #include "Encoder.h"
    
    void setup() 
    {
    // Reset tft display.  This is the same code in HX8357_t3n.cpp and is executed in tft.begin().
    // Added here to take care of flakey tft start up when the USB is plugged in. Delay at the
    // beginning of setup did not help.
      pinMode(TFT_RST, OUTPUT);
      digitalWrite(TFT_RST, HIGH);
      delay(5);
      digitalWrite(TFT_RST, LOW);
      delay(20);
      digitalWrite(TFT_RST, HIGH);
      delay(150);
    
    //  tft.println("Waiting for serial port monitor...");
      Serial.begin(BAUD_RATE);
      while (!Serial)  // wait for Serial Monitor
      {
        if(millis() > 2000) // Don't wait too long...
        {
          break;
        }
      }
    
      tft.begin();
      tft.setRotation(3);
      tft.fillScreen(HX8357_NAVY);
      tft.setTextColor(HX8357_YELLOW);
    
      tft.setCursor(0, 100);
      tft.setFont(Arial_28_Bold); 
      tft.print("KD0RC ");
      tft.setFont(ComicSansMS_28); 
      tft.println("TeensyMaestro");
      tft.setFont(Arial_20_Bold);
      tft.println();
      tft.println("A Teensy based controller for");
      tft.println("Flex 6000 Signature series radios.");

  2. #2
    Member KD0RC's Avatar
    Join Date
    May 2019
    Location
    Colorado, USA
    Posts
    81
    Nevermind, I solved it. After adding the tft reset that I thought fixed the problem, it started happening again. I began to suspect the SPI clock speed, and changed my tft.begin(); to tft.begin(30000000);. Instant success!

    Len

  3. #3
    Junior Member
    Join Date
    Jul 2021
    Posts
    1
    Hi, can I get the pinout for the connection from the Teensy to the Display?

  4. #4
    Member KD0RC's Avatar
    Join Date
    May 2019
    Location
    Colorado, USA
    Posts
    81
    The pinouts can be found on the Adafruit website. They show you how to connect using SPI or the parallel interface.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •