How to wire ILI9341 in SPI without D/C pin

I got a TFT display module from China. The TFT does not has D/C pin, how could I connect TFT to UNO or which library should I need to use??

Here is the TFT pins:

  • VCC
  • TFT_CS
  • SDI (SDA)
  • SDO
  • SCK (SCL)
  • RST
  • SD_CS
  • TFT_BL
  • GND

|500x500

According to shopping cart information, this TFT control IC is ILI9341, but I received detail PDF, this TFT should be ILI9340.

Question 1: How can I verify which IC is it using?

Question 2: This TFT does not has D/C pin, how to connect between TFT & UNO ??

Question 3: Which library does not using D/C pin ??

I had tested UTFT (Github) but just got a white screen without any information. UNO -- TFT 3.3v - VCC D2 - TFT_CS A4 - SDI (SDA) D3 - SDO A5 - SCK (SCL) NC - RST NC - SD_CS NC - TFT_BL GND - GND

usefull information

I am not aware of any intelligent library handling the 9-bit SPI mode that the data sheet calls 3-wire SPI.

UTFT however does have what it calls 4pin SPI which it bit-bashes without any concern for rules of a SPI bus. UTFT has no concept of a Reset pin.

Fortunately, you can wire the Reset pin to 3.3V via a 10k pullup. And use the ILI9341 Software Reset command.

I have never tried the UTFT 4p mode. I have not even looked to see if it understands Software Reset.

It will be very fiddly to use 9-bit SPI with the TFT and 8-bit with the SD card. The AVR hardware is not designed for this. Most ARM chips can.

You can tell if it is an ILI9340 or ILI9341 if you read register 0xD3. Most Chinese SPI displays do not enable EXTC. So you are not allowed to read 0xD3.

David.

elektrax:
usefull information

Thanks for your information, but the website was down. And here is the mirror site / alt site.

Are you still discussing the green pcb as shown in the Original Post from Feb 2016? The link from misc.ws refers to Parallel Displays.

My reply from Feb 2016 (#2) said:

You can tell if it is an ILI9340 or ILI9341 if you read register 0xD3. Most Chinese SPI displays do not enable EXTC. So you are not allowed to read 0xD3.

Yes, you can read the ID from an ILI9340 or ILI9341. In any of the interface modes. Your 9-bit SPI is not supported by AVR hardware. The bit-bashed UTFT will be very SLOW.

If you are using an ARM, ESP8266, ESP32 it would be interesting to use the 9-bit SPI hardware.

David.

There is a small chance that it would work with 2 8bit transfers on AVR. It might just ignore the extraneous bits.

I have one 9bit SPI TFT named TIANMA that works with 9bit transfers with ESP8266 (and another one named KeDei that I can't use, because I didn't find out the controller it uses, if it has any at all).

Adding 9bit SPI to my GxTFT library is still pending; if need is there I might reconsider priorities.

You can configure ESP8266 for different SPI formats. Trailing garbage bits is not a good idea.

If you describe your Kedei or post a photo of the pcb, it should be easy to get going.

David.

david_prentice:
You can configure ESP8266 for different SPI formats. Trailing garbage bits is not a good idea.

If you describe your Kedei or post a photo of the pcb, it should be easy to get going.

David.

I should have been more precise: the C/D bit value is in the first byte, most likely the last bit.
I may have a look at this quite soon.

The KeDei is not an issue for me, it is an opportunity kept for further investigation if ever I have nothing more interesting to experiment with or learn from.
I think I have posted about this in one of your topics; I will check.

It was a topic I started. I found it here: TFT with 9bit SPI (no C/D), can it be used with Arduino?

I put this down nearly 2 years, I resume this TFT display module development recently.

After 2 weeks google, I can make something could see using Arduino UNO, but, important, it is incredible slow.

Clear the screen and print some words take about 8 seconds, could I know how to speed up ???

PS: I could share the schematic and library later. Attach a video I shared to IG.

https://www.instagram.com/p/Ba8yOeehcr-/

I have driven an ILI9481 with 9-bit bidirectional SPI. At least you have dedicated SDI, SDO unidirectional pins.

What do you want to use your 3.3V display with? It should work well with Due, Teensy, STM32F4, ESP8266 hardware.

It will be painful with Mega, Xmega, STM32F103.

Do you have a GitHub account? Are you prepared to clone and test?

David.

I have some ATmega (8, 8L, 16, 328p, etc), STM8, STM32F103.

Moreover I have a ESP8266 - ESP12, but don't know how to use it. Just using it via AT command to access internet.

May I know what is the pain point with Mega, Xmega, STM32F103.

Flash size ??? Cause I may consider using dual MCU in single project, one for TFT display, one for calculation.

Yes, I have git account, send out a PM to after this reply.

The problem with Mega and Xmega is that the hardware SPI is only 8-bit. The problem with STM32F103 is that the hardware SPI is only 8-bit or 16-bit. I have a small STM8S board. I suspect it is only 8-bit SPI.

It looks as if you know how to level-shift the 5V signals from a Uno or Mega. So the AVR is usable but slow.

I will create a Branch on a GitHub project for you. I will tell you when it is ready. I can support 3.3V ATmega328P and ESP8266. The 328P but-bangs 1-bit and then uses hardware for 8-bits. It works reasonably fast. The ESP8266 should fly.

If you are not familiar with ESP8266, I suggest that you start with your level-shifted Uno. It is easier to stick with Arduino IDE.

David.

I have added 9bit SPI support for ESP8266 to my GxTFT library.

My 2.8 inch SPI TFT inked "shanyan", also known as TIANMA 2.8, works with this SPI support, with my controller class for ili9341.

@David

Although my display works with the controller class for ili9341, the read register values look strange. Reading graphics RAM seems to work, only the least significant bit seems stuck at zero.

Read Registers values for my TIANMA 2.8

GxCTRL_ILI9341 Test on GxIO_SPI_RS
tft.init() done
reg(0x0000) FF FF   ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 00 00 00 00 Manufacturer ID
reg(0x0009) 53 08 00 00 00  Status Register
reg(0x00BF) 00 00 00 00 00 00   ILI9481, HX8357-B
reg(0x00D3) 00 00 00 00 ILI9341, ILI9488
reg(0x00C8) 00 00 00 00 00 00 00 00 00 00 00 00 00  GAMMA
reg(0x00E0) 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 GAMMA-P
reg(0x00E1) 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 GAMMA-N
reg(0x000A) 00 00   Get Power Mode
reg(0x000C) FF FF   Get Pixel Format
reg(0x0061) FF FF   RDID1 HX8347-G
reg(0x0062) FF FF   RDID2 HX8347-G
reg(0x0063) FF FF   RDID3 HX8347-G
reg(0x0064) FF FF   RDID1 HX8347-A
reg(0x0065) FF FF   RDID2 HX8347-A
reg(0x0066) FF FF   RDID3 HX8347-A
reg(0x0067) FF FF   RDID Himax HX8347-A
reg(0x0070) FF FF   Panel Himax HX8347-A
reg(0x00A1) FF FF FF FF FF  RD_DDB SSD1963
reg(0x00B0) FF FF   RGB Interface Signal Control
reg(0x00B4) FF FF   Inversion Control
reg(0x00B6) FF FF FF FF FF  Display Control
reg(0x00B7) FF FF   Entry Mode Set
reg(0x00BF) FF FF FF FF FF FF   ILI9481, HX8357-B
reg(0x00C0) FF FF FF FF FF FF FF FF FF  Panel Control
reg(0x00C8) FF FF FF FF FF FF FF FF FF FF FF FF FF  GAMMA
reg(0x00CC) FF FF   Panel Control
reg(0x00D0) FF FF FF    Power Control
reg(0x00D2) FF FF FF FF FF  NVM Read
reg(0x00D3) FF FF FF FF ILI9341, ILI9488
reg(0x00DA) FF FF   RDID1
reg(0x00DB) 00 00   RDID2
reg(0x00DC) 00 00   RDID3
reg(0x00E0) 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 GAMMA-P
reg(0x00E1) 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 GAMMA-N
reg(0x00EF) 00 00 00 00 00 00   ILI9327
reg(0x00F2) 00 00 00 00 00 00 00 00 00 00 00 00 Adjust Control 2
reg(0x00F6) 00 00 00 00 Interface Control
 0x7E0 0x7E0 0xF800 0xF800
 0x7E0 0x7E0 0xF800 0xF800
 0x1E 0x1E 0xFFFE 0xFFFE
 0x1E 0x1E 0xFFFE 0xFFFE
Benchmark                Time (microseconds)
Screen fill              2046028
Text                     105402
Lines                    540919
Horiz/Vert Lines         174069
Rectangles (outline)     106355
Rectangles (filled)      4246118
Circles (filled)         614193
Circles (outline)        432612
Triangles (outline)      132204
Triangles (filled)       1444938
Rounded rects (outline)  208120
Rounded rects (filled)   4681272
Done!

Any idea what controller these values might come from?

Read Register values for my blue Geecreit 2.8

GxCTRL_ILI9341 Test on GxIO_UNO_P8_SHIELD
tft.init() done
reg(0x0000) 41 41   ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 00 00 00 00 Manufacturer ID
reg(0x0009) A4 53 04 00 00  Status Register
reg(0x00BF) 00 00 00 00 00 00   ILI9481, HX8357-B
reg(0x00D3) 00 93 41 41 ILI9341, ILI9488
reg(0x00C8) 41 41 41 41 41 41 41 41 41 41 41 41 41  GAMMA
reg(0x00E0) 0F 31 2B 0C 0E 08 4E F1 37 07 10 03 0E 09 00 00 GAMMA-P
reg(0x00E1) 00 0E 14 03 11 07 31 C1 48 08 0F 0C 31 36 0F 00 GAMMA-N
reg(0x000A) 9C 00   Get Power Mode
reg(0x000C) 05 00   Get Pixel Format
reg(0x0061) 00 00   RDID1 HX8347-G
reg(0x0062) 00 00   RDID2 HX8347-G
reg(0x0063) 00 00   RDID3 HX8347-G
reg(0x0064) 00 00   RDID1 HX8347-A
reg(0x0065) 00 00   RDID2 HX8347-A
reg(0x0066) 00 00   RDID3 HX8347-A
reg(0x0067) 00 00   RDID Himax HX8347-A
reg(0x0070) 00 00   Panel Himax HX8347-A
reg(0x00A1) 00 00 00 00 00  RD_DDB SSD1963
reg(0x00B0) 00 00   RGB Interface Signal Control
reg(0x00B4) 02 00   Inversion Control
reg(0x00B6) 08 82 27 04 00  Display Control
reg(0x00B7) 06 06   Entry Mode Set
reg(0x00BF) 00 00 00 00 00 00   ILI9481, HX8357-B
reg(0x00C0) 23 00 00 00 00 00 00 00 00  Panel Control
reg(0x00C8) 00 00 00 00 00 00 00 00 00 00 00 00 00  GAMMA
reg(0x00CC) 72 07   Panel Control
reg(0x00D0) 00 00 00    Power Control
reg(0x00D2) 00 00 03 03 03  NVM Read
reg(0x00D3) 00 93 41 41 ILI9341, ILI9488
reg(0x00DA) 00 00   RDID1
reg(0x00DB) 00 00   RDID2
reg(0x00DC) 00 00   RDID3
reg(0x00E0) 0F 31 2B 0C 0E 08 4E F1 37 07 10 03 0E 09 00 00 GAMMA-P
reg(0x00E1) 00 0E 14 03 11 07 31 C1 48 08 0F 0C 31 36 0F 00 GAMMA-N
reg(0x00EF) 03 80 02 02 02 02   ILI9327
reg(0x00F2) 00 00 00 00 00 00 00 00 00 00 00 00 Adjust Control 2
reg(0x00F6) 01 00 00 00 Interface Control
 0x7E0 0x7E0 0xF800 0xF800
 0x7E0 0x7E0 0xF800 0xF800
 0x1F 0x1F 0xFFFF 0xFFFF
 0x1F 0x1F 0xFFFF 0xFFFF
Benchmark                Time (microseconds)
Screen fill              845860
Text                     134656
Lines                    566740
Horiz/Vert Lines         103932
Rectangles (outline)     48160
Rectangles (filled)      1629580
Circles (filled)         571440
Circles (outline)        555876
Triangles (outline)      132776
Triangles (filled)       1187788
Rounded rects (outline)  220048
Rounded rects (filled)   2245388
Done!

Best Regards

Jean-Marc