Continue to Site

# 3"5 320x480 LCD TFT with ILI9486 mainly used with ARDUINO

#### ELECTRONICIENSENIOR

##### Member level 2
Hello, I am french so I may write with faults

I am trying to use this display :

But I do not use the Arduino world, the target is to make a handheld device to display ECG with an AD8232.
So I don't use libraries, I expectwriting all in C for a Microchip PIC16 mid range.

I have bought several items, all in 8bits data bus, not SPI, for speed.
The blue FR4 versions have 5v and 3v3 pins on connector, but 3v3 is not wired to AMS1117 reg.
So I have shorted in and out to supply 3v3 via 5v pin.
Even in whoel reset the screen is white, and a deffect for one which has two cyan zones !

I have not set pwm values, not driven display ON, so I expected it should be black. And the memory write for 5000 pixels is not visible.

May I have help ?

Best regards

#### FenTrac

##### Full Member level 4
You should be able to find Arduino (AVR microcontroller) libraries for the display that are written in C. The library will not be written for the PIC microcontroller, so it would need to be modified to work with your target Microcontroller. How hard is it to do this? The library will have the C source code. The I/O ports being used by the library will need to be changed to the ports for the microcontroller you are using. Going through the process should reveal how the display is controlled. The modified code can be put into your C project as needed without constructing an entire new library for the PIC.

#### ELECTRONICIENSENIOR

##### Member level 2
Thank you for your answer. Now I have copied from GitHub a library for STM32 much more readable for me. I am not fan of Arduino at all, it is for small hobbyists.

The .h file is well commented, also the .cpp file, I have began to read.

By reading the main Arduino forum I have understood that when the ILI9xxx does not understand commands the reset state os very often white, as for me, with a current supply of 35mA. And also the Chenese use different chips. I have not enouth pins so I don't read inside to read IDx, I believe that some drivers read and have many tables for registers and commands.

#### doraemon

##### Super Moderator
Staff member
Hello!

I have bought several items, all in 8bits data bus, not SPI, for speed.

I'm not sure that a parallel transfer would be faster than SPI. Here is why:
If you want to send 8-bit parallel data (a buffer) to your LCD, you have to put 1 byte
to the output port, latch it, then put the next byte, etc... This means that you are using
a loop, and a loop takes time.
If you have a processor doing this automatically (with a dedicated latch pin), then you may
indeed send_buffer(your buf, your_buf_len). But this works only if it's implemented in hardware.
I have bought several items, all in 8bits data bus, not SPI, for speed. A kind of EMIF,
not sure if you have that on your PIC.
But something more likely to be implemented is DMA, that you can use with SPI.
So if you use dma_spi_send_but(your buf, your_buf_len), then you can do other things
while your data is being sent.

Dora.

#### ELECTRONICIENSENIOR

##### Member level 2
Hello

I use a MICROCHIP 8 bits middle range, and wihe the 8MHz internal osc and 4x PLL it runs at 32 MHz without the use of two pins for Xtal, and 1% accuracy is sufficient.

I will probably use the display in landscape with a partial scroll to have a block of text for numeral values...

If I use serial access with 3 wire SPI and 9 bits the MSSP of the PIC Has a clock of 400 KHz max, so I will be obliged to use interrupts to refill serial buffer.
To scroll une column and add a value on the curve (including small calculation) I must write 320 pixels in 16 bits color scheme, probably 10 ms and I will take that into account in the main loop to make measurements in a regular cycle, I think it will be simplier, probably with the help of a timer.

I have found two other displays (320x240 with ILI9325) and when I power them they are white a little time then completely black so hardware reset is efficient, so I do not understand why the other displays stay white. Are they broken, at least at the processor interface side ??? Or have they a non ILI chip, with some different comportment at power on ???

Alain

#### ELECTRONICIENSENIOR

##### Member level 2
What should be the answer to a 04h command if it is a ILI9486 or 9488 ;

2nd Parameter: Send LCD module's manufacturer information
3rd Parameter: Send panel type and LCM/driver version information
4th Parameter: Send module/driver information

#### doraemon

##### Super Moderator
Staff member
Hello!

so I will be obliged to use interrupts to refill serial buffer.

Do you have any technical reason preventing you to use interrputs?

I have found two other displays (320x240 with ILI9325) and when I power them they are white a little time then completely black so hardware reset is efficient, so I do not understand why the other displays stay white. Are they broken, at least at the processor interface side ??? Or have they a non ILI chip, with some different comportment at power on ???

It depends on how reset is defined.
Usually on a PC, if you clear a window, it's white. On some embedded screens, I have seen both.
On small COG LCDs, it's even inverted: 1 means black and 0 means white.

Dora.

#### KlausST

##### Super Moderator
Staff member
Hi,

For an OLED for example it totally makes sense to make all black.
Like Dora said, it's kind of definition.

Klaus

#### ELECTRONICIENSENIOR

##### Member level 2
I am now on the good way. I have bought new displays, and the silk screen has two lines near a corner, with two squares to check, and two references of chip, for ex ILI9488 and ILI9486, or for another one ILI9488 and HX8357, and a red paint indicates which chip is inside !!!

So, I know what to obtain.
The ILI9486 datasheet V0.6 does not indicate on the right column of the detailed description the value expected, and I have not found a more recent version, and Waveshare has been of no help.
But on the 9848 datasheet V1.0 it is clearly detailed, and now for ID3 command I receive 00h, 94h and 88h.

My problem was caused by a bit of port B of my pic used temporarly for uart and not reconfigured for ILI, si SOLVED

#### ELECTRONICIENSENIOR

##### Member level 2
This identification command works now, but I have to find the minimal sequence to init the display.
I had written a routine for the 9486, but the 9488 is really different, not the same registers, name and address for more.
--- Updated ---

I have found such an init sequence for 9488 here :

I suppose that at reset the chip has default values, as mentioned in the datasheet, most are 00h, and I would know if the values to write for these control registers are critical, depending of the real tft display.

Last edited:

#### ELECTRONICIENSENIOR

##### Member level 2
Hello,

I have added the stm32 sample init code, and it gives a display, but colors not as expected.
The code for rectangles (not optimized) :

// pour voir
lcdWriteReg(0x2C); // Memory !!! (APO)

for (LCD_RAM_PTR = 0; LCD_RAM_PTR < 19200; LCD_RAM_PTR ++) // black
{
lcdWriteData(0x00);
lcdWriteData(0x00);
}

for (LCD_RAM_PTR = 0; LCD_RAM_PTR < 19200; LCD_RAM_PTR ++) // red
{
lcdWriteData(0xF8);
lcdWriteData(0x0F);
}

for (LCD_RAM_PTR = 0; LCD_RAM_PTR < 19200; LCD_RAM_PTR ++) // green
{
lcdWriteData(0x07);
lcdWriteData(0xE0);
}
// blue
for (LCD_RAM_PTR = 0; LCD_RAM_PTR < 19200; LCD_RAM_PTR ++)
{
lcdWriteData(0x00);
lcdWriteData(0x1F);
}

for (LCD_RAM_PTR = 0; LCD_RAM_PTR < 19200; LCD_RAM_PTR ++) // white
{
lcdWriteData(0xFF);
lcdWriteData(0xFF);
}

What do you think about ? Is it gamma problem or other ?
--- Updated ---

writecommand(0x3A); // Interface Pixel Format
writedata(0x55);

But the full red seems to be magenta ??? Any idea ?
--- Updated ---

It seems to be correct now

#### Attachments

• P1060345.JPG
636.2 KB · Views: 13
• P1060346.JPG
640.8 KB · Views: 12
• P1060347.JPG
666.3 KB · Views: 12
• P1060348.JPG
652.7 KB · Views: 15
Last edited:

#### ELECTRONICIENSENIOR

##### Member level 2
I begin to understand the chip really. But when I need help for 24x24 font matrix to compress I am asking help without answer. Not so cool

#### ELECTRONICIENSENIOR

##### Member level 2
Hello,

I can give some information about the display with ILI9488 used in 8 bits parallel :

- the LCD_CSn signal can be wired to GND (not idea about the efect on supply current, but backlight is on)
- the LCD_RDn is always needed if one needs to interrogate the ID to know which chip is present
- it does not take too much resources with a PIC16(L)F1827 at 32MHz with 8MHz internal and PLL x 4

I have made the choice to restrict for only one ILI chip, if necessary I will write different init sequences and low level routines, selected at compilation step with a #DEFINE:and #IFDEF.

When we understand the controller principles it is easy to use, to fill zones, draw lines, and text, all what I need for my ECG project. The only condition is to find the good values to init powers, gamma and all the parameters adapted to the TFT mounted in the display.

I have made a first test yesterday, generating 0 to 9 patterns in symbol 8 bits with this genial software :

I have tripled in both axis, it looks very good for me, and now have to define the final screen, with scrolling graph. I will add an image later on

BTW if I make mistakes in writing, don't hesitate to correct me, so as I can ameliorate my langage, I am French living in Le Mans, "100 years" birthday for the cars race !!!

-

#### doraemon

##### Super Moderator
Staff member
Hello!

This code:
Code:
for (LCD_RAM_PTR = 0; LCD_RAM_PTR < 19200; LCD_RAM_PTR ++) // black
{
lcdWriteData(0x00);
lcdWriteData(0x00);
}

is extremely inefficient.
The reason is that your MCU keeps rowing for nothing. This whole process can be delegated to
a DMA, as said earlier.
Basically a DMA is a part of your MCU that can run on itself (without your programming intervention).
What you do is that you have a source (src) and destination (dest). And a length you want your transmit.
You tell the DMA: "Transfer <length> bytes from src to dest", and the process happens without any
software involved once it has started.
-It's a lot faster. When you use a loop as you do, you copy one byte and then loop back to copy the
next byte. The loop (jmp or branch) itself takes time. But the DMA knows how to do that without a loop
- While your DMA works, you can do other things because the DMA "thread" has no relation with your
code once it's started
- When the DMA finishes, you can have an interrupt that informs your program that the transfer is done.

By the way, you can aso tell the DMA to repeat the same byte (SRC doesn't need to be a buffer, it
can be a value). Therefore if you want to paint the screen white, you would write:
dma_set_increments(!INC_SRC, INC_DEST);
dma_set_datawidth(2); // Allow to send 2 source bytes at every step. Dest will be incremented by 2.
dma_spi_write(value, frame_buffer, length)

Most of the MCUs have a DMA, even small ones. Maybe not Arduino Uno, but the more advanced types
do have a DMA.

Dora.

#### ELECTRONICIENSENIOR

##### Member level 2
Thank you for your answer. In fact this sample code will not be used in the final project, it is only for testing.

The processor I intend to use has no DMA, but it has only to acquire ECG signal, i.e. a low frequency voltage, make some calculations to estimate pics then obtain frequency, and sometimes display a whole column with a small drawing for analog signal and some numeric values.

#### ELECTRONICIENSENIOR

##### Member level 2
Hello,

many Ebay vendors of China do not guarantee the exact chip mounted, for a sell of three I have had two different versions, and the HX has not the good colorimetry with ILI gamma or other values. So can we work to this subject to understand the values to have a good init table ???

#### ELECTRONICIENSENIOR

##### Member level 2
I enclose marking of two screens.

#### Attachments

• P1060350.JPG
715.7 KB · Views: 14
• P1060349.JPG
671.4 KB · Views: 13

#### ELECTRONICIENSENIOR

##### Member level 2
ONE MORE TIME :

I have found a sufficient init file for ILI9488 outside of the arduino jungle, clear C language.

I would be happy to work foe a 9486 init file