Teensy 4.1 Endless Loop Waiting For Serial Port Connect

Liam

Member
Hello All,

Im a new to Teensy And coding in general, hope I'm posting correctly...

Graphics and text working fine.

Im trying to use the Teensy 4.1 onboard sd card, and cant get past the serial.begin

Never displays "Serial Port Connected"

Could the display be the problem?

// *******************************************************************************

// *******************************************************************************

// Needed Display Libraries
#include "Adafruit_MCP9808.h"
#include "Adafruit_GFX.h"
#include "Adafruit_RA8875.h"

// Set Font Path & File Name
#include <C:\Users\Bill Pc\Documents\Arduino\libraries\Adafruit_GFX_Library\Fonts\FreeSansBold9pt7b.h>

// Define Available Colors
#define WHITE 0xFFFF

// Define Teensy Connection Pins
#define RA8875_INT 3
#define RA8875_CS 10
#define RA8875_RESET 9

Adafruit_RA8875 tft = Adafruit_RA8875(RA8875_CS, RA8875_RESET); // Reset The Display

void setup()
{
/* Initialize the display using RA8875_800x480 */
if (!tft.begin(RA8875_800x480)) {
while (1);
}

pinMode(RA8875_INT, INPUT);
digitalWrite(RA8875_INT, HIGH);

tft.displayOn(true);
tft.GPIOX(true); // Enable TFT - display enable tied to GPIOX
tft.PWM1config(true, RA8875_PWM_CLK_DIV1024); // PWM output for backlight
tft.PWM1out(255); // Set Backlight Intensity 255 = Brightest
Serial.begin(9600); // start serial communication at 9600bps
tft.graphicsMode(); // Set Display To Graphics Mode
tft.fillScreen(RA8875_BLACK); // Turn The Screen Black

tft.setFont(&FreeSansBold9pt7b);
tft.setTextColor(WHITE);



// Open SD Card serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect.
tft.setCursor(100, 140);
tft.print("Waiting For Serial Port Connect...");
}

tft.print("Serial Port Connected");

}

void loop()
{

// Nothing Here Yet


}
 
Do you open the Serial Monitor? That's what while(!Serial) is waiting for.
If you do, try putting a fillScreen and setCursor before the second print just to be sure that the second print isn't writing off the end of the line.
Code:
tft.fillScreen(RA8875_BLACK);
tft.setCursor(100, 140);
tft.print("Serial Port Connected");

Pete
 
Do you open the Serial Monitor? That's what while(!Serial) is waiting for.
If you do, try putting a fillScreen and setCursor before the second print just to be sure that the second print isn't writing off the end of the line.
Code:
tft.fillScreen(RA8875_BLACK);
tft.setCursor(100, 140);
tft.print("Serial Port Connected");

Pete

Thanks Very Much.
I mistakenly thought the serial port was used to write to the on-board card.
 
Back
Top