Teensy 4.1, RA8875 Display. Teensy reboots after entering Loop()

Gremlin

Active member
EDIT: Ignore title of post. Solved the rebooting issue immediately after posting. It was a duplicate instance of tft that was being created in setup function.. edited it out of code below. Fine if an admin wants to delete this thread.

Here is the real problem:
I am working on changing a product over from T3.2 to T4.1.
I am having problems with garbage characters displaying on RA8875 display(buydisplay) due to what seems like noise on the SPI lines or some other weird noise problem.
Worked fine on T3.2.Shipped hundreds of units.
Using same board layout, I've changed to T4.1. I can post pics of layout if anyone thinks its relevant. I also have another design based on T3.5 that has worked very well also.
Display doesn't work very well when running T4.1 at 600Mhz. Displays mostly garbage.
Can really only get it to work well with 4.1 running at 150Mhz and taking the SPI speed down to 8MHz for display. At those speeds, it still periodically display garbage. I've tried down to 4Mhz on SPI with no improvement.
Shouldn't SPI to display work well at any Teensy Speed or does additional noise from the processor cause the problem.
The Teensy and its PCB are mounted very closely over the top of RA8875 chip. Could this be causing noise to enter RA8875 or would it mostly be an issue with SPI lines.

This is running on a PCB that has Teensy soldered in place and the display connected by its headers. No breadboards or wires, etc. Tried on about (3) t4.1's so far and multiple displays to rule that out.
Running TeensyDuino 1.56, Arduino 1.8.19

code:
Code:
// Test program for T4.1/RA8875 Debugging
#include <SPI.h>
#include <RA8875_w_Touch_T4.h>  //Same library as latest T4 version that ships with TeensyDuino. Just renamed.

#define RA8875_CS 10      //SPI Chip Select
#define RA8875_RESET 255  //255 Disables reset
#define RA8875_INT  16    //Touch Int
int count = 0;
RA8875 tft = RA8875(RA8875_CS, RA8875_RESET, 11, 13, 12);
long unsigned debug_start = 0;

void setup()
{
	debug_start = millis();
	Serial.begin(38400);
	delay(1000);
	Serial.println(millis() - debug_start);
	Serial.println("Setup Starting");
	pinMode(PIN_A9, INPUT);  // Added in attempt to fix T4.1 Analog Nonlinearity
	analogReadRes(12);       // T4.1: set ADC resolution to this many bits (probably not needed?)
	analogReadAveraging(32);
	delay(100);
	tft.begin(RA8875_800x480);
	delay(500);

	tft.fillWindow(RA8875_WHITE);
	tft.setFontScale(0);
	tft.setCursor(640, 450);
	tft.setTextColor(RA8875_BLACK, RA8875_WHITE);
	tft.print("Testing...");
	Serial.println("Setup Complete");
	Serial.println(millis() - debug_start);
	for (int i = 0; i < 4; i++) {
		tft.setCursor(400, 200); tft.print(count); delay(200);
		count += 1;
	}
	Serial.println(millis() - debug_start);
}

void loop() {
	tft.setCursor(400, 200);
	tft.print(count);
	delay(50);
	count += 1;
}
 
Last edited:
There is a FAULT occuring on entering loop() it seems. THere is an 8 second wait and then a restart.

Add this to setup:
Code:
    while (!Serial && millis() < 10000 );
    Serial.println("\n" __FILE__ " " __DATE__ " " __TIME__);
  if ( CrashReport )
    Serial.print(CrashReport);

That is a start - if TeensyDuino is updated to 1.57 there is a BreadCrumb feature added to CrashReport.

There is an example here that would allow recording values if it helps like count or other.

github.com/PaulStoffregen/MyFault/tree/main/examples/BreadCrumb
 
I've been taking a closer look at my PCB layout and I have noticed that since I was mostly reusing the layout from the T3.2, did not connect the additional GND pins that are on the T4.1 to my GND plane on PCB.
The only GND pin that was connected on the 4.1 was the one across from 5V on the end. The GND beside pin 13 and the one that used to be the AGND pin on the 3.2 were left unconnected. I added in a bodge wire to ground those and things have improved.
I still cannot run the display with 4.1 at 600Mhz but I can now run it at 450Mhz which did not work before. I am going to continue to run at 150Mhz and I have not had any problems with that yet. Hopefully, this has solved the problem.
 
I have made a little more progress on this. I was still having intermittent issues with SPI comms to the display while running T4.1 at 150Mhz.
I have now added 33ohm inline resistors to SCK, MOSI, and MISO. Luckily I had space to cut traces and add in 0603's.
I also initialized all unused pins to pinmode OUTPUT and digitalwrite to LOW as per Defragsters code in this thread. https://forum.pjrc.com/threads/69200-initializing-unused-GPIO-pins?p=297397&viewfull=1#post297397

I am now able to make the display work with the 4.1 running at 600Mhz. I'm going to still make an assumption that it will still run with less noise at 150Mhz. I will keep running it that that speed to see if my display ever shows garbage on screen.
 
Last edited:
Back
Top