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

I press al cross-hairs one by one. ( i can not see any highlited cross-hair)

I love you. No one has ever said anything before!

Please can you edit TouchScreen_Calibr_native.ino

...
#define RED   0xF800
#define GRAY  0x001F  //.kbv was 0x8410
...
    centerprint("* RELEASE *", text_y_center);
    drawCrossHair(x, y, RED);  //.kbv was GRAY
...

This will draw 8 BLUE cross-hairs.
A highlighted cross-hair is WHITE
A finished cross-hair turns RED

Any normal calibration will be ~800 between TS_LEFT and TS_RT

If you get something different, please copy-paste the whole Serial Terminal.

David.

Thank for this David.
I was looking in the code to make these changes in order to change the colors.
But i don't know much about C programming. (You see i am not a programer just learn thinks by myself)
Anyway now the calibration test example works fine and it is shown cross-hair as you say (all blue , highligtede white and finished red)
After tha the serial monitor shows me:

TouchScreen.h GFX Calibration
Making all control and bus pins ITouchScreen.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) = 26
Testing : (A2, D6) = 45
Diagnosing as:-
XM,XP:  (A1, D7) = 26
YP,YM:  (A2, D6) = 45
ID = 0x9340
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) = 26
Testing : (A2, D6) = 45
Diagnosing as:-
XM,XP:  (A1, D7) = 26
YP,YM:  (A2, D6) = 45
ID = 0x9340

cx=217 cy=207 cz=627 LEFT, TOP, Pressure
cx=213 cy=512 cz=557 LEFT, MIDH, Pressure
cx=204 cy=792 cz=401 LEFT, BOT, Pressure
cx=554 cy=218 cz=695 MIDW, TOP, Pressure
cx=539 cy=790 cz=483 MIDW, BOT, Pressure
cx=872 cy=219 cz=702 RT, TOP, Pressure
cx=879 cy=503 cz=648 RT, MIDH, Pressure
cx=875 cy=789 cz=557 RT, BOT, Pressure
MCUFRIEND_kbv ID=0x9340  240 x 320

const int XP=7,XM=A1,YP=A2,YM=6; //240x320 ID=0x9340
const int TS_LEFT=180,TS_RT=905,TS_TOP=194,TS_BOT=809;
PORTRAIT CALIBRATION     240 x 320
x = map(p.x, LEFT=180, RT=905, 0, 240)
y = map(p.y, TOP=194, BOT=809, 0, 320)
Touch Pin Wiring XP=7 XM=A1 YP=A2 YM=6
LANDSCAPE CALIBRATION    320 x 240
x = map(p.y, LEFT=194, RT=809, 0, 320)
y = map(p.x, TOP=905, BOT=180, 0, 240)

After copy-paste the 2 const int lines in the Touch_Shield_new.ino example everythig seems to works fine.
Now my display works as it should.

Thank you David for your help and your great library and examples.

Yannis.

Your calibration looks normal:

const int XP=7,XM=A1,YP=A2,YM=6; //240x320 ID=0x9340
const int TS_LEFT=180,TS_RT=905,TS_TOP=194,TS_BOT=809;

I think BLUE->WHITE->RED looks fairly good
Would RED->WHITE->GREEN be more intuitive?
Would BLUE->WHITE->GREEN look better?

David.

I think that colors is OK.
For my eyes i mean.

Another question David,
Is there is any easy (or not) way to determine what controller does a display use?

Yes, tft.readID()
The clue is in the name.

I can identify the controller mounted on the TFT panel. (You can't see it with your eyes)
I can't tell the geometry of the TFT panel.

Run the diagnose_TFT_support.ino from the examples.
This makes geometry errors easy to see. e.g. your (mystery) screen

I would appreciate feedback. e.g.

  1. suggestions for improvng examples
  2. suggestions for improving extra/mcufriend_how_to.txt

I will put the improved TouchScreen_Calibr_native sketch onto the GitHub Beta.
It is simple ideas that make a big difference.

David.

Please let me understand.
I run diagnose_TFT_support.ino for a display i have and i got ID=0XB509
I know that the IC driver is R61509V
How does it comes from B509?

david_prentice:
I will put the improved TouchScreen_Calibr_native sketch onto the GitHub Beta.
It is simple ideas that make a big difference.

Yes that would be very helpful since as i told you there are not shown highlighted Cross-hairs.
Thank myou for that mod.

Read extra/mcufriend_how_to.txt

Observe the ID values for R61505 variants: R61505U, R61505V, R61505W
The ID values for R61509 variants: R61509U, R61509V, R61509W follow the same pattern.

David.

david_prentice:
Read extra/mcufriend_how_to.txt

Observe the ID values for R61505 variants: R61505U, R61505V, R61505W
The ID values for R61509 variants: R61509U, R61509V, R61509W follow the same pattern.

David.

Thank you David

What sketch are you trying to compile?
What library version numbers are you using?
Did you install libraries via the IDE Library Manager?

David.

Hi, thanks for the reply. I found the problem after digging into the files more deeply. The posted code included "myicon" where as the icon.c matrix variable was "myicons".

We don't know what sketch you are trying to build.

graphictest_kbv shows a penguin but you can enable other icons if you edit the sketch

drawBitmap_kbv shows the GFX methods as well as the hardware pushColors() method.

It is always wise to start with library examples. Experiment and adapt for your purposes.
Quote the library example that is giving you a problem.

David.

I apologize to David here who has already explained something, but for me it is still unclear how I should connect (Pins) a SPI Beakout card, as in the attached link, to an Arduino, either Uno or Mega, or even ESP.

If anyone can enlighten me, I would be very grateful.

Link: https://www.ebay.com/itm/3-5-inch-480-320-SPI-Serial-TFT-LCD-Module-Display-Screen-Driver-IC-ILI9488/192714343868?var=492856453212

This thread is about MCUFRIEND parallel Shields
Your question is about a 3.3V Red SPI display
Please ask questions on appropriate threads.

ESP32:
connect TFT_SCK, T_SCK, SD_SCK to GPIO18
connect TFT_SDI, T_SDI, SD_MOSI to GPIO23
connect TFT_SDO, T_SDO, SD_MISO to GPIO19 (omit TFT_SDO for ILI9488)
connect TFT_RST to any GPIO pin
connect TFT_DC to any GPIO pin    (sometimes called TFT_RS or TFT_A0)
connect TFT_CS to any GPIO pin
connect T_CS to any GPIO pin
connect SD_CS to any GPIO pin

ESP8266:
connect TFT_SCK, T_SCK, SD_SCK to D13
connect TFT_SDI, T_SDI, SD_MOSI to D11   (sometimes called TFT_MOSI)
connect TFT_SDO, T_SDO, SD_MISO to D12 (omit TFT_SDO for ILI9488)
connect TFT_RST to any GPIO pin
connect TFT_DC to any GPIO pin    (sometimes called TFT_RS or TFT_A0)
connect TFT_CS to any GPIO pin
connect T_CS to any GPIO pin
connect SD_CS to any GPIO pin

Make sure that you configure correctly in User_Setup.h

I strongly advise to just copy Bodmer's TFT_eSPI default wiring.

Regarding Uno or Mega. This requires using level shifters. Probably too complex for you.

David.

Hi David, thanks for the quick reply!

You say: "Make sure that you set up correctly in User_Setup.h"

But, I'm referring to the MCUFRIEND_kbv library (which doesn't have User_Setup.h)

You say, "Regarding Uno or Mega. This requires using level shifters. Probably too complex for you."

Yes, I already made this kind of connection, so to finish, what would the pins on Uno or Mega look like?

Could you give me an example of how it looks in the constructor for both Uno/Mega and ESP?

Thank you one more time

PS: If you feel it is not good to answer me here, could you link to the appropriate topic?

the output of TFT_support


tft.readID() finds: ID = 0x8A28
MCUFRIEND_kbv version: 2.9.8
This ID is not supported

the output of LCD_ID_readreg


reg(0x0000) 8A 28 ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 08 08 08 08 Manufacturer ID
reg(0x0009) 08 08 08 08 08 Status Register
reg(0x000A) 08 08 Get Power Mode
reg(0x000C) 08 08 Get Pixel Format
reg(0x0061) 08 08 RDID1 HX8347-G
reg(0x0062) 08 08 RDID2 HX8347-G
reg(0x0063) 08 08 RDID3 HX8347-G
reg(0x0064) 08 08 RDID1 HX8347-A
reg(0x0065) 08 08 RDID2 HX8347-A
reg(0x0066) 08 08 RDID3 HX8347-A
reg(0x0067) 08 08 RDID Himax HX8347-A
reg(0x0070) 2F 08 Panel Himax HX8347-A
reg(0x00A1) 08 08 08 08 08 RD_DDB SSD1963
reg(0x00B0) 08 08 RGB Interface Signal Control
reg(0x00B4) 08 08 Inversion Control
reg(0x00B6) 08 08 08 08 08 Display Control
reg(0x00B7) 08 08 Entry Mode Set
reg(0x00BF) 08 08 08 08 08 08 ILI9481, HX8357-B
reg(0x00C0) 08 08 08 08 08 08 08 08 08 Panel Control
reg(0x00C8) 08 08 08 08 08 08 08 08 08 08 08 08 08 GAMMA
reg(0x00CC) 08 08 Panel Control
reg(0x00D0) 08 08 08 Power Control
reg(0x00D2) 08 08 08 08 08 NVM Read
reg(0x00D3) 08 08 08 08 ILI9341, ILI9488
reg(0x00D4) 08 08 08 08 Novatek ID
reg(0x00DA) 08 08 RDID1
reg(0x00DB) 08 08 RDID2
reg(0x00DC) 08 08 RDID3
reg(0x00E0) 08 08 08 08 08 08 08 08 08 08 08 08 08 08 08 08 GAMMA-P
reg(0x00E1) 08 08 08 08 08 08 08 08 08 08 08 08 08 08 08 08 GAMMA-N
reg(0x00EF) 08 08 08 08 08 08 ILI9327
reg(0x00F2) 08 08 08 08 08 08 08 08 08 08 08 08 Adjust Control 2
reg(0x00F6) 08 08 08 08 Interface Control

how can I solve this??? i'm using an Arduino UNO.

Please post a link to the actual shield that you have bought e.g. Ebay sale
Or post a photo of the pcb side of the Shield.

Are you using a Uno ?

David.

Yes, I am using a Uno.
Please find enclosed two photos showing the front and the rear of the Shield. Thanks!!

The good news is that you have an AMS1117 regulator on the pcb. (chip at bottom right)
The bad news is that I have no idea what the TFT controller is.

I can only suggest that you try tft.begin(0x9320);
i.e. edit setup() in graphictest_kbv example

Please report back.
If no success, ask the shop for a full refund.

This will encourage the shop to ask their supplier what controller is mounted.
And I can support it properly. i.e. the shop will have happy customers !!!

David.