Go Down

Topic: Read display identification information (04h) (Read 2804 times) previous topic - next topic

BluesBear

Hi there,

My Display is a Chinese 2.8" display ILI9341 SPI with touch and SD. See picture

It does show nothing on the screen. I am using the adafruit library as this one was the only one which supports SPI with MOSI and MISO.

I tried to read out the driver chip info with the command 04h (0x04).

The Adafruit Library reads with the tft.readcommand8 only one byte. The command 04h would give 4 bytes out in regard to the Ilitek manual.

How can I get all 4 bytes?
Which library are you using with this TFT?

Regards
Sven

david_prentice

I don't know which library you are using.

Code: [Select]

void diag_reg(const __FlashStringHelper *name, uint8_t reg, uint8_t n)
{
    uint8_t x = reg;
    Serial.print(name);
    Serial.print(" (0x");
    Serial.print(x < 0x10 ? "0" : "");
    Serial.print(x, HEX);
    Serial.print("):");
    for (int i = 0; i < n; i++) {
        uint8_t x = tft.readcommand8(reg, i);
        Serial.print(x < 0x10 ? " 0" : " ");
        Serial.print(x, HEX);
    }
    Serial.println("");
}

void diag_show(void)
{
    diag_reg(F("ILI9488_RDDID"), 0x04, 5);
    diag_reg(F("ILI9488_RDIMGFMT"), 0x0A, 1);
    diag_reg(F("ILI9488_RDMADCTL"), 0x0B, 1);
    diag_reg(F("ILI9488_RDPIXFMT"), 0x0C, 1);
    diag_reg(F("ILI9488_RDSELFDIAG"), 0x0F, 1);
    diag_reg(F("ILI9488_DFUNCTR"), 0xb6, 5);
    diag_reg(F("ILI9488_PWCTR1"), 0xC0, 3);
    diag_reg(F("ILI9488_VMCTR1"), 0xC5, 3);
    diag_reg(F("ILI9488_VMCTR2"), 0xC7, 2);
    diag_reg(F("NVM Status   "), 0xD2, 3);
    diag_reg(F("ID4          "), 0xD3, 4);
    diag_reg(F("ILI9488_RDID1"), 0xDA, 2);
    diag_reg(F("ILI9488_RDID2"), 0xDB, 2);
    diag_reg(F("ILI9488_RDID3"), 0xDC, 2);
    diag_reg(F("GAMMAP       "), 0xE0, 16);
    diag_reg(F("GAMMAN       "), 0xE1, 16);
    diag_reg(F("INTERFACE    "), 0xf6, 4);
}




Don't worry about the ILI9488 names.   It was originally written for ILI9341.

I think that the Adafruit_ILI9341 library has the readcommand8(register, index) method.

David.

BluesBear

Hi David,

Thanks for the code. Your code worked but still others than backlight nothing on the screen.
Can you tell me if the codes show something?

ILI9488_RDDID (0x04): 00 00 00 00 00
ILI9488_RDIMGFMT (0x0A): 08
ILI9488_RDMADCTL (0x0B): 48
ILI9488_RDPIXFMT (0x0C): 05
ILI9488_RDSELFDIAG (0x0F): 00
ILI9488_DFUNCTR (0xB6): 00 0A 82 27 04
ILI9488_PWCTR1 (0xC0): 00 21 00
ILI9488_VMCTR1 (0xC5): 3C 31 3C
ILI9488_VMCTR2 (0xC7): 86 86
NVM Status    (0xD2): 03 00 00
ID4           (0xD3): 41 00 93 41
ILI9488_RDID1 (0xDA): 00 00
ILI9488_RDID2 (0xDB): 00 00
ILI9488_RDID3 (0xDC): 00 00
GAMMAP        (0xE0): 00 0F 16 14 0A 0D 06 43 75 33 06 0E 00 0C 09 08
GAMMAN        (0xE1): 00 08 2B 2D 04 10 04 3E 24 4E 04 0F 0E 35 38 0F
INTERFACE     (0xF6): 00 01 00 00

david_prentice

#3
Oct 12, 2017, 07:30 pm Last Edit: Oct 12, 2017, 07:33 pm by david_prentice
Code: [Select]
ID4           (0xD3): 41 00 93 41

That is your ID.   Note that the first byte read is always a dummy e.g.
Code: [Select]
ID4           (0xD3): xx 00 93 41

You don't say which library you are using.   Or describe any of your hardware wiring.
But the registers are being read correctly.   Look at the GAMMA entries.  You can see whether you have ILI9341 or ILI9341V chip by looking at the power-up values.

Regarding the screen display.   I have no idea what library you are using.   Or if your initialisation is appropriate.

Note that there a several ILI9341 SPI libraries.   And examples that run on Zero, Due, Teensy3.x, STM32, ESP8266, ESP32, ...
If you want to use 5V GPIO,  you must convert the logic levels to 3.3V.

David.

BluesBear

Hi David,

Sorry, I am using a Nano V2 clone with the adafruit library:

#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"

Any other library I should use? My display needs MISO and MOSI. I read that some libraries use only one of the data pins. My Display wants both.

The ILI9488_RDID1-3 values are all 00h. Is that OK? And is it OK that the ILI9488_RDSELFDIAG (0x0F) is 00?

Any hints?

Regards
Sven

david_prentice

#5
Oct 12, 2017, 08:13 pm Last Edit: Oct 12, 2017, 08:19 pm by david_prentice
From memory,   the diagnostic registers i.e. 0x04 - 0x0F are readable directly.  You don't need to read the index via 0xD9.
 
Note that the first read is valid with these special registers.

Quote
The ILI9488_RDID1-3 values are all 00h. Is that OK? And is it OK that the ILI9488_RDSELFDIAG (0x0F) is 00?
Looks ok.   ID1-3 reflect whatever is stored in reg(0x04).   And these registers are directly readable.   (you must check with the datasheet)

I am always horrified by people that have 5V Nanos.
They buy the cheapie hardware and then can't afford resistors or level shifter chips.

And it is a lot more fiddly with external logic hardware than regular 3.3V Arduinos.

Please post a schematic of your wiring.   Or a photo of the real-life wires.

David.

BluesBear

Hi David,

In regard to the Arduino specs the Nano is always 5V. The display is in regard to the seller 5V capable.
As labeled on my display module, the connections are

SCK - Arduino Pin 13
SDO(MISO) - Arduino Pin 12
SDI(MOSI) - Arduino Pin 11
CS - Arduino Pin 10
D/C - Arduino Pin 9
RESET (Display) - Arduino Pin 8
LED - Pin 6 (with PWM driven)
VCC - 5V
GND - GND

See pictures.

BluesBear

And installed a separate power supply in case the Nano cannot supply enough.
See pictures and code.

david_prentice

Quote
In regard to the Arduino specs the Nano is always 5V. The display is in regard to the seller 5V capable.
As you know,  the Moon is made of green cheese.

These Red ILI9341 displays are very popular.   There are lots of libraries.   There is a lot of advice about wiring for 3.3V

Quote
And installed a separate power supply in case the Nano cannot supply enough.
The controller takes about 20mA.   The backlight needs about 50mA.   It is your responsibility to restrict the LED current.   This will cost you a whole resistor.

Your construction is an excellent way to do things.   It also makes it easy to add series resistors or voltage dividers.

Resistors are not expensive.   But you can buy level-shifter i.c. from Ebay with several "channels".
Life is so much simpler with 3.3V STM32 or SAM controllers.

David.

BluesBear

Hi David,

Added a resistor to LED and run several tests. The display does not show anything still. Just the back light. Can the 5V operation cause the problem?

Or could the Adafruit library not be compatible with this TFT?

The ILI9341 chip is responding to the Arduino (see code and result from the serial monitor attached), just the TFT shows no content.

Any advice or other ideas where to look?

Regrads
Sven

david_prentice

#10
Oct 21, 2017, 03:12 pm Last Edit: Oct 21, 2017, 03:14 pm by david_prentice
Your display is 3.3V

You can quote as many Ebay vendors as you like.    I can probably find an equivalent number of "green cheese" advocates.

Yes,  your construction method is an excellent way to make a mechanically reliable project.
And it is very easy to mount series resistors or voltage dividers.

If you had placed the Nano on one side of your protoboard,  you could have mounted a purpose level shifter i.c.

You might have damaged the ILI9341 with 5V logic.    But it may have survived.
Please let us know how you get on (after you have added resistors or i.c.).

David.

BluesBear


BluesBear

Hi,

Made a new board to 3,15V with resistors. 2,7k and 4.7k (to GND). No result at all. The Arduino gives all registers back as 00h. Tried both VCC to 3,3V and 5V. No result on the screen too.

When I put it back to the 5v board, it gives out the old results, as shown above. The ILI responses but nothing on the screen.

Any one a clou?

Regards
Sven


david_prentice

Go on.   You could have posted your schematic.   A pencil drawing is fine.

Or you could have taken an accurate photo of your protoboard.   e.g. showing the resistors and different coloured DuPont cables.

A photo of a "switched off" DMM is a bit pointless.
I would assume that someone with soldering skills probably knows how to use Ohm's and Kirchoff's Laws.


What is less obvious is Adafruit's trick of example constructors which omit the LCD_RST argument.
Your Red Display does not have a pullup on RST.   Adafruit's Displays do have a pullup on RST.

I have suggested Bodmer's libraries for many TFTs.
But one of the most useful pages from Bodmer is this instructable

There are several Tutorials on wiring your SPI Display.    Note that many Tutorials on the Internet are complete crap.   e.g. no capacitors,  no level shifters,  ...
If you are following a Tutorial,  please post a link to it.   Readers might advise whether it is good or bad.

David.

BluesBear

Thanks, will do tomorrow. Getting late today.

Regards
Sven

Go Up