MCUFRIEND_kbv Library for Uno 2.4, 2.8, 3.5, 3.6, 3.95 inch mcufriend Shields

@Jean-Marc,

I was wondering what the random pinout was for. Now that I see your adapter, it looks quite neat. I had never seen extra long pin female headers before. I found this on on Ebay

I would do something similar with Protoshield. i.e. solder the header, solder the STM32 board. Solder all the connections with some wire-wrap wire. It ends up with a shallower combination. i.e. the depth of female + male + pcb.

Your construction method looks "quicker" than mine. Soldering headers is fast but the individual wire links take me some time. I have more choice in the actual wiring scheme.

Of course, buying a ready made Adapter Shield for Mega2560 or Due is the quickest of all. (and possibly cheaper)

David.

@David

I use the BluePill as sort of adapter to the parallel interface TFT.

It is fed with serial ascii pure text information from my IoT ESP8266 webserver by another Wemos D1 mini wifi client, to produce a formatted text display.

After having learned how to bitbang from Bodmer's TFT_HX8357_Due, and how to document the mapping, implementing a new mapping becomes quite easy. But for STM32 using a board with FSMC TFT connector is a better way; I will try this soon.

Jean-Marc

Hi.

david_prentice:
Why do you want 8080-16 ? 8080-8 works reasonably fast. And uses less pins.

David.

Just because my screen is only 16 bits mode.
Here is the screen TFT01-7.0.

david_prentice:
You tell me which pins you want to use. There is no current SPECIAL for 16-bit on a STM32.
Life is a lot simpler if you choose contiguous pins for a data bus. e.g. PA04..PA13, PB03..PB08

Data pins could be random but it makes the SPECIAL very messy to write.

David.

As far as wiring is concerned, I have no special preference.
I know it's better to take contiguous pins for data bus.

If you want to make a SPECIAL for this configuration, I leave you free to choose the pins of the data bus.
You can choose the simplest way for you to do it, I would connect the screen in function of the code that you will write.

I would not want to abuse your time but I would also like to connect other screens that I have and that one has an 8 bit data bus.

So my question you can make a SPECIAL one that supports the 8 bit and 16 bit screens.

ZinggJM:
@François

I have this combination, solved in my GxTFT library:

GitHub - ZinggJM/GxTFT: This library separates the aspects IO connection, controller type and display class into separate C++ classes.

It should be possible to put this as modified special also into MCUFriend_kbv.

Jean-Marc

Thank you for your proposal but the problem is that I am not yet very comfortable with the low level code and the bitshift and bitwise to be able to integrate your code to the code of the library of David.

In any case thank you very much to you both.

François.

Quite honestly, I don't think the BluePill has enough GPIO.
By the time you have taken 16 data, 5 control pins there is nothing much left for your XPT2046 or an SD card.
e.g. PB0,1,3-15, PA15 for data bus.
e.g. PA0-3,8 for control
e.g. PA4-7 for SD, PA9,10 for XPT2046
Of course you can lose USB or SWD or Serial but you need at least one method of uploading the code.

Why do you want to use a small STM32? A Mega or Due would work straight out of the box.

If you choose your pins, I will write a SPECIAL for you. I was going to buy a MapleMini or BluePill and make my own Adapter. But I see little point if I have to sacrifice SPI or SWD or Serial.

David.

Edit. I have written the SPECIAL with the above wiring scheme. It is obviously Untested. I have ordered a BluePill and a 20x2 header. I will make and test an Adapter when these arrive from China. Is that wiring scheme ok for you?

Your branch

https://github.com/prenticedavid/MCUFRIEND_kbv/tree/test_9225

Works perfectly on one of my LCD 0x9225, but the text direction is reversed from right to left.

i try change value of
ILI9225_ENTRY_MODE, 0x1030
to 0x1020

and value of
ILI9225_RAM_ADDR_SET2, 0x0000
to 0x00AF

but result is same condition.

i think problem is on setRotation(), But I do not know which part I should change :cry:

oh yeah, and scroll function is not works.
corrected
i just only add this code to vertScroll() function and is works

case 0x9225:
        WriteCmdData(ILI9225_VERTICAL_SCROLL_CTRL1, sea);        //SEA
        WriteCmdData(ILI9225_VERTICAL_SCROLL_CTRL2, top);        //SSA
        WriteCmdData(ILI9225_VERTICAL_SCROLL_CTRL3, vsp - top);  //SST
        break;

hi I've just bought new 2.4 inch and i couldn't run it here is what i got from lcd id
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)

reg(0x0000) 45 32 ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 00 00 00 00 Manufacturer ID
reg(0x0009) 00 00 00 00 00 Status Register
reg(0x000A) 00 00 Get Power Mode
reg(0x000C) 00 00 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 00 00 00 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 01 00 01 00 01 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) 01 01 Panel Control
reg(0x00D0) 00 00 00 Power Control
reg(0x00D2) 00 00 00 00 00 NVM Read
reg(0x00D3) 00 00 00 00 ILI9341, ILI9488
reg(0x00D4) 00 00 00 00 Novatek ID
reg(0x00DA) 00 00 RDID1
reg(0x00DB) 00 00 RDID2
reg(0x00DC) 00 00 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

is it usual?
or is lcd broken?

You have an LGDP4532.

Edit MCUFRIEND_kbv.cpp:

#define SUPPORT_4532              //LGDP4532 +120 bytes.  thanks Leodino

That is it. You just remove the two forward slashes and away you go.

David.

David,

My problem is solved all.
Reversed text and cant vertical scroll is gone now :slight_smile:

This is what I change, and I add it from your code

for reversed text

    case 0x9225:
        _lcd_capable = REV_SCREEN ;
        static const uint16_t ILI9225_regValues[] PROGMEM = {

for vertical scroll function

 case 0x9225;
        case 0x0154:
        WriteCmdData(0x31, sea);        //SEA
        WriteCmdData(0x32, top);        //SSA
        WriteCmdData(0x33, vsp - top);  //SST
        break;

Vertical scroll in action

MCUFRIEND_kbv.cpp (109 KB)

thank you very much David i don't know how to thank you
i respect people your type

The Library Manager installs the MCUFRIEND_kbv library into a folder called

Arduino/libraries/MCUFRIEND_kbv in your Documents

@tongbajiel,

Oops. I had forgotten about the different registers used for Scroll. And it does Band Scroll too.

Do you need to alter the initialisation for ILI9225-B and ILI9225-G ?

I have ordered an 8080-8 ILI9225 Display. So I will see for myself when it arrives (in 14 days time)
I will add your atttributes to the next Release.

David.

graphic test work alright but it seems it it's touch isn't working i touch the screen but nothings happen!!

david_prentice:
@tongbajiel,

Oops. I had forgotten about the different registers used for Scroll. And it does Band Scroll too.

Do you need to alter the initialisation for ILI9225-B and ILI9225-G ?

I have ordered an 8080-8 ILI9225 Display. So I will see for myself when it arrives (in 14 days time)
I will add your atttributes to the next Release.

David.

Wow... You ordered ILI9225 display for your self test.
I really salute and appreciate you and your efforts in helping all in using a TFT LCD.

Thank you very much David.
Later if I managed to use my other LCD with your library, I will review here.

can you help me with touch it's not working?

There is a TouchpinsDiagnose example in the official Release.
There is a Beta sketch on GitHub which diagnoses pins and does a calibration.

Note that the Touch Panel wiring varies on different Shields.
You have to find what values are returned from LEFT, RIGHT, TOP, BOTTOM of the Panel.

Then you siimply calculate the pixel coordinates by using the Arduino map() function.

David.

in order to get right left top and bottom i guess i should run calibration in arduino but when i ran it n i should touch a specific location it doesn't work i touch whole the screen but nothing happen i wanna to know that hardware problem or software

@arian,

Please try this sketch. Copy-paste the output from the Serial Terminal to your message.

David.

TouchScreen_Calibr_native.ino (11.3 KB)

TouchScreen.h GFX Calibration
Making all control and bus pins INPUT_PULLUP
Typical 30k Analog pullup with corresponding pin
would read low when digital is written LOW
e.g. reads ~25 for 300R X direction
e.g. reads ~30 for 500R Y direction

Testing : (A1, D7) = 23
BROKEN TOUCHSCREEN
ID = 0x4532

it seems it's hardware problem

Does your Glass look broken? I suspect that you have a crack across the screen in the X direction.

The 2.4" screens are normally pretty good. They survive the journey from China Post.
I have only ever managed to buy one 3.5" screen that was not cracked.

David.

no i think there is some problem with it's touch connection