TFT Panel mix-up

Hello,

I am working with a sketch written for a 3.5 inch 480 x 320 TFT display based on the Adafruit_HX8357_AS.h and the Adafruit_GFX_AS.h drivers.

Unfortunately the panel I ordered (https://www.amazon.fr/gp/product/B07HT6ZH7L/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1) requires the IL19486 driver. This was because I read (incorrectly, perhaps) on the internet that these two were compatible.

The TFT panel itself is a shield which sits atop of a Mega / Uno, and has no breakout pins.

Is there any way to ‘persuade’ my panel to work with the HX8357 drivers, or is this panel totally incompatible?

Thank you in advance,
Nikki

Your link shows a shield with a pcb :

This should work fine with MCUFRIEND_kbv and Adafruit_GFX libraries.

I strongly discourage Adafruit_GFX_AS. It is not really supported by anyone. As far as I know it was never written by Adafruit.

Which library do you really want to use?
Bodmer has a TFT_HX8357 library for Mega. And his TFT_eSPI library for ESP32

If your Shield matches the pcb it should work fine. i.e. with AMS1117 and 74LVC245 chips

David.

Thank you for your speedy reply.

Yes, my shield matches that in your photo. This shield does work fine with MCUFRIEND and the AdaFruit_GFX.

However, I am trying to use an existing tried-and-tested sketch which requires the use of:

#include <Wire.h>
#include “RTClib.h”
#include <Adafruit_GFX_AS.h>
#include <Adafruit_HX8357_AS.h>

RTC_DS3231 rtc;
Adafruit_HX8357_AS tft = Adafruit_HX8357_AS();

I have tried to replace these drivers with the MCUFRIEND , but the display as it stands requires the use of instructions such as tft.drawString() and
tft.drawRightString() which is not available with MCUFRIEND. As the screen will be displaying dynamic values, it is not feasable to use tft.print() as it is not really possible to right-align my columns. The tft.drawRightString() is therefore important to me.

Nikki

You may have tried and trusted your sketch.
But unless you can provide a link to your "mystery" libraries it is not possible to help.

Adafruit repositories on GitHub know nothing about Adafruit_HX8357_AS or Adafruit_GFX_AS

If the only difficulty is tft.drawString() and tft.drawRightString() it is easy enough to implement with Adafruit_GFX if we knew the mystery syntax.

David.

Thank you again. Your assistance is so appreciated by me.

As a newbie, I’m not aware that these were mystery files. They were all supplied to me alongside the sketch. Anyway, I have added all the relevant files (more than you really need, I think) that were provided to me.

I hope thay help.

Incidentally, I have tried the drivers you suggested earlier, but am still struggling to get them to work for me. I have loaded both libraries, amended the user file as per the readme file, reloaded Arduino, and then tried the supplied examples, but still cannot get the screen to work with them.

Nikki

Adafruit_GFX_AS.cpp (32.3 KB)

Adafruit_GFX_AS.h (3.53 KB)

Adafruit_HX8357_AS.cpp (20.1 KB)

Adafruit_HX8357_AS.h (4.73 KB)

Font7s.c (21.1 KB)

Font7s.h (195 Bytes)

Font16.c (28 KB)

Font16.h (195 Bytes)

Font32.c (67.3 KB)

Font32.h (195 Bytes)

Font64.c (28.8 KB)

Font64.h (195 Bytes)

Font72.c (39.9 KB)

Font72.h (195 Bytes)

glcdfont.c_original (7.95 KB)

Load_fonts.h (542 Bytes)

Of course, the fact that I cannot get the provided examples with the TFT_HX8357 to work worries me somewhat. Maybe I am doing something very, very wrong with the setting up of these libraries.

Yes, I am fine with loading the libraries. The only user intervention appears to be configuring the User_Setup.h file. After that, surely the examples should run on my screen which is plugged directly onto the top of the Meg board?

I know the harware functions correctly, as I can run MCUFRIEND examples and run my own sketches via MCUFRIEND.

I have added my User_Setup.h file from the TFT_HX8357 folder just in case…
Nikki

User_Setup.h (6.57 KB)

Thanks for posting the files. It still does not say where they came from.

From Adafruit_GFX_AS.cpp

Update 13/2/15 by Bodmer:
Font 1 will print the Adafruit GLCD font
drawUnicode renamed drawChar
drawNumber array size increased
Faster font drawing

So it looks as if you are using something from Bodmer.

Please post your actual sketch. I can probably just use a "GLUE" class with MCUFRIEND_kbv
i.e. alter one include and constructor

Regarding library provenance.
It is much safer to use libraries supported by the IDE Library Manager.
They have a known repository e.g. on GitHub
They have specific version numbers.

Many libraries inherit and extend Adafruit_GFX i.e. graphics library from genuine Adafruit.
I don't know where the "Adafruit_GFX_AS" came from.

Bodmer's libraries have names like TFT_HX8357 and TFT_HX8357_due

David.

Thanks - I appreciate your warnings and advice re libraries. For my own projects, I always use what is available as there is little point in me trying to re-invent the wheel. I have just enough skill to write simple sketches, and am just getting completely lost with regard to this level of problem.

Having said that, I have put in many, many hours trying to resolve this particular issue.

As for the sketch in question - I have been presented with this as a package, including all the drivers. I will send you this as a pm, if you don't mind, as it is not mine to post publicly.

Any further thoughts as to why your suggested drivers don't work for me?

Nikki

Please try the attached ZIP.

Unzip in your project directory. You will have a sketch with .INO file and two local .H files

I do not have your hardware. So I can't see anything more than the "initial report" field names
Please tell me whether you see values reported from the hardware.

Although my .H files are quite complex the only changes to your .INO file are commented with .kbv

You can make the same edits to your RTC sketch .INO file and add the same .H files

David.

Edit. I have un-attached the ZIP. I can always re-post the two .H files if other readers are interested.

What can I say but a huge thank you, and you are a genius.

Everything is now working, and I am getting live data on the screen too.

I will take some time to try to understand what you wrote to configure the screen interface, but for now everything is working and I can get on with my own modifications.

Regards,
Nikki

I am pleased that this worked for you. The RTC sketch should work in the same way.

I have removed the ZIP from the earlier message.

You should find that all or most of Bodmer’s examples can be run on your Shield.

I like Bodmer’s print formatting methods.
I really dislike the thought of “Font by number”.

The GLUE class uses the regular GFX FreeFonts

David.

Hello David,

Again, thank you so much for your assistance in helping me get my TFT panel to work.

Could I ask you one more favour?

The TFT shield has a total of 28 pins connecting it to the Mega board. How can I identify what pins do what?
The power pins are self-explanatory. The touch-screen uses A2, A3, D8 and D9.

But of the remainder, which pins are used, and which are 'redundant'?
Is there any way I can determine for myself (eg from the set-up files) which pins are actually being used? Which pins drive the screen itself,which drive the SD card reader, for example?

I am trying to learn, but seem to have hit a wall with this one.

Regards,
Nikki

Looking at the image in #1

The shield has each pin printed with its function
e.g. LCD_RST which mates with A4 (Analog#4)
e.g. SD_SCK which mates with D13 (digital #13)

A5 is the only shield pin that is not used by the LCD or SD.
But you can access all the unmarried female sockets for other purposes.

Hint. Use double row angle header strip. Insert the longer pin line in a single socket row.

David.

Cheers,
Nikki