7 years, 4 months ago.

need help with 3.5" TFT LCD

Hello to all,

It's been several days since I'm trying to use my new 3.5 "display but I did not find documentation or examples that worked.

This is the model of my Display: http://www.ebay.com/itm/322571873933?rmvSB=true He has RTS,CS,RS,WR and RD pins and I have configred the code for my board pinout (I'm using a NUCLEO-F446RE board) and I'm not sure if my settings are correct; I have imported into the compiler the UniGraphic Example and modified this line:

"TFT_MIPI myLCD(PAR_8, PortC, PB_0, PC_1, PA_4, PA_1, PA_0,"myLCD"); Parallel 16bit, Port, CS, reset, DC, WR, RD for F446" with the relatives pins of my board.

But nothing of good, I only see a white screen and nothing else.

Hope in your help guys, thank you very much

Good day at all Phoedus

1 Answer

7 years, 4 months ago.

Hello Federico,

I think there is a bug in your code:

TFT_MIPI myLCD(PAR_8, PortC, PB_0, PC_1, PA_4, PA_1, PA_0,"myLCD"); // Parallel 8bit, Port, CS, reset, DC, WR, RD 

Pin PC_1 is controlling display reset but at the same time it is used to transfer data over PortC.

I don't have access to such display but I would suggest to try the following:

...
TFT_MIPI myLCD(PAR_8, PortC, PH_0, PH_1, PA_0, PA_1, PA_4,"myLCD"); // Parallel 8-bits, Port, CS, reset, DC, WR, RD for F446
...

Wiring:

ILI9481 moduleNUCLEO-446RE board
LCD_D0<=>PC_0
LCD_D1<=>PC_1
LCD_D2<=>PC_2
LCD_D3<=>PC_3
LCD_D4<=>PC_4
LCD_D5<=>PC_5
LCD_D6<=>PC_6
LCD_D7<=>PC_7
LCD_RST<=>PH_1
LCD_CS<=>PH_0
LCD_RS<=>PA_0
LCD_WR<=>PA_1
LCD_RD<=>PA_4

Accepted Answer

The TFT board shown on ebay is a shield. You cant use the Port option in case you want to plug that on top of a Nucleo F446 because all the port pins need to match the LCD_D0..LCD_D7 pins. You should use the BUS_8 protocol option instead. Comparing the TFT board layout and the F446 layout it seems the mapping should be:

ILI9481 moduleNUCLEO-446RE board
LCD_D0<=>PA_9
LCD_D1<=>PC_7
LCD_D2<=>PA_10
LCD_D3<=>PB_3
LCD_D4<=>PB_5
LCD_D5<=>PB_4
LCD_D6<=>PB_10
LCD_D7<=>PA_8
LCD_RST<=>PC_1
LCD_CS<=>PB_0
LCD_RS<=>PA_4
LCD_WR<=>PA_1
LCD_RD<=>PA_0

Alternatively you could use the pin mapping proposed above by Zoltan , but then you need to wire all pins separately.

Note that the TFT board seems to have bus buffers installed to convert the 5V arduino levels to 3V3 levels for the LCD controller. That should probably still work with the 3V3 F446 device. There seem to be multiple possibilities for the controller type (ili9481 ili9468, ili9488 hx8357, or r61581) so you need to try out different options or try to find some matching Arduino code to check out which controller is the correct one. Perhaps you can also try to read the IR register and find out the controller type.

Google search for "www.mcufriend.com 3.5" to find more info

posted by Wim Huiskamp 19 Aug 2017

For the ILI9481 controller the current version of UniGraphic library provides only two constructors. One for parallel interface (8-bits or 16-bits) and another one for SPI. So to use the BUS_8 parallel interface you have to modify the library by trying to define an additional constructor by yourself. In the UniGraphic library navigate to the Inits folder and add a new constructor by modifying the TFT_MIPI.h and TFT_MIPI.cpp files for example as follows.

TFT_MIPI.h

...
TFT_MIPI(proto_t displayproto, PinName* buspins, PinName CS, PinName reset, PinName DC, PinName WR, PinName RD, const char* name ,const unsigned int LCDSIZE_X = 320, unsigned  int LCDSIZE_Y = 480);
...

TFT_MIPI.cpp

...
TFT_MIPI::TFT_MIPI(proto_t displayproto, PinName* buspins, PinName CS, PinName reset, PinName DC, PinName WR, PinName RD, const char *name, unsigned int LCDSIZE_X, unsigned  int LCDSIZE_Y)
    : TFT(displayproto, buspins, CS, reset, DC, WR, RD, LCDSIZE_X, LCDSIZE_Y, name)
{
    hw_reset();
    BusEnable(true);
    identify(); // will collect tftID and set mipistd flag
    init();
    auto_gram_read_format();
    set_orientation(0);
    cls();
    locate(0,0); 
}
...

Then to use the BUS_8 parallel interface and wiring proposed by Wim create an instance of TFT_MIPI class in your application for instance as follows:

main.cpp

PinName buspins[] = { PA_9, PC_7, PA_10, PB_3, PB_5, PB_4, PB_10, PA_8 };
...
TFT_MIPI myLCD(BUS_8, buspins, PB_0, PC_1, PA_4, PA_1, PA_0, "myLCD");
...
posted by Zoltan Hudak 19 Aug 2017