Anyone used 3.5inch AdaFruit LCD in SPI mode ? please help.

I am using ADAFRUIT 3.5inch COLOR TFT LCD with Arduino Due.
I already have 3.5in TFT working good on MEGA in 8bit mode and SPI mode fine working.
Now I trying to make same TFT on Arduino Due in SPI mode, all the wiring and setting up exactly as on tutorials and 100% re-checked for no mistakes.

  1. soldered all SPI and 3.3V , GND interface.
  2. shorted IM2 jumber on TFT pcb.
  3. tested same setup of LCD on MEGA and TFT LCD working. that means soldering and connections are perfect.
  4. No mistakes of power supply 5V i tried both 5V &3.3V as well.
  5. experimented LCD supply 3.3V and 5V both , LCD works on MEGA board.
    Trying to run sample code from example project (as on tutorial) software is successfully compiled and flashed without any error, but TFT LCD not displaying anything.
    Final words, the only difference between MEGA and DUE is voltage level, MEGA is 5V and DUE 3.3V.
    I choose 3.3V supply from DUE board to TFT LCD board power 3.3V-5V supply line. is it correct ??

Anyone used it in DUE ? Please help .

I do not have this board. If the SPI mode works in Mega2560, it should work on the Due.
Obviously you should use the same pins on the 3x2 SPI header and the same control pins on the Arduino headers.

Note that 50-53 are not SPI on a Due. Use the 3x2 SPI header.

Check the Adafruit schematic. There is probably a level-shifter chip for MOSI, SCK, ... to provide 3V logic to the HX8357. Make sure that MISO provides 3V back to the Due (if used).


Hello David,

I am using 3x2 Hardware SPI pins for LCD.
Due is 3.3V so no issues with level shifting.
LCD also have 3.3V compatibility.
I am not using MISO pin anyway.
Surprised that Mega board is working smooth and Due Just white screen.
Any thoughts?
Is anyone using Due with ADAfruit 3.5inch LCD?

Woo-hoo. The Adafruit schematic looks absolutely fine to me.

SDI, LCD_WR/SCLK, LCD_CS, SD_CS are always 3V output. And tolerant of 5V logic.
LCD_Dn pins are R/W with the logic level determined by RD signal.

The SDO signal does not go through any level-shifter. A Uno/Mega will be quite happy with reading the 3V logic.

I see no problems with running on Uno, Mega, Due, ...
Whether in 8080-8 parallel or in SPI mode.

I would love to use an HX8357-D in SPI mode. But I do not have one.
The HX8357-D can write 16-bit pixels in SPI mode. ILI9481 and ILI9488 can only use 24-bit pixels in SPI mode.

The HX8357-D is much faster than Ilitek and Raydium controllers. It should work well with DMA.

I do not know anyone who owns your display. I doubt if many owners have ever tried SPI mode.

My first step with any hardware is to test the controller interface. e.g. read the ID. write to a register and read it back.
Have you tested the SD card on the Due? Make sure that LCD_CS is pulled high.

Have you asked Adafruit? Look to see who has forked the software on GitHub. Ask these people.



Thanks for reply.
I doubt it’s something related to SPI speed issues with Due. Few guys reported Due SPI communication is too fast LCD to respond. Also suggested Software SPI works with this LCD.
Someone please suggest howto make software SPI for Arduino Due with library?
Have anyone tested ADAfruit 3.5inch LCD in 8 bit mode on Arduino Due????
Please reply

Looking at the GitHub code, they do not appear to use the Due.
There have been 20 forks. I only recognise Paul Stoffregen.

It should be very straightforward to add support for Due.
They already support Teensy, ESP8266, Feather, ...

Your board should work in 8080-8 mode with MCUFRIEND_kbv. Straight out of the box with mcufriend style wiring. Or as a SPECIAL with data bus on contiguous port.

I would try the SPI interface with ESP8266. It is officially supported.

Since I don't have your board, I can't help you with hardware.
Please verify your library version and show the wiring for the Mega and wiring for Due.


Hello David,
You are always awesome :slight_smile: Thanks for reply.
I understand MCUFRIEND_kbv library in 8bit mode work on my AdaFruit 3.5inch LCD, i am right ?
Could you please share latest version of MCUFRIEND_kbv library location (in Github) ?
Is there any modification required for wiring with this LCD ?
I am not an expert so which is easier for me ? Stoffregen or MCUFRIEND_kbv ? please advice.

Thank you very much for support.


Please reply to #5. Adafruit_HX8357 library version and clear description of SPI results on Mega.
Likewise which library did you use for the 8080-8 parallel results on Mega.

You know the Mcufriend shield wiring. If you use the same wiring on the Adafruit display it will work out of the box on MCUFRIEND_kbv. e.g. LCD_RD on A0, LCD_D1 on 9.

I would expect every Adafruit product to work with the associated Adafruit libraries.


Hi David,
Thank you for reply, here is my reply.

  1. version of library
    name=Adafruit HX8357 Library

  2. clear description of SPI results on Mega.
    I use example graphics test Sketch, Its works as per tutorial in Adafruit. Text and graphics is displayed 100% OK.

  3. library did you use for the 8080-8 parallel results on Mega.
    I use example graphics test Sketch, its works perfect, no issues 100% OK.

  4. MCUFRIEND_kbv for AdaFruit LCD.
    I checked in library examples, which example project will work on 3.5inch LCD ?
    I will try few today night and reply you tomorrow. I hope one will work sure.

  1. I have updated my copy to match your v1.0.7
  2. I presume you mean "graphicstest.ino" which has lines like:
  x = tft.readcommand8(HX8357_RDMADCTL);
  Serial.print("MADCTL Mode: 0x"); Serial.println(x, HEX);
  x = tft.readcommand8(HX8357_RDCOLMOD);
  Serial.print("Pixel Format: 0x"); Serial.println(x, HEX);
  x = tft.readcommand8(HX8357_RDDIM);

If you have MISO connected properly, you will see sensible values.

  1. I want to know which library e.g. genuine Adafruit_TFTLCD library . Unfortunately this is not recognised by the Library Manager.

  2. Your previous posts show that you have a RM68140 Mcufriend shield. You know how each LCD_xxx pin mates with the Uno/Due.

  3. Every MCUFRIEND_kbv example should run out of the box.

  4. It is worth testing your wiring with LCD_ID_readnew
    It should show sensible values for reg(0x04) etc.
    edit sketch to enable the unlock for 8357. You should see more register values.

  5. Now that I know your Adafruit_HX8357 SPI library version, I can study that code. And suggest test to run on your Uno / Mega.


Dear David,
Thanks for your suggessions.
Few comments from my side

your question "I want to know which library e.g. genuine Adafruit_TFTLCD library" I can not see any file contain version information. But I downloaded from same Github folder as you mentioned, its same library only which you marked.

  1. i dont have MISO connected, I will connect today and read the values as you mentioned in sketch "graphicstest.ino" .

  2. i have to use Adafruit_HX8357 SPI version only due to GPIO pins are not free for 8bit interface.
    NO problem for me to try 8bit mode, but again my problem remain same as I need SPI version.

I am sure you will be able to suggest some solution on Due SPI example to make this LCD respond.

I will be very much interested to work with you to test the suggestions you ask me to run on my LCD+DUE board.
Looking forward to your comments.

Dear David,
:slight_smile: thank you for your support, I have some good news and some bad news.

First I tried my 3.95inch mcufriend LCD on Due in 8bit mode and its working fine with kbv library.

Good news

  1. I got ADAFruit LCD working on ArduinoDUE with KBV library. Example sketch is running “graphictest_kbv”.
  2. i am using same 8bit pin number i used with mcufriend 3.95inch LCD.
  3. I got serial print read as ID = 0x99

bad news (sorry for remark)

  1. colors are not correctly displayed
    GREEN is shown as “pink”
    BLUE as “Yellow”
    RED as “turquish blue” (or kind of very light blue)

  2. graphic movement and all shapes look correct.

  3. only colors are little mismatch…

attached some images for your reference.
Please suggest your views.
Thank you,


Go on. You just run the graphictest_kbv sketch. When you get to the “INVERT DISPLAY” screen, you see the correct colours.

I only own 0x9090 displays. Which I have concluded is actually HX8357-C. The HX8357-C datasheet does not specify the ID value.
Your controller is HX8357-D according to the HX8357-D datasheet (which does specify ID value).

There are several solutions.

  1. remove the REV_SCREEN attribute in the case 0x0099: block in MCUFRIEND_kbv.cpp
  2. use the SETPANEL manufacturer command (0xCC)
  3. just call tft.invertDisplay(1); in every sketch.

(1) is the easiest thing to do if you are happy with editing library files
(3) is the safest if you only edit sketches.

I would be very interested in hearing how MISO works with your Mega running Adafruit_HX8357 graphicstest example.


Dear David,

Thanks for suggestion.
I will try adding invert function and reply you.
I am sorry I will setup in MEGA and check MISO and reply you the message what it read.

I have one question about fonts.
I hope you know about fonts library and font selection available with AdaFruite. Will you suggest similar fonts library will work with
Your kbv library?
Or any way to use same ADAfruit fonts library in my sketch? My question is if I configure and initialise LCD using kbv library will ADAfruit instructions and function work for text printing? I think no. What’s your reply on this ?

Most Arduino TFT and OLED libraries use Adafruit_GFX

So it is trivial to rebuild a sketch for a different TFT library. Generally it is little more than changing the include and constructor lines.

So you can use all the FreeFonts or the regular 7x5 font.
All the graphics drawing works the same e.g. circle, triangle, ...
All the Adafruit_GFX_Button methods will work.

Note that FreeFonts are transparent and are drawn relative to a base line.
So you are stuck with having to calculate a background area if you want to overwrite some old text and rub it out yourself.

Bodmer and MarekBuriak provide "more convenient" text rendering than the basic FreeFonts.
But it makes their examples less easy to port to basic GFX style libraries e.g. MCUFRIEND_kbv


Hello David,

Yesterday I tried adding ADAFruite allFonts.h in project with my LCD initialized with your mcufriend_kbv library and I am able to set and use any fonts from allFonts.h file.

But I need all the function i tested in 8bit mode in SPI :frowning:


The only allFonts.h that I can find is from Marek's ILI9341_due library. These are NOT FreeFonts but a different format.

Adafruit_GFX only supports FreeFonts and a fixed 7x5 font.

Yes, you can rewrite libraries for different font formats.
Personally, I prefer to just convert a font to the FreeFont style and hence compatibility with every GFX style library.

I look forward to hear how the Mega works with SPI.


:slight_smile: Dear David,

attached screenshot on MEGA with Adafruit LCD running graphic test.
screen shot Serial read monitor with MEGA.
Let me know if its OK for you, or any other test to be done.

I trust you that you can guide me to make same LCD to run on Due :slight_smile:


Life is so much simpler when you copy-paste text from the Serial terminal.

Yes, your Mega2560 is working just fine. You simply have to move the wires from the Mega to the Due.

  1. I installed Adafruit_HX8357 via Library Manager.
  2. I selected Mega2560 as board
  3. I built "graphicstest" from the Examples.
Using library SPI at version 1.0 in folder: C:\Program Files (x86)\Arduino-1.8.1\hardware\arduino\avr\libraries\SPI 
Using library Adafruit_GFX_Library at version 1.2.3 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Adafruit_GFX_Library 
Using library Adafruit_HX8357_Library at version 1.0.1 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Adafruit_HX8357_Library 
Sketch uses 17884 bytes (7%) of program storage space. Maximum is 253952 bytes.
Global variables use 580 bytes (7%) of dynamic memory, leaving 7612 bytes for local variables. Maximum is 8192 bytes.
  1. I selected Due Programming Port as board.
  2. I built "graphicstest" from the Examples
Using library SPI at version 1.0 in folder: C:\Users\David Prentice\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.11\libraries\SPI 
Using library Adafruit_GFX_Library at version 1.2.3 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Adafruit_GFX_Library 
Using library Adafruit_HX8357_Library at version 1.0.1 in folder: C:\Users\David Prentice\Documents\Arduino\libraries\Adafruit_HX8357_Library 
Sketch uses 38916 bytes (7%) of program storage space. Maximum is 524288 bytes.

I don't have your hardware. I could modify the library for an SPI ILI9341. The only 320x480 SPI controllers that I have are ILI9481 and ILI9488. Both write pixels as 24-bit. So require extensive modification.

Quite honestly.
Your Mega connects GND, SCK, MOSI, MISO from the 3x2 ICSP header. CS, DC, RST on 10, 9, 8
Your Due connects GND, SCK, MOSI, MISO from the 3x2 ICSP header. CS, DC, RST on 10, 9, 8

The Serial display should report the same values for Power Mode. MADCTL, PIXFMT, ...
It will have "shorter" times for the Adafruit Tests.

Please copy-paste the Serial Terminal to your message in a CODE window.

If your build libraries are different from mine, copy-paste your build libraries result.
(select compile=verbose in File->Preferences)


Dear David,
I did graphic test sketch on DUE with same LCD, no output & LCD is white screen.

Sorry to add attachment last reply, now I copy pasted Serial monitor data here.

HX8357D Test!
Display Power Mode: 0xFF
Pixel Format: 0xFF
Image Format: 0xFF
Self Diagnostic: 0xFF
Benchmark Time (microseconds)
Text 461999
Lines 1425789
Rectangles (outline) 120377
Circles (outline) 618537
Triangles (outline) 287079
Triangles (filled) 2076545
Rounded rects (outline) 190290
Rounded rects (filled) 4733250

and also, library details here below,

Multiple libraries were found for "Adafruit_GFX.h"
Used: C:\Program Files (x86)\Arduino\libraries\Adafruit_GFX_Library
Not used: C:\Program Files (x86)\Arduino\libraries\Adafruit-GFX-Library-master
Using library SPI at version 1.0 in folder: C:\Users\admin\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.11\libraries\SPI
Using library Adafruit_GFX_Library at version 1.2.3 in folder: C:\Program Files (x86)\Arduino\libraries\Adafruit_GFX_Library
Using library Adafruit_HX8357_Library-master at version 1.0.7 in folder: C:\Program Files (x86)\Arduino\libraries\Adafruit_HX8357_Library-master
Sketch uses 39228 bytes (7%) of program storage space. Maximum is 524288 bytes.
Forcing reset using 1200bps open/close on port COM4

I hope this information give you some idea about what is wrong .. ?