Go Down

Topic: Read display identification information (04h) (Read 127 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.

Go Up