Adafruit HX8357D Display / Mega 2560

In my personal summary I said that I was new to Arduino to learn coding - very new so please be kind!! I have a Mega 2560 connected to a HX2560D TFT and attempted to test it with the supplied graphicstest program. All I got was a white screen. Several days of working on it and no success so bought another TFT. This showed expected test results for about 15 seconds then went back to white screen. Using SPI mode (bridge soldered) - clk connected to Mega 52, MISO to 50, Mosi to 51, CS to 10 and D/C to 9. All as per TFT instructions. Graphictest program compiles and downloads perfectly. Frustrating as all I've managed to program so far is a flashing LED. What am I doing wrong??

Re-install / upgrade your libraries. This will ensure you get a fresh start.

Check your soldering, connecting wires, ... I would choose 53 for CS. Or simply follow any scheme used by the library examples.

Run all the library example programs. Take notes on paper.

If you have a problem, you can report every step that you took (from your notes). And when your problem(s) occurred.

This may take you an hour from your life. But readers will be able to re-trace your steps on the same (or similar) hardware.

David.

David - Good Evening. Thank you for your interest and response. This forum is pretty awesome - so much information.

I have done everything you suggested - cleared out all software / libraries etc. and reloaded everything. All my connections and soldered joints checked okay and have tried all programs. Very frustrating - I used to maintain airborne radar sytsems (on the Vulcan bomber in particular!) so something the size of a pack of cards defeating me is really annoying. As I said, the first Adafruit display never worked, just a white screen - the second for about 15 - 30 seconds. I am loathe to think that both are defective and if I tried to return them (Mouser) would they not think it was my fault. Now I am in a quandry - to buy yet another display without being able to conclusively state that it is at fault is a bit off-putting. So far I've just managed to get a LED to blink, really mind breaking! ---- but where do I go from here? Once again - many thanks for your interest. Kevin

Run all the library example programs. Take notes on paper.

Seriously, it is the most effective way of getting help. (or resolving problems yourself) A methodical approach takes your time but gets results quickly from readers.

Likewise, photos of your wiring, soldering, ... mean that remote eyes can spot errors.

Unless you have generated smoke e.g. reverse 5V and GND pins, connect to 12V, ... I would expect both your displays to work.

David.

David - many thanks for your very prompt response. No smoke or fireworks so no issues on swopping the 5volts to earth. Have checked the connections several thousand times and also confirmed no bridged soldering or dry joints with an ohmmeter. Am very aware that you should follow rigid procedures on fault finding and record each action and adopt a planned logical approach. I am now at the end of my thinking on this issue. I have two boards with the same issue and I am very suspicious that there are numerous posts on the internet highlighting the same issue. Is the board failure prone? Many thanks for your help. Regards Kevin

@kevin-pearce, @david_prentice,

Hi,

if you don't mind, there are additional readers for such a topic. Readers that would like to learn also, e.g. about interesting TFTs, and solutions to use them.

But these readers would need additional information, e.g. a link to the TFT in question.

How do you know this TFT has a HX8357D controller?

How do you know which pins are for SPI, if the jumpers are changed for SPI use?

Regards

Jean-Marc

@Jean-Marc,

I am 99% confident that he has an Adafruit HX8357D board. That is the only one with solder-bridges for selecting IM# pins e.g. SPI or Parallel.

I still think that photos of wiring would be helpful.

David.

Hi David,

thank you for your answer. I overlooked Adafruit in the topic title, sorry.

I try to teach Newbies to provide links, it makes following so much easier for readers!

3.5" TFT 320x480 + Touchscreen Breakout Board w/MicroSD Socket - HXD8357D

Now I will take a look at the details.

Jean-Marc

This display has a controller built into it with RAM buffering

One of the first controllers with embedded graphics RAM?! :)

David – Good Afternoon
Jean-Marc – Bon jour
Thank you for your interest. I have now attempted to provide you with all the info that I have – including photos. The wiring shown in them is not very clear but I have listed under here all the Adafruit instructions I followed (many times) and guarantee that the wires connect what they should! The screen is folded back so that you can see the wires.

SPI Mode Jumpers
Before you start, we’ll need to tell the display to put us in SPI mode so it will know which pins to listen to. To do that, we have to connect the IM2 pin to 3.3V. The easiest way to do that is to solder closed the IM2 jumper on the back of the PCB. Turn over the PCB and find the solder jumper: DONE
Wiring up the display in SPI mode is much easier than 8-bit mode since Wiring
there’s way fewer wires. Start by connecting the power pins
• 3-5V Vin connects to the Arduino 5V pin
• GND connects to Arduino ground
• CLK connects to SPI clock. On Arduino Uno/Duemilanove/328-based, thats Digital 13. On Mega’s, its Digital 52 and on Leonardo/Due its ICSP-3 (See SPI Connections for more details)
• MISO connects to SPI MISO. On Arduino Uno/Duemilanove/328-based, thats Digital 12. On Mega’s, its Digital 50 and on Leonardo/Due its ICSP-1 (See SPI Connections for more details)
• MOSI connects to SPI MOSI. On Arduino Uno/Duemilanove/328-based, thats Digital 11. On Mega’s, its Digital 51 and on Leonardo/Due its ICSP-4 (See SPI Connections for more details)
• CS connects to our SPI Chip Select pin. We’ll be using Digital 10 but you can later change this to any pin…… SEE MY NOTE
• D/C connects to our SPI data/command select pin. We’ll be using Digital 9 but you can later change this pin too.That’s it! You do not need to connect the RST or other pins for now.
NOTE: Elsewhere is says that for the mega we should use Pin 53 but in graphicstest software it defines pin 10. To be safe I have tried both pin 10 and Pin 53 and modifying the define entry. Neither worked. Note also that the instructions refer to “SS” but we do not have a “SS” so I assume that this is “CS”. Further note – also connected are four touchscreen leads; I have tried it both with and without these connected. All above DONE! – thousands of times! Install Arduino Libraries. We have example code ready to go for use with these TFTs. It’s written for Arduino, which should be portable to any microcontroller by adapting the C++ source.
Three libraries need to be installed using the Arduino Library Manager…this is the preferred and modern way. From the Arduino “Sketch” menu, select “Include Library” then “Manage Libraries…”

Type “gfx” in the search field to quickly find the first library — Adafruit_GFX:

Repeat the search and install steps, looking for the Adafruit_ZeroDMA and Adafruit_HX8357 libraries.
After restarting the Arduino software, you should see a new example folder called Adafruit_HX8357 and inside, an example called graphicstest.

Upload the graphicstest sketch to your Arduino. You may need to press the Reset button to reset the Arduino and TFT. You should see a collection of graphical tests draw out on the TFT.
If you’re having difficulties, check the serial console.The first thing the sketch does is read the driver configuration from the TFT, you should see the same numbers as below

If you did not connect up the MISO line to the TFT, you wont see the read configuation bytes so please make sure you connect up the MISO line for easy debugging! Once its all working, you can remove the MISO line

All Above Done – Sketch graphicstest for HX8357 compiles and upload perfectly.

Isn’t all this exciting and mind bending! At least I can get a LED to flash!
Regards
Kevin

David and Jean-Marc.

Herewith a second photo and what the serial Monitor says …
Regards
Kevin

HX8357D Test!
Display Power Mode: 0x0
MADCTL Mode: 0x0
Pixel Format: 0x0
Image Format: 0x0
Self Diagnostic: 0x0
Benchmark Time (microseconds)
Text 1122548
Lines 2921080
Rectangles (outline) 143460
Circles (outline) 1240424
Triangles (outline) 573116
Triangles (filled) 2952792
Rounded rects (outline) 327820
Rounded rects (filled) 4941748
Done!

Good Morning Kevin,

I am a bit reluctant to ask this, but as we do not see the other side of your solder joints -

are you sure your GND connection on the PCB has good contact?

I would expect to see clean solder flow on this side too.

Regards

Jean-Marc

I would like to see the IM2 solder-bridge that selects SPI interface. I would like to see the solder joints to the trailing wires. I would be happier with proper header pins mating with the Arduino header sockets.

It is wise to pull the connecting wires straight. So we can check the routes. Or use coloured wires. Or mark some wires with a marker pen e.g. add some stripes at each end of a wire.

Remove the Touch wires. The example sketch does not use Touch. Even though this is an Adafruit board I would add a RST signal wire and use the full-fat constructor.

Being meticulous takes a few extra minutes but it should make things clearer to your readers. WE have all made wiring errors.

The Serial Monitor shows that the SPI interface is not working. e.g. registers do not give proper values. The "Tests" timing is irrelevant. It will report exactly the same whether a display connected or not.

David.

Jean-Marc Bon jour
David Good Afternoon.
This forum and your interest is awe inspiring - thank you.

To answer your questions.
Yes, Jean Marc. I also noted the GND connection but checked with ohmmeter as okay. To be safe I also resoldered - see picture. Also for you and David see connections picture to satisfy doubt as to connections reliability.
Picture also of IM2 bridge but to make sure have also connected IM2 to 3.3volts.
Yes - ref header pins. I do not like using them as it adds yet another soldered joint to doubt and I have checked many times with an ohmmeter that the connection is good. I have used my present method thousands of times (I’m 77, have been in electronics all my life and designed and built countless items but never Arduino until now - should I give up???) I apologise for the inability to trace the single colour wire through but I guarantee they are correct. Checked countless times and also ensured connections with ohmmeter.

Two very important points raised by David and as yet untested! How do I connect RST - to what and what is a full fat constructor.
Secondly - how does the Serial Monitor tell you that SPI is not working? I think that this is the crux of the matter. Having bridged the IM2 and also connected IM2 to 3.3v why is SPI not working???

I am a hardware man thru and thru so always doubt the hardware and have asked Mouser for a replacement.

As background - this project is to build an ECG machine with software by a Charles Hartley - this doesn’t work either.

Jean-Marc Bon jour
David Good Afternoon.
This forum and your interest is awe inspiring - thank you.

To answer your questions.
Yes, Jean Marc. I also noted the GND connection but checked with ohmmeter as okay. To be safe I also resoldered - see picture. Also for you and David see connections picture to satisfy doubt as to connections reliability.
Picture also of IM2 bridge but to make sure have also connected IM2 to 3.3volts.
Yes - ref header pins. I do not like using them as it adds yet another soldered joint to doubt and I have checked many times with an ohmmeter that the connection is good. I have used my present method thousands of times (I’m 77, have been in electronics all my life and designed and built countless items but never Arduino until now - should I give up???) I apologise for the inability to trace the single colour wire through but I guarantee they are correct. Checked countless times and also ensured connections with ohmmeter.

Two very important points raised by David and as yet untested! How do I connect RST - to what and what is a full fat constructor.
Secondly - how does the Serial Monitor tell you that SPI is not working? I think that this is the crux of the matter. Having bridged the IM2 and also connected IM2 to 3.3v why is SPI not working???

I am a hardware man thru and thru so always doubt the hardware and have asked Mouser for a replacement.

As background - this project is to build an ECG machine with software by a Charles Hartley - this doesn’t work either.

From C:\Users\David Prentice\Documents\Arduino\libraries\Adafruit_HX8357_Library\examples\graphicstest\graphicstest.ino

// These are 'flexible' lines that can be changed
#define TFT_CS 10
#define TFT_DC 9
#define TFT_RST 8 // RST can be set to -1 if you tie it to Arduino's reset

// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
Adafruit_HX8357 tft = Adafruit_HX8357(TFT_CS, TFT_DC, TFT_RST);

// SoftSPI - note that on some processors this might be *faster* than hardware SPI!
//Adafruit_HX8357 tft = Adafruit_HX8357(TFT_CS, TFT_DC, MOSI, SCK, TFT_RST, MISO);

My apologies. The example does specify TFT_RST pin. And the constructor uses it too. i.e. full-fat Some Adafruit library examples use a cut-price constructor e.g.

// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);

This ensures that the example works with Adafruit board but fails with Red SPI ILI9341 boards from Ebay.

So that clears up my "constructor" query.

I am sure that you have checked wiring many times. Posting a clear photo means that "other eyes" can see.

I can assure you that I have stared at my own wiring for hours and days. But it takes a "fresh pair of eyes" to notice my mistakes. Most members can recount similar experience.

Secondly - how does the Serial Monitor tell you that SPI is not working? I think that this is the crux of the matter. Having bridged the IM2 and also connected IM2 to 3.3v why is SPI not working????

Pixel Format should be 0x55. Hence your SPI is not working. None of the "Graphics tests" attempt to check the controller. They just send commands and report how much time it took to "send" them. Your eyes have to view the display for "correctness"

I would follow Adafruit's advice on setting SPI mode. Either a solder-bridge or connect IM2 terminal. I would not do both (without checking the schematic)

David.

David - thanks for your response. My apologies for the double post - was trying to attach photos and now very frustrating as I cannot even post them - even although they are under 2Mg.

So - we have eliminated the RST issue and just have the Serial Monitor saying that the SPI is not working - even although I have tried both methods - short out the bridge or connect IM2 to 3.3v.

I understand your viewpoint that more eyes are better than one set...... so I have dragged my long suffering wife into my workshop and she has wired it up herself with me watching - and she ain't stupid and used to wire up real human beings in Intensive Care!!

The most positive outcome is that SPI isn't working --- but why?

I think I will revert this back to Mouser for their comments. Meanwhile I'll stick to terrain following radars! Thank for your help Kevin

David - Good Evening Jean-Marc - Bon jour.

Situation resolved. Mouser.com sent another TFT screen - hooked it up and it worked perfectly. Hope to attach picture but had trouble before. so it may not get attached. All along I had my suspicions that it was a hardware issue as I had checked everything else a million times. Interesting point. the first, defective, TFT screen they sent came in two pieces with the ribbon cable disconnected and folded under loosely almost as if it had been used before. The new one came as a complete item with the screen fixed firmly to the PCB and the cable firmly inserted into its socket. I have to say though that Mouser were very helpful. Many thanks for your help - a super forum Kevin

My apologies - herewith the picture
Kevin