Teensy 4.1 with adafruit 3.5" display 8 bit mode.

TalkRock

New member
I am trying to code a display for a game I am making for a design class using a teensy 4.1. I figured an adafruit display would be a good display for a LCD beginner like me but most examples are made specifically for arduinos and the library's code the digital pins themselves which I cannot seem to find to code for the teensy. I am trying to use 8-bit mode for https://www.digikey.com/en/products/detail/adafruit-industries-llc/2050/5761252 display. I am trying to test out the 8-Bit arduino example on the datasheet but I got stuck. Any advice or help would be appreciated.
 
Okay, first things first, it looks like this is using the HX8357D controller (found here).

Looking at one of the examples for pin definitions and I see this: https://github.com/adafruit/TFTLCD-...xamples/graphicstest/graphicstest.ino#L11-L27. So we'll need to dig to see how those D* pins are setup.

Looking at `Adafruit_TFTLCD::begin()`, we see this block of code for the HX8357D: https://github.com/adafruit/TFTLCD-...35df537770e8eca/Adafruit_TFTLCD.cpp#L368-L392

The logic related to D* pins seems like it could be in `write8()`, which is defined here: https://github.com/adafruit/TFTLCD-...1d2435df537770e8eca/Adafruit_TFTLCD.cpp#L1102

Then it looks like `write8inline()` is actually a macro defined in pin_magic.h. The specific definition depends on defines that are set by the arduino ide based on the board you've selected. It appears that you're going to need to add teensy specifc macros to the library to get it to work. Adding the required code and connecting all the dots is quite an undertaking, especially if you're serious about getting to work on the actual game instead of the display driver. So perhaps look to see if anyone else has played with the HX8357D controller by searching the forum (some results!).

If you absolutely need to use the display you linked to, I'd dig through the other forum posts to see what people are doing and go from there. That said, the path of least resistance may be to get one of the displays that PJRC sells. I'm not trying to discourage you, but just wanted to make sure you know it's an option.
 
Last edited:
I have played some with the HX8357D in parallel mode. Some of this is discussed in the thread:

The experimental code is up at:

Which uses the code in the library:

Note: there are some other Displays we have played with using 8 bit or 16 bit parallel, like:
ILI9488, NT35510, RA8876.

The ones we have done the majority of playing with are the ILI9488 and the RA8876
 
I have played some with the HX8357D in parallel mode. Some of this is discussed in the thread:

The experimental code is up at:

Which uses the code in the library:

Note: there are some other Displays we have played with using 8 bit or 16 bit parallel, like:
ILI9488, NT35510, RA8876.

The ones we have done the majority of playing with are the ILI9488 and the RA8876
Hi Kurt I think these libraries will greatly hep me in achieving my goals of programing with the HX8357D so for that I am grateful. While trying to setup the HX8357D_test_rects I got confused on how to wire the display with the standard teensy 4.1 (https://www.pjrc.com/teensy/pinout.html) because the github readme references using pins 40-45 when it only contains the pins 40,41. It would be greatly appreciated if you could direct me on either changing the pins used or providing alternative wiring.
 
The 40-45 were for some custom boards, that were made by some forum members DogBone/Rezo...
I had it on one known as DogBone 4.5 I think...

Note: Most of these display libraries have a file named something like in the case I am looking at:
NT35510_t4x_p_default_flexio_pins.h

Code:
For T4.1 in that file we see:
#if defined(ARDUINO_TEENSY41)
// FlexIO pins: data: 19 18 14 15 40 41 17 16 WR:36 RD:37
//  FlexIO3
#define DISPLAY_WR 36
#define DISPLAY_RD 37


#define DISPLAY_D0 19
#define DISPLAY_D1 18
#define DISPLAY_D2 14
#define DISPLAY_D3 15
#define DISPLAY_D4 40
#define DISPLAY_D5 41
#define DISPLAY_D6 17
#define DISPLAY_D7 16


#define DISPLAY_D8 22
#define DISPLAY_D9 23
#define DISPLAY_D10 20
#define DISPLAY_D11 21
#define DISPLAY_D12 38
#define DISPLAY_D13 39
#define DISPLAY_D14 26
#define DISPLAY_D15 27

The flexIO data pins have to be consecutive flexio pins for T4.1 you can only find 8 in a row on FlexIO 3 which does
not have DMA...

If you are setting up for 8 bit parallel, you could use the ones I show, or for example you docule start at lets say pin 40 as D0,
in which case just go down the line for D1-D7, 41, 17, 16, 22, 23, ...

Hope that helps...
 
@TalkRock ontop of what Kurt mentioned, if you do want to use DMA with the libraries mentioned above, you can use the MicroMod Teensy, which is basically a Teensy 4.x
It does not have Ethernet or PSRAM, but it has almost everything else you can find on a T4.0/4.1
 
For reference, here is an ILI9488 (very similar to the HX display) driven via 8 bit 8080 with DMA on the MicroMod Teensy
 
I got confused on how to wire the display with the standard teensy 4.1 (https://www.pjrc.com/teensy/pinout.html) because the github readme references using pins 40-45 when it only contains the pins 40,41. It would be greatly appreciated if you could direct me on either changing the pins used or providing alternative wiring.
I thought I would also follow up, with showing my updated Excel document for pin information:

1728142828433.png

Which I keep a copy of the excel document up in my github project:

I mention this, as to show the FlexIO pin numbers (Yellow column). So for example pin 19 is on flexio 3 and it is channel/pin 0 on it...
And that is what is needed to be consecutive. Also the RD and WR pin also needs to be on the same FlexIO object, although they
can be any unused pins on that FlexIO object.
 
Back
Top