Go Down

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

david_prentice

I have installed the regular SAMD Core i.e. for Arduino Zero

The IDE Boards Manager does not seem to know about "Metro" or "Grand Central".
The Adafruit link does not seem to have any "Board installer"

If you can find the necessary Board,   I can post a test Branch on GitHub for me to compile and you to test.

David.

kaleun96

I added the board via Platformio (Atom) but there are some instructions by Adafruit for doing it via the IDE.

Specifically, add "Arduino SAMD Boards" and "Adafruit SAMD". If you don't see the Adafruit option in the board manager, you may need to add this URL to your preferences first:
Quote
https://adafruit.github.io/arduino-board-index/package_adafruit_index.json

david_prentice

Please try the "test_grand_central" Branch on GitHub.

Please continue communication via GitHub Issues.   Or Pull Request.

David.

kaleun96

Thanks David, I will take a look after work and get back to you on GitHub.


-Cam

AmitSingh_Eng

I have been working on TFT screen with mcufriend library, everything was good, i ordered 50 2.4" TFT screen but this new lot has some issue, the ID is 0x0000 attached is the output from your example. Do we have any solution for this or support for this?

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

david_prentice

Several people have bought these.  reg(0xD3)=0x3229.   If they don't work,  you should ask for your money back.

I presume that the controllers will work 100% but might require some configuration.
None of the "owners" are prepared to test them.    They do not want to ask for their money back either.

Since no one wants to test,   I have ordered one from aliexpress using the same "shop" as one of the "owners".

The item has not been despatched after 6 days.   They "promise" 7 days.

There is no guarantee that I will get the same shield as you.   (Or if anything arrives at all)

If an owner wants to mail an 0x3229 to me,   I will send them a working shield.
This is only practical for someone in the UK or Europe.   i.e. fast postage,  cheap postage.

David.

AmitSingh_Eng

Thank you for your response, I am based on India I can give you TeamViewer access for your testing purpose. I can order the same but the problem is we can't be sure that the product is the same.

AmitSingh_Eng

The screen has Sky024s18a-96 10c 2018/07/21 DXT 
and 0x3229 is not working.

robbyr

Hello all!

Does anyone know of a list of "best practices" for ironclad touch programming? Using Atmega1284 with Kuman 3.5" 320x480 ILI9486 UNO shield, and MCUFriend Special (thanks David!).

About 1/2 the time, a button in another part of the screen is activated rather than the one I touched.  My buttons are about 13mm high and 45mm wide with about 3mm between buttons, so I don't think size is an issue when a button 50mm vertically away is activated.

AND

Sometimes I have hangs/locks caused by a button press.   freeRam() never shows any less than 14K, so I don't think it's a heap/stack problem.

Do you need to check if the display is busy before writing to it?
Do you need to add extra debouncing measures to Adafruit's TouchScreen.h? 
I'm also wondering about over-sampling --- I tried increasing Ada's NUMSAMPLES default but to no avail.

Thanks for any assistance/ideas/patsontheback,
robbyr

david_prentice

First off.    Run the Calibration sketch.    Copy-paste the Serial Terminal to your message.

Does Touch_Shield_new follow the stylus perfectly?

With any Touch you will get the occasional false point.    Annoying with a "Paint" sketch.    But it shows up false or inaccurate points.

With most projects you can just take multiple Touch readings.    Only accept steady values.    Just like you debounce a typewriter keyboard or pushbutton.

If the library example sketches work 100% but your sketch does not,   paste or attach your project.    i.e. buildable code.

Only use libraries that are approved by the IDE Library Manager.    (which reports versions, update etc)
Then your sketch can be built by anyone in the world.

David.

robbyr

David,

Calibration results posted below.  Nothing happens with the upper left '+' until I drag the stylus to the lower right corner of the surrounding box.  I've seen this mentioned somewhere, but no solutions were given.

Touch_shield_new seems to track just fine --- although I can't tell about that upper left corner

Thanks


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 : (A2, D8) = 23
Testing : (A3, D9) = 33
Diagnosing as:-
XM,XP:  (A2, D8) = 23
YP,YM:  (A3, D9) = 33
ID = 0x9486

cx=180 cy=920 cz=204 LEFT, TOP, Pressure
cx=166 cy=528 cz=400 LEFT, MIDH, Pressure
cx=160 cy=114 cz=591 LEFT, BOT, Pressure
cx=525 cy=922 cz=300 MIDW, TOP, Pressure
cx=527 cy=113 cz=592 MIDW, BOT, Pressure
cx=879 cy=910 cz=433 RT, TOP, Pressure
cx=885 cy=522 cz=548 RT, MIDH, Pressure
cx=886 cy=119 cz=657 RT, BOT, Pressure
MCUFRIEND_kbv ID=0x9486  320 x 480

const int XP=8,XM=A2,YP=A3,YM=9; //320x480 ID=0x9486
const int TS_LEFT=144,TS_RT=906,TS_TOP=934,TS_BOT=97;
PORTRAIT CALIBRATION     320 x 480
x = map(p.x, LEFT=144, RT=906, 0, 320)
y = map(p.y, TOP=934, BOT=97, 0, 480)
Touch Pin Wiring XP=8 XM=A2 YP=A3 YM=9
LANDSCAPE CALIBRATION    480 x 320
x = map(p.y, LEFT=934, RT=97, 0, 480)
y = map(p.x, TOP=906, BOT=144, 0, 320)

david_prentice

Your Calibration looks normal.   You have LEFT=180,166,160 and TOP=920,922,910.   So I suspect that the an accurate LEFT_TOP would be [166,920]

Quote
Calibration results posted below.  Nothing happens with the upper left '+' until I drag the stylus to the lower right corner of the surrounding box.  I've seen this mentioned somewhere, but no solutions were given.

Touch_shield_new seems to track just fine --- although I can't tell about that upper left corner
Please be specific.   
When you draw with the stylus,  does the spot follow within 1mm ?   
Do you have a missing area at TOP_LEFT_CORNER ?
Do you get random dots ?

Think about it.   I am in a different country.   You must describe what you see.   Because I can't see it.

David.

WillemII

Hello David,

I do have a problem that a lot of users have to. I bought two TFT shields from different sellers. One is according the id a 0x9340, that shows the adres http://mcufriend.com, the other one
a 0x9341, just says 2.4" TFT LCD SHIELD. I'm running both on the same UNO R3 with the same libary MCUFriend_kbv. the one with the ID 0x9341 shows everything fine, the one with the ID 0x9340
has complementary colors, exact as the bits says. Black 0x0000 shows White 0xFFFF Blue is 0x001F shows Yellow FFED and so one. That only happens on the MCUFriend_kbv libary.
Using the Elegoo_TFTLCD libary there is no problem, everything looks ok.
I'm using Arduino IDE 1.8.10 with the last libaries since I have also problems with the Adafruit libaries.
The nice one is that I just remove the USB connector, change only the shield and that above happens. I do not loading any new programs or something else, only power down, change shields
and power up again. Also all BMPs showing the same effect.

Willem

david_prentice

Shields can be assembled from a different batch of Panels.

If your 9341 shows correct colours and 9340 shows inverted colours edit MCUFRIEND_kbv.c
Code: [Select]

    case 0x9340:                //ILI9340 thanks Ravi_kanchan2004 and valmor_jr
        _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | READ_24BITS | REV_SCREEN;
        goto common_9341;
    case 0x9341:
        _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | READ_24BITS;
      common_9341:


Remove the REV_SCREEN attribute.

Before you edit any files,   check the IDE Library Manager.   MCUFRIEND_kbv should be version v2.9.8

David.

WillemII

Hello David,

Thanks a lot for the fast replay. It works, after two weeks of angry, helpless, doubt in my mind it was fixed within 2 min.

 :)  :)  :)  Thanks again

Willem

Go Up