short flash of wrong color during LCD startup (ST7789_t3 lib)

Status
Not open for further replies.

bschena

Active member
Not a big deal, but I'd like to understand what's going on.

I'm using the ST7789_t3 library to drive the 240x240 TFT LCD on my Copperhill Triple CAN board.

After downloading from the Arduino IDE, my LCD flashes a wrong color (RED) on one of my screen regions. It's supposed to be BLUE. It comes up correctly after a second, but the initial display boot color is wrong.

video snip: https://www.dropbox.com/s/1pl3xjtfwezsll1/IMG_2777.MOV?dl=0

you'll see the lower "border" flash red first, then blue. the color RED is not used in my sketch anywhere.

Further details: if i do a cold restart (power cycle) it comes up CORRECTLY on the first boot. However, if I punch the white button on the T4.1 (briefly) the board reboots and the red flash happens again. Same behavior during a re-DL from the IDE as described above.

I'm not (intentionally) using frame buffering, but I'm vaguely aware that this controller can do that - I'm wondering if this might be related to stale data hiding someplace.

Thanks all. Great forum, BTW.
 
Hard to say, without seeing the code and hookup.... My guess is the board is getting reset and still has content or the like and during the reset.

Does your display have a reset pin? Do you have it connected up to an IO pin... With some displays I have better luck when I have them always reset. Sometimes can use the Reset pin of the teensy as a way to also trigger the reset of the display.
 
Hard to say, without seeing the code and hookup.... My guess is the board is getting reset and still has content or the like and during the reset.

Does your display have a reset pin? Do you have it connected up to an IO pin... With some displays I have better luck when I have them always reset. Sometimes can use the Reset pin of the teensy as a way to also trigger the reset of the display.

Thanks Kurte.

setup code:
Code:
void tft_setup(void) {
  // set up general TFT parameters that won't change

  // general init
  tft.init(240, 240);
  tft.setRotation(3);
  tft.setTextWrap(false);

  // set up static TFT graphics

  // flood background/clear screen
  tft.fillScreen( BACKGROUND_LCD_COLOR );

  // write the node numbers and arrow in top half of screen
  tft.setCursor( NODESTARTPOS_X, NODESTARTPOS_y );
  tft.setFont( NODE_TEXTSIZE );
  tft.setTextColor( ST77XX_BLACK );
  tft.println( thisNode );

  tft.setCursor( NODESTARTPOS_X + 72, NODESTARTPOS_y + 20 );
  tft.setFont( ARROW_TEXTSIZE );
  tft.print("==>");

  tft.setCursor( NODESTARTPOS_X + 162, NODESTARTPOS_y );
  tft.setFont( NODE_TEXTSIZE );
  tft.println( partnerNode );

  // draw blue box across bottom half of screen
  tft.fillRoundRect( BLUEBOXSTART_X, BLUEBOXSTART_Y, BLUEBOX_WIDTH, BLUEBOX_HEIGHT, BLUEBOX_CORNER_RAD, ST77XX_BLUE );
  // draw white box inside of blue box to house the packetRate number
  tft.fillRoundRect( WHITEBOXSTART_X, WHITEBOXSTART_Y, WHITEBOX_WIDTH, WHITEBOX_HEIGHT, WHITEBOX_CORNER_RAD, ST77XX_WHITE );

  // place packetRate label along bottom edge
  tft.setFont( PACKETRATELABEL_TEXTSIZE );
  tft.setCursor( PACKETRATELABEL_START_X, PACKETRATELABEL_START_Y );
  tft.setTextColor(ST77XX_WHITE);
  tft.println( "Packet Rate [p/sec]");
  return;
}

The LCD is pre-installed on a commercial board from SKPang via Copperhill. Here are the default pin definitions:

Code:
// ==================================================
// == LCD-Related Parameters ================================
// ==================================================
#define TFT_RST                    32                                                   // display controller chip reset line (pin#)
#define TFT_DC                     9                                                    // tells the display if you're sending data (D) or commands (C)   --> WR pin on TFT (pin#)
#define TFT_MOSI                   11                                                   // Data out    (SPI standard) (pin#)
#define TFT_SCLK                   13                                                   // Clock out   (SPI standard) (pin#)
#define TFT_CS                     10                                                   // chip select (SPI standard) (pin#)
#define LCD_BL                     33                                                   // LCD back light control (pin#)

So, yes, I've got control of both a RST and BL line.

Good thought to try the RST line - I'll give that a try. Really curious where the jacked data is hiding...
 
Hmm.

I tried toggling the RST line with this,

Code:
// reset to avoid wrong color startup
  digitalWrite(TFT_RST, LOW);
  delay( 500 );
  digitalWrite(TFT_RST, HIGH);

  // general init
  tft.init(240, 240);

Same problem. I also tried HIGH/LOW (not sure how the RST pin works) as well - but same results (order didn't seem to matter).
 
Status
Not open for further replies.
Back
Top