Go Down

Topic: MCUFRIEND_kbv Library for Uno 2.4, 2.8, 3.5, 3.6, 3.95 inch mcufriend Shields (Read 188101 times) previous topic - next topic

copet_pitik

You should have a difference of about 800 between LEFT and RIGHT.   20 is wrong.   Tyoical values are 920 and 140.

If the Serial is open during the calibration,   look at the values that are printed for each cross-hair.

as i posted before, here are the result from the calibration sketch:

1st Try
Code: [Select]

cx=895 cy=665
cx=894 cy=841
cx=896 cy=980
cx=556 cy=833
cx=549 cy=983
cx=256 cy=859
cx=212 cy=918
cx=236 cy=981


2nd Try
Code: [Select]

cx=890 cy=672
cx=883 cy=853
cx=881 cy=979
cx=551 cy=833
cx=554 cy=983
cx=243 cy=851
cx=225 cy=916
cx=208 cy=986


so, is it hardware related problem?


Quote
Did you change the NUMSAMPLES in Touchscreen.cpp?   The Touchscreen library is not very reliable.
no, i haven't change anything in the Touchscreen library.


Quote
Copy-paste your Serial Terminal.   It might give some clues.   I am still surprised by the 56.   Every good Touch Panel shows 25 - 35 when I run the diagnosis.
Sorry, my TS is in my Lab and i am in my dorm. I will report it to you tomorrow.

nug
Program Studi Instrumentasi Medis
Politeknik Mekatronika Sanata Dharma
Yogyakarta Indonesia

david_prentice

Your cx values look fine.  e.g. Portrait mode.  LEFT is consistently about 884.  RIGHT is about 220.
Your cy values are odd.   TOP appears to be average of  {665, 833, 859, 672, 833, 851}.  BOT is about 983.

Clearly the Y value are complete pants.   But you did have 1500R instead of the ~ 360R that I would expect.
Remember the unusual ADC value from the Y diagnosis.

Does the glass have any cracks?
Have you put it in an enclosure that presses against the Touch Panel?

It sounds to me as if you have a faulty Touch Panel.  Ask for your money back.
There are plenty of non-Touch projects that you can use it for.

The X seems to be working fine.   Note that the LEFT=884 and RIGHT=220 correspond to the cross-hairs.

This is my output from my new weird ILI9488-555 Shield.
Code: [Select]

TouchScreen.h 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
Testing : (A2, D6) = 32
Diagnosing as:-
XM,XP:  (A1, D7) = 23
YP,YM:  (A2, D6) = 32

cx=881 cy=922
cx=885 cy=520
cx=885 cy=122
cx=519 cy=923
cx=533 cy=118
cx=150 cy=923
cx=161 cy=531
cx=155 cy=116
PORTRAIT CALIBRATION     320 x 480
x = map(p.x, LEFT=907, RT=130, 0, 320)
y = map(p.y, TOP=939, BOT=100, 0, 480)
Touch Pin Wiring XP=7 XM=A1 YP=A2 YM=6

The calibration sketch compensates for the gap between screen edge and crosshair.  e.g. cx=883 is adjusted to LEFT=907.

David.

copet_pitik

Your cx values look fine.  e.g. Portrait mode.  LEFT is consistently about 884.  RIGHT is about 220.
Your cy values are odd.   TOP appears to be average of  {665, 833, 859, 672, 833, 851}.  BOT is about 983.

Clearly the Y value are complete pants.   But you did have 1500R instead of the ~ 360R that I would expect.
Remember the unusual ADC value from the Y diagnosis.

Does the glass have any cracks?
Have you put it in an enclosure that presses against the Touch Panel?
Yes, the Y values and ADC reading of A1-D7 are a mess. I just want to make sure, that the problem because of the hardware. not the code. There are so many library for this touchscreen out there that make me confuse where should i use.

there is no cracks in the touchscreen. no enclosure above the touch panel, i already peel the plastic. i think it is okay to peel the plastic.


Quote
It sounds to me as if you have a faulty Touch Panel.  Ask for your money back.
There are plenty of non-Touch projects that you can use it for.
The X seems to be working fine.   Note that the LEFT=884 and RIGHT=220 correspond to the cross-hairs.
That is what i've been looking for, expert opinion.   :) 
Actually i have 2 TS, this one and the other one is already broken (detected by your newest calibration sketch).


Quote
This is my output from my new weird ILI9488-555 Shield.
Code: [Select]

TouchScreen.h 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
Testing : (A2, D6) = 32
Diagnosing as:-
XM,XP:  (A1, D7) = 23
YP,YM:  (A2, D6) = 32

cx=881 cy=922
cx=885 cy=520
cx=885 cy=122
cx=519 cy=923
cx=533 cy=118
cx=150 cy=923
cx=161 cy=531
cx=155 cy=116
PORTRAIT CALIBRATION     320 x 480
x = map(p.x, LEFT=907, RT=130, 0, 320)
y = map(p.y, TOP=939, BOT=100, 0, 480)
Touch Pin Wiring XP=7 XM=A1 YP=A2 YM=6

The calibration sketch compensates for the gap between screen edge and crosshair.  e.g. cx=883 is adjusted to LEFT=907.
yes, i love your newest update of your calibration sketch.
if i may make requests for the next update:
- add a LANDSCAPE CALIBRATION in the Serial Monitor
- Make a simple example how to draw a button and when it pressed, the button will gives any output to the LCD or Serial Monitor (like this one: https://www.youtube.com/watch?v=WNs0V3VX68Y). This will help a newbie like me a lot to understand this complex library and library's example.

Thank you.
Best Regards,
_nug.
Program Studi Instrumentasi Medis
Politeknik Mekatronika Sanata Dharma
Yogyakarta Indonesia

david_prentice

@_nug,

Just do the Calibration in landscape mode.   It displays both Portrait and Landscape values.

I think that I will default to Portrait for the sketch.   But display both results  (like in landscape mode).

David.

copet_pitik

@_nug,

Just do the Calibration in landscape mode.   It displays both Portrait and Landscape values.

I think that I will default to Portrait for the sketch.   But display both results  (like in landscape mode).

David.
Okay,
Thank you for your help, David!
:Cheers:  :D
Program Studi Instrumentasi Medis
Politeknik Mekatronika Sanata Dharma
Yogyakarta Indonesia

david_prentice

I have updated the sketch attached to #1607.
Please comment.

David.

romel

Hello !

I have an 2,8 TFT display with UNO. The shield is HX8347G and the ID 0x9595. I try with all the library , included mcufriend.kbv 2.9.6. Into the list of shield suported for last one library, this combination is not mentioned. Did you have some other solutions, please ?

david_prentice

The HX8347-G has an ID = 0x7575.  So you have not got a HX8347G.

From the extras/mcufriend_how_to.txt:

10. It currently supports UNO shields with "mcufriend.com" pcbs with controllers:
HX8347-A 240x320  ID=0x8347 #define SUPPORT_8347A *** Untested ***
HX8347-D 240x320  ID=0x4747 #define SUPPORT_8347D
HX8347-G 240x320  ID=0x7575 #define SUPPORT_8347D
HX8347-I 240x320  ID=0x9595 #define SUPPORT_8347D
HX8352-A 240x400  ID=0x5252 #define SUPPORT_8352A
HX8357-B 320x480  ID=0x8357 (shares init with 8357-D)
HX8357-D 320x480  ID=0x9090 (ID has changed from 0x8357)
HX8367-A 240x320  ID=0x6767 #define SUPPORT_8347D
ILI9302  240x320  ID=0x9302
ILI9320  240x320  ID=0x9320
ILI9325  240x320  ID=0x9325
ILI9326  240x400  ID=0x9326 #define SUPPORT_9326_5420
ILI9327  240x400  ID=0x9327
ILI9328  240x320  ID=0x9328
ILI9329  240x320  ID=0x9329
ILI9331  240x320  ID=0x9331
ILI9335  240x320  ID=0x9335
ILI9338  240x320  ID=0x9338
ILI9340  240x320  ID=0x9340
ILI9341  240x320  ID=0x9341
ILI9481  320x480  ID=0x9481 
ILI9486  320x480  ID=0x9486
ILI9487  320x480  ID=0x9488
ILI9488  320x480  ID=0x9488 (weird 555 display :#define SUPPORT_9488_555)
LGDP4532 240x320  ID=0x4532 #define SUPPORT_4532
LGDP4535 240x320  ID=0x4535 #define SUPPORT_4535
NT35310  320x480  ID=0x5310 (hardware must be set for 8-bit parallel)
R61505   240x320  ID=0x1505 (not working)
R61505V  240x320  ID=0xB505
R61505W  240x320  ID=0xC505
R61509V  240x400  ID=0xB509 #define SUPPORT_B509_7793
R61520   240x320  ID=0x1520 (no Vertical Scroll)
R61526A  240x320  ID=0x1526 (no Vertical Scroll) configure NVM with sketch
R61580   240x320  ID=0x1580 #define SUPPORT_1580 *** Untested ***
R61581   320x480  ID=0x1581
RM68090  240x320  ID=0x6809
RM68140  320x480  ID=0x6814 #define SUPPORT_68140
S6D0139  240x320  ID=0x0139 #define SUPPORT_0139 *** Untested ***
S6D0154  240x320  ID=0x0154 #define SUPPORT_0154
SPFD5408 240x320  ID=0x5408
SPFD5420 240x400  ID=0x5420 #define SUPPORT_9326_5420
SSD1963  800x480  ID=0x1963
SSD1289  240x320  ID=0x1289 #define SUPPORT_1289
ST7781   240x320  ID=0x7783 #define SUPPORT_7781 (no Vertical Scroll)
ST7789V  240x320  ID=0x7789
ST7793   240x400  ID=0x7793 #define SUPPORT_B509_7793
ST7796   320x480  ID=0x7796
UC8230   240x320  ID=0x8230 #define SUPPORT_8230
UNKNOWN  320x480  ID=0x1511 (scroll directions not correct)
UNKNOWN  240x320  ID=0x1602
UNKNOWN  240x320  ID=0xAC11

Most of these controllers are #define SUPPORT_xxxx by default.
You can save Flash memory on a Uno by commenting out the macro(s) in MCUFRIEND_kbv.cpp



As far as I know,   there are no other libraries that support a HX8347-I
However,   you do need to enable the #define SUPPORT_8347D

David.

Ega6226

You have a Himax HX8347-I controller with ID=0x9595.

Install or Update the current v2.9.6 MCUFRIEND_kbv with the Library Manager.

Read the mcufriend_how_to.txt file.
#define SUPPORT_8347D

David.
Thank you all perfect. I have tried all the examples that come with the library and I work all except the SD, do not recognize it.

The example uses the SdFat library, in the configuration I have put pin 10 and nothing.

any ideas?

Thanks

david_prentice

The official <SD.h> library that came with your IDE will definitely work with a Uno.    Currently it is broken for Mega2560.

Third Party <SdFat.h> library will probably work with Uno, Mega, Due, ...
But you will have to say which particular Third Party <SdFat.h> and where you got it from.

The example shows you how to use a Third Party <SdFat.h>
With BMP files on a specified path called "bitmaps/"
And matching any ".bmp" files that have "tiger" in the name.

The SD.h library uses more SRAM than the SdFat.h library.   So on a Uno,  you should reduce the PALETTEDEPTH.   Since 24-bit BMP files do not use a Colour Palette,  the Palette capability is not required.

Yes,   it would probably be wiser to just supply a bog-standard example: "display one 24-bit BMP file located in the root directory" on a Uno.

David.

Ega6226

Hi,

I'm testing with the sketch showBMP_kbv_as7 that comes in the library MCUFRIEND_kbv-2.9.6.

The result of the monitor is as follows:


Show BMP files on TFT with ID:0x9595
cannot start SD

I have tried several examples with the same result.

Thanks

david_prentice

Which Arduino do you have?

I am going to put some more "bog-standard" examples on GitHub.  Possibly this evening if you are prepared to test them.

SD.h should work fine with Uno.

For all the other models:
Make sure that you have installed the current version v1.0.1 of SdFat.h via the Library Manager.
Enable the Software SPI if you are using Mega2560, Leonardo, Due, ...

Make sure that your SD card works with the SD or SdFat library examples first.

David.


Ega6226

Hi,

I have installed SdFat-1.0.1 library.



I have run the SdInfo example, the result is:

Error: cardBegin failed
SD errorCode: 0X20,0X0

david_prentice


Go Up