3.2" TFT LCD noname showing white display on MEGA2560

Hello all,

I have a noname 3.2" TFT lcd from China (ebay link) and I tried to connect it to Meag2560 R3.

Using the LCD_ID_reagreg rev 2.9.7 from David Prentince I get the following output:

Registers on MCUFRIEND UNO shield
controllers either read as single 16-bit
e.g. the ID is at readReg(0)
or as a sequence of 8-bit values
in special locations (first is dummy)

reg(0x0000) 00 00 ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 00 00 93 01 Manufacturer ID
reg(0x0009) 00 00 61 00 00 Status Register
reg(0x000A) 08 08 Get Power Mode
reg(0x000C) 66 66 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 FF 00 FF 00 RD_DDB SSD1963
reg(0x00B0) 00 00 RGB Interface Signal Control
reg(0x00B4) 00 00 Inversion Control
reg(0x00B6) 00 00 00 00 00 Display Control
reg(0x00B7) 00 00 Entry Mode Set
reg(0x00BF) 00 00 00 00 00 00 ILI9481, HX8357-B
reg(0x00C0) 00 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) 00 00 Panel Control
reg(0x00D0) 40 40 01 Power Control
reg(0x00D2) 40 40 01 40 40 NVM Read
reg(0x00D3) 00 00 93 41 ILI9341, ILI9488
reg(0x00D4) 41 41 01 41 Novatek ID
reg(0x00DA) 00 00 RDID1
reg(0x00DB) 93 93 RDID2
reg(0x00DC) 01 01 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

From the D3 register above I understand that the controller for the LCD is ILI9341.

However, using the graphictest_kbv also developed by David is not working. It identifies the controller as 9341, but the display remains white.

The connections between mega2560 and LCD are:

#define LCD_RST A4
#define LCD_CS A3
#define LCD_RS A2
#define LCD_WR A1
#define LCD_RD A0

#define LCD_D0 8
#define LCD_D1 9
#define LCD_D2 2
#define LCD_D3 3
#define LCD_D4 4
#define LCD_D5 5
#define LCD_D6 6
#define LCD_D7 7

My setup including the LCD pinout is attached.

Do you have any ideas about what am I missing?

Thank you
Dan

I am gobsmacked. You have connected a 3.3V display to the GPIO on your 5V MEGA2560. I would expect the display to be permanently damaged.

However, your readreg report is "working". It is NOT an Ilitek ILI9341. I have no idea what manufacturer has created your "9341". Your display is intended for a 3.3V STM32 34-pin TFT header.

There are several non-Ilitek manufacturers that report ID=0x9325 e.g. Himax, Raydium.
I have never heard of a non-Ilitek ILI9341.

A genuine Ilitek ILI9341V will report:

Read Registers on MCUFRIEND UNO shield
controllers either read as single 16-bit
e.g. the ID is at readReg(0)
or as a sequence of 8-bit values
in special locations (first is dummy)

ILI9302 / ILI9329 / ILI9338 / ILI9341
reg(0x0004) 00 00 00 00    Manufacturer ID
reg(0x0005) 00 00   DSI errors
reg(0x0009) 00 00 61 00 00  Status Register
reg(0x000A) 00 08   Get Powsr Mode
reg(0x000B) 00 00   Get Address Mode
reg(0x000C) 00 06   Get Pixel Format
reg(0x000D) 00 00   Get Display Mode
reg(0x000E) 00 00   Get Signal Mode
reg(0x000F) 00 00   Get Diagnostic Result
reg(0x00B0) 00 00   Interface Mode
reg(0x00B1) 00 00 1B    Frame Rate Normal
reg(0x00B2) 00 00 1B    Frame Rate Idle
reg(0x00B3) 00 00 1B    Frame Rate Partial
reg(0x00B4) 00 02 00    Inversion Control
reg(0x00B5) 00 02 02 0A 14  Blanking Porch
reg(0x00B6) 00 0A 82 27 Display Control
reg(0x00B7) 00 06   Entry Mode Set
reg(0x00C0) 00 21 00    Power Control 1
reg(0x00C1) 00 10   Power Control 2
reg(0x00C2) 00 00   Power Control 3
reg(0x00C3) 00 00   Power Control 4
reg(0x00C4) 00 00   Power Control 5
reg(0x00C5) 00 31 3C    VCOM Control 1
reg(0x00C6) 00 00   VCOM Control 2
reg(0x00D3) 00 00 93 41 RDID4
reg(0x00DA) 00 00   RDID1
reg(0x00DB) 00 00   RDID2
reg(0x00DC) 00 00   RDID3
reg(0x00E0) 00 0F 16 14 0A 0D 06 43 75 33 06 0E 00 0C 09 08 GAMMA-P
reg(0x00E1) 00 08 2B 2D 04 10 04 3E 24 4E 04 0F 0E 35 38 0F GAMMA-N

Which country are you in? I have thought about buying a ST32F407VET board with 34-pin display but never got around to it.

David.

Hi David,

I'm in Bulgaria.

The information available regarding which controller it has are contradictory.

I actually have another which I'm thinking to connect it to my STM32F103C8T6 but I was unable to find which pin goes where...

Dan

I have run a SSD1963 with a BluePill. You use an awful lot of GPIO pins on an 8080-16 interface. Which leaves very few for other purposes.

I am certain that your display is configured for 8080-16 interface. You might be able to change it to 8080-8 interface. Whatever you do, make sure that you use 3.3V logic on the undamaged display.

I have thought about getting this package choosing Option #2.
ZinggJM has this board (I think). But his readreg report shows a regular ILI9341V controller.

Where did you get your display?
Can you ask the Vendor what make of controller is mounted? And can they supply a datasheet.

It would be of academic interest to use the FSMC interface. I already know how a genuine Ilitek ILI9341 behaves. That is not much good to you!

David.

I bought it from here.

Already asked for....however, no answer.

Ask for your money back. It does not have a real ILI9341. It does not work.

Your link shows Ebay. They will ensure that you get a refund. Of course, the Vendor is more inclined to get off her backside when she loses money. She only has to ask her supplier for the information and everyone could be happy.

I would be happy to help you with your "0x9341". BluePills are a pain. Do you have a proper Nucleo or Discovery board? Or any other Arduino with 3.3V GPIO.

David.

I bought them some months ago and now I needed a display and... :confused:

Regarding the blue pill...it's a Chinese knockoff, similar to this one. So no proper board...

Other Arduino...not really. I have few Nanos, Digisparks, mega2560, 1284...

I would like to make it work on STM32F103C8T6...but I'm having troubles with the LCD - STM32 connections...

This looks like a suitable SPECIAL for you:

// #################################### STM32 PIONSCOR #######################################
#define USE_PIONSCOR_BLUEPILL
...
#elif defined(USE_PIONSCOR_BLUEPILL) && (defined(__STM32F1__) || defined(STM32F103xB)) // MAPLECORE or STM32CORE 
#warning SSD1963 on USE_PIONSCOR_BLUEPILL
#define USES_16BIT_BUS
#if defined(ARDUINO_NUCLEO_F103C8)   //regular CMSIS libraries
#define REGS(x) x
#define GPIO_INIT()   { RCC->APB2ENR |= RCC_APB2ENR_IOPAEN | RCC_APB2ENR_IOPBEN | RCC_APB2ENR_IOPCEN | RCC_APB2ENR_IOPDEN | RCC_APB2ENR_AFIOEN; \
        AFIO->MAPR |= AFIO_MAPR_SWJ_CFG_1;}
#else                                                                  //weird Maple libraries
#define REGS(x) regs->x
#endif

#define WRITE_DELAY { }
#define READ_DELAY  { RD_ACTIVE; }
//
#define GROUP_MODE(port, reg, mask, val)  {port->REGS(reg) = (port->REGS(reg) & ~(mask)) | ((mask)&(val)); }
#define GP_OUT(port, reg, mask)           GROUP_MODE(port, reg, mask, 0x33333333)
#define GP_INP(port, reg, mask)           GROUP_MODE(port, reg, mask, 0x44444444)
#define PIN_OUTPUT(port, pin) {\
        if (pin < 8) {GP_OUT(port, CRL, 0xF<<((pin)<<2));} \
        else {GP_OUT(port, CRH, 0xF<<((pin&7)<<2));} \
    }
#define PIN_INPUT(port, pin) { \
        if (pin < 8) { GP_INP(port, CRL, 0xF<<((pin)<<2)); } \
        else { GP_INP(port, CRH, 0xF<<((pin&7)<<2)); } \
    }

#define PIN_HIGH(port, pin)   (port)-> REGS(BSRR) = (1<<(pin))
#define PIN_LOW(port, pin)    (port)-> REGS(BSRR) = (1<<((pin)+16))

#define RD_PORT GPIOA
#define RD_PIN  0
#define WR_PORT GPIOA
#define WR_PIN  1
#define CD_PORT GPIOA
#define CD_PIN  2
#define CS_PORT GPIOA
#define CS_PIN  3
#define RESET_PORT GPIOA
#define RESET_PIN  8

// configure macros for the data pins DB2 on PA15.  All others on PB0-1, PB3-15
#define BMASK 0xFFFB
#define write_16(d) { \
        GPIOA->REGS(BSRR) = (1<<15) << 16; \
        GPIOB->REGS(BSRR) = (BMASK) << 16; \
        GPIOA->REGS(BSRR) = ((d) & (1<<2)) << 13; \
        GPIOB->REGS(BSRR) = (d) & BMASK; \
    }

#define read_16()     ( ((GPIOA->REGS(IDR) & (1<<15)) >> 13) | (GPIOB->REGS(IDR) & BMASK) )

//                                              PA15                        PB15-PB8                 PB7-PB3,PB1-PB0
#define setWriteDir() {GP_OUT(GPIOA, CRH, 0xF0000000); GP_OUT(GPIOB, CRH, 0xFFFFFFFF); GP_OUT(GPIOB, CRL, 0xFFFFF0FF); }
#define setReadDir()  {GP_INP(GPIOA, CRH, 0xF0000000); GP_INP(GPIOB, CRH, 0xFFFFFFFF); GP_INP(GPIOB, CRL, 0xFFFFF0FF); }

#define write8(x)     { write16((x) & 0xFF); }
#define write16(x)    { write_16(x); WRITE_DELAY; WR_STROBE; WR_IDLE; WR_IDLE; }
#define READ_16(dst)  { RD_STROBE; READ_DELAY; dst = read_16(); RD_IDLE; RD_IDLE; RD_IDLE; }
#define READ_8(dst)   { READ_16(dst); dst &= 0xFF; }

The wiring is pretty simple:

// control pins on PA0-PA3, PA8
// data pins DB2 on PA15.  All others on PB0-1, PB3-15

Wire it up. #define the pins in the readreg sketch. Test the wiring.

David.

My LCD doesn't have a CD pin...

only RST, WR, RD, CS, RS...

is RS == CS?

CommandData or DataCommand is the same as RegisterSelect.
ChipSelect is always ChipSelect. Sometimes ChipEnable.

thanks...

regarding the special stuff...do I need to insert that code in mcufriend_special.h? (I found it also in mcufriend_special_2.h in the unused folder)

...what about that "elif" in

#elif defined(USE_PIONSCOR_BLUEPILL) && (defined(__STM32F1__) || defined(STM32F103xB)) // MAPLECORE or STM32CORE

...is that correct?...I'm not aware about this...

thanks again...