View a file from an SD card with Teensy 4.1 and Gameduino and FT812:

Hello everyone, my name is Teo and I am writing to you from Italy.

I'm looking for an example that allows you to load a jpg file present on the 32Gb SD Card installed on the Teensy 4.1 slot, on a TFT FT812, without success.

I'm using a BridgeTek ME812A-WH50R (FT812) display and the GameDuino library.

This is my connections:
TEENSY 4.1 PIN -> MOSI 11 // MISO 12 // SCK 13 // CS 10 // PD 24

This is my code:

C++:
#include <GDTeensy4X.h>
void setup()
{
  GD.begin();
  GD.SaveContext();
  GD.BitmapHandle(15);  
  GD.cmd_loadimage(0, 0);
  GD.load("pic.jpg");
  GD.RestoreContext();
}
void loop()
{
  GD.Clear();
  GD.get_inputs();
  GD.SaveContext();
  GD.ColorA(100);
  GD.Begin(BITMAPS);
  GD.Vertex2ii(0, 0, 15);
  GD.End();
  GD.RestoreContext();
  GD.ClearColorRGB(0x103000);
  GD.Clear();
  GD.cmd_text(GD.w / 2, GD.h / 2, 31, OPT_CENTER, "Hello world");
  GD.swap();
}

When I issue any command to write text or draw a line or gauge, everything works normally. When I try to use the Teensy card's SD card, however, the screen remains black. By the way, I'm not even sure that the SD card can be solved simply with the commands inserted in the code. Does anyone have experience with this?

Can anyone help me?

Thanks!
 
Last edited:
It's been a while since I saw anyone use the GDTeensy4X library. It was a first experiment. For more than three years there have been improvements in the library. The most recent version is GDSTx.

Starting from a base, you point out that when drawing primitives it works without problems. Please, can you tell me how you have configured these lines in the file GDTeensy4X. h of the library?; to tell you the new parameters in the config.h file of the new GDSTx?

Code:
#include "SdFat.h"
#define Orientation     0  //0, 1 for FT80x, 0,1,2,3 for FT81x or BT81x
#define PROTO           0   //0 FT843 or FT80x alternatives, 1 MEGA, UNO y gameduino2/3

//*************** User editable line to select EVE TFT size
#define SizeFT813       51  //NHD: 7-7", , 35-3.5"  //  5-5", 43-4.3", Riverdi: 51-5", 71-7", MO: 52-5"BT815, MO: 53-5"FT813
//*************** User editable line to select EVE TFT size

#if(SizeFT813==51)
 #define SetSPISpeed  29000000  //Riverdi TFT 5"  29000000
#endif
#if(SizeFT813==35)
 #define SetSPISpeed  36000000  //NHD TFT 3.5"  29000000
#endif

PD: GDTeensy4X worked with SdFat V1. GDSTx works in conjunction with SDFat V2, there were several adjustments to make since then. Please share your jpg image to see if it works in the setup I have installed and rule out any other errors.
 
Last edited:
HI! Thanks a lot for the answer. I didn't know about the new library. For convenience I attach the entire file signed "GDT4Xv134.h".

Thanks so much again!
 

Attachments

  • GDT4Xv134.h
    32.8 KB · Views: 43
You are welcome. I see that you are using another of the variants, GDT4Xv134. I think there were two other experimental ones before GDSTx. Have you modified the time table of the TFT variants that the library has to adjust it to your FT812 screen?. I mean, have you modified any function in the GDT4Xv134.ccp file?
 
I was putting together the PCB to connect to a Teensy 4.1, a 5" NHD FT813 screen, specifically this TFT: NHD-5.0-800480FT-CSXP-CTP, just arrived yesterday afternoon from Elgin, IL.

FT813_00.jpg


After connecting a few things on the PCB...

FT813_03.jpg
FT813_04.jpg


FT813_05.jpg


Example: SdInfo

Remember, you must have the SdFat V2 library installed. Apparently there was some correction in these months, I have 2.2.2 and now there is 2.2.3

config.h setup:

Code:
#ifdef TEENSYDUINO

    #define SizeEVE              5//5//54//43   // NHD: 7-7",  5-5", 43-4.3", 35-3.5", Riverdi: 51-5", 71-7", MO: 38-3.8"FT813, MO: 52-5"BT815, MO: 53-5"FT813, Riverdi: 54-5"  BT817, 0 Riverdi FT801/FT800 4.3", Riverdi: 100-10" BT817
                                     // 431-EVE3x-43 MO   Riverdi: 74-7"  BT817
 
    #define ORIENTACION          0//0//0//1   // 0, 1, 2, 3, FT81X/BT81X   0 normal
    #define ROTACION             0   // 0,1         FT80x

    #define CS                     10   // general
    #define SetSPISpeed   36000000   // general
    #define NHDTouch              1   // 1 cargar rutinas panel táctil    0 NHD normal aparentemente no lo requiere?¿
    #define GameduinoX           0   // 1 gameduinox shield instalado  0 otros como NHD43 o FT843
     
#endif
 
Last edited:
Thanks so much, TFT LCD Cyg!
In the afternoon I plan to do new tests with the libraries you mentioned and then I'll let you know how it went!

For now, thanks again!
 
Good evening friends!
You confirm that the CS pin of the SD card socket onboard on the Teensy 4.1 is the number 46?
 

Attachments

  • SD.png
    SD.png
    127 KB · Views: 34
You confirm that the CS pin of the SD card socket onboard on the Teensy 4.1 is the number 46?

Pin 46 is DAT3. It is not CS.

All SD cards have 2 protocols, either a higher performance native mode where 5 pins are used for data (CMD, DAT0, DAT1, DAT2, DAT3), or a lower performance SPI mode where 2 pins are used for data (MOSI, MISO).

Teensy 4.1's SD socket always accesses your SD card with the native protocol. So pin 46 is always used as DAT3. It is never used as CS, because the slower SPI protocol is never used when the SD card is in the built in socket. It would be technically correct to say the pin on the SD card is either DAT3 or CS. But the mating pin on the Teensy 4.1 SD socket is only DAT3.

You can use SPI protocol when the SD card connects to SPI pins, like with the audio shield.
 
The library already includes all the instructions to access the teensy 4.1 SDIO reader. It is not necessary to define anything externally.

Using GDSTx and the most recent SDFat library, the example to load an image from a microSD card installed in the teensy 4.1 is:

Code:
#include <GDSTx.h>

void setup()
{
 GD.begin();
  GD.cmd_loadimage(0, 0);
  GD.load("tree.jpg");
}

void loop()
{
 GD.Clear();
  GD.Begin(BITMAPS);
  GD.Vertex2f(0*16, 0*16);
 GD.swap();
}

Unlike the controllers of most commercial TFTs, the EVEx chips are true graphics processors, which enable the screen to have a refresh rate of 60 Hz. It is not necessary to calculate pixel changes or place masks to erase objects.
 
Last edited:
A thousand thanks, TFTLCDCyg! I tried the code and it works!

If I wanted to use an FT812 display with 800x480 resolution do I have to change something at the library level?
 
Great that it worked. Please share in the forum some pictures of your TFT working, for me it is feedback, since I can indirectly see how the library works in other variants of EVEx and it allows me to improve the library.

A while ago I tried to get a screen like the one you have, but unfortunately it was impossible, I included screen parameters that I don't have on hand to experiment with, but I assume that they work under the same principle.

Image loading from the teensy 4.1 SD reader, the memory is exFAT type, 64 Gb Kingston Canvas, the screen is a 5" NHD FT813


Later I will try to add support to the SD library that comes with the teensyduino, since it is now based on SdFat V2 and I would like to see how it works.
 
Damn, knowing right away that you needed the photo! Sorry!!
I got the display from a customer. As soon as I come back to visit him I'll do it!
 
In theory yes, you just have to consider that the advanced instructions for EVE 2/3/4 are not available, such as PlayVideo, or rotation only 0 and 1. The FT800/FT801 chips have a maximum pixel resolution of 480x272. In the config.h file, you must set:

Code:
    #define SizeEVE              0
    #define ORIENTACION          0   // 0, 1, 2, 3, FT81X/BT81X   0 normal
    #define ROTACION             0   // 0,1         FT80x         0 normal

    #define CS                   10   // general
    #define SetSPISpeed          36000000   // general
    #define NHDTouch             1   // 1 cargar rutinas panel táctil    0 NHD normal aparentemente no lo requiere?¿
    #define GameduinoX           0   // 1 gameduinox shield instalado  0 otros como NHD43 o FT843
 
Back
Top