Hi all:

re :

I though the above library would solve my problems but it doesn’t appear to

I’ll explain

I have a 3.2" 9341 QVT 9341 16 bit parallel with mega shield - I’m using the UTFT library but apart from the modified library in the link above, the UTFT library doesn’t support the 9341 in parallel mode - so the suggestions I’ve found in this forum are :

1/ kludge by defining it as an ILI 9327 (ITDB32WC etc)

2/ modify a 9386 driver file to suit (seems it’s a closer fit with registers than the 9327)

The 9386 driver works after a fashion, but the display is off screen and the colours are out

Apparently it’s necessary to modify the screen size - I don’t know how to go about that

So I’m using kludge 1 including modifying the second value in the dsy array in UTFT.cpp to 319 from 399 (ref

Using this gets the screen working - however after many goes at calibrating the screen and then running the paint program - the drawn pixels are way off (both x and y) and appear to me to be still acting as though the screen is a 240x400 (even though the 9327 is actually 432 not 400) and not 240x320

So I check the modified library in the link above and it seems that although there is now an entry for the 9341_16, it is a straight copy of the 9327 driver - so nothing changes - it seems to just be a formalised version of kludge 1

eg - the x coord value returned (myTouch.getX()) at/near the top of the screen is 395

And when I load a sketch designed for a 1289 (240x320) why does it map OK with text and graphics

So I map out buttons to suit a 240x320 display : eg x-band limit (X>=120 && x<=170) compile and run it and it appears OK and the button presses work but the x-coodinate returned at the top of the band is 212, (=170x400/320) and the top of the screen is 393??

So it’s scaling a sketch to 400, displaying it on a 320 screen and returning 400 coordinates ??!! - It has to be related to the kludge - changing the 399 value to 319 in the UTFT.cpp file

Any help will be welcome

As a side issue (but a very annoying one), this screen regularly ceases the touchscreen function after uploads and switch ons - I suspect power issues (it’s on a shield)

Does anyone else have this issue

So I’m at a loss to know what exactly is going on and how to overcome these issues apart from finding another screen


I have no idea what modified library you are using.

I would guess that TFTLCDCyg had done everything correctly to support ILI9341 in 16-bit parallel.
Many people have the TFT 320 QVT 9341 shield.

I do not have the shield. Nor have I looked at TFTLCDCyg's modified library.

If you have a serious issue, please quote the actual lines or mods that worry you.
I am sure that TFTLCDCyg will reply.

Yes, there are all sorts of "kludging" suggestions. Mr Karlsen does not want to update the UTFT library.
Some of the suggestions are practical. Some are crazy.
I have never come across a "9386"


Hi David - thanks for the reply

9386 should read 9486

I’m using the library from the link quoted in the my post - namely “

This library adds directory 16B to the ‘old’ 9341 library which only contained serial drivers s4p and s5p

In the 16B directory are the two files “initlcd.h” and “setxy.h” as normal

I did a side by side comparison with the same two files from the ILI9327 directory and they are identical.

The UTFT.h file in the updated library contains the line “#define ILI9341_16 33”

The size entry in the corresponding location (33) in the UTFT.cpp file “word dsy” array is 319

word dsy = {319, 319, 319, 319, 319, 319, 219, 219, 399, 159, 127, 319, 479, 799, 319, 319, 319, 0, 0, 319, 799, 479, 319, 219, 159, 319, 319, 479, 479, 479, 159, 159, 319, 319};

Given that the drivers are for different chips and screen sizes, I can’t understand how they can be identical - hence my feeling that this updated library is still kludging a 9327

I attach the library files fro your perusal and comment


9327-initlcd.h (2.65 KB)

9327-setxy.h (284 Bytes)

9341_16-initlcd.h (2.66 KB)

9341_16-setxy.h (287 Bytes)

MEGA and ILI9341 bad combination.

Due and ILI9341 it´s a good team.

I don´t have a TFT of 40-pin, but I have a TFT of 34-pin, of 3.2", with a homemade shield, on arduino Due.

The key: the Utouch-calibration requires a stylo-pen more precise.


1 Erase the previous UTFT library

2 Install the UTFT-modified.

3 Run the calibration sketch, with stylo pen more precise (in order to get "the triplet-cal")

4 Save the triplet-cal at the end of the UtouchCD.h file

Test: output touch-XY


// 3.2" 16B ILI9341 ---->June-2016, Due
#define CAL_X 0x00488E7FUL
#define CAL_Y 0x03D14149UL
#define CAL_S 0x000EF13FUL

Video: Touch-test


Thanks for the reply - it's great to be offered support when frustrations occur :slight_smile:

I was using a stylus for the calibration - I'd done many prior to my post -and I'd tried trial and error adjustments -

As suggested I used a stylo pen and I still get different X&Y calibration values every time - even though when viewed on a white screen, my dots are spot on together..

However, after multiple trials I settled on the best one - It still maps low in the X direction but I don't know how to fix that - I tried tricking the calibration test by picking the top edge of the top X box but that failed miserably

Thanks for the coord test - the max X figure I can get is 303 !!

Is there some way to adjust the X value only ??

And if possible can you please advise :

1/ Why you believe "MEGA and ILI9341 bad combination."

2/ Why the files I posted for the 9327 and the 9341 are the same despite the drivers being different sizes

3/ As mentioned in my first post, why sketches are mapping to suit a 320 screen but when the get(X) result is displayed in the serial monitor it shows X coords up to 393

Thanks again

Well I tested enough to determine the coordinate problem lay with the calibration but I couldn't get a solution to yield the correct x value so I resorted to writing a scaling function based on the selected trical value - it works so I guess in the end that' all I want it to do

Thanks David and TFTLCDCyg