Arduino Forum

Products => Arduino Due => Topic started by: Dimdim on Dec 02, 2012, 11:59 pm

Title: TFT library compatible with Due?
Post by: Dimdim on Dec 02, 2012, 11:59 pm
I have been using the UTFT library on the older Arduinos but it is not yet compatible with the Due so I am kind of stuck..

Has anyone managed to interface a TFT with the Due?
Title: Re: TFT library compatible with Due?
Post by: jake1981 on Dec 05, 2012, 04:42 pm
Yes, but you need to get itdb02_32s display and mega shield for it from iteadstudio.com, these sources are compatible with that display and propably only with that display, other than 16bit modes are removed and this library only supports arduino due as I replaced and removed code, instead of just making it compatible with due along others. But here's a library, examples work "as is" with mega pins chosen on utft init..

Oh, one more thing.. You need to apply this patch:
https://github.com/cmaglie/Arduino/commit/74dea07f2c7e977bacf5c61f7e8502609b285dbb
Title: Re: TFT library compatible with Due?
Post by: jake1981 on Dec 05, 2012, 04:51 pm
Yeah, the library should be cleaned up.. It's a bit messy.. But this is a great starting point for everyone needing a display for due..

Here's one more thing, when using samples (or doing your own) - you need to change bitmap definitions a bit to make it work.. For example, tux.c in UTFT_Rotate_Bitmap example:

Code: [Select]

// Generated by  : ImageConverter 565 v1.0
// Generated from: tux.png
// Time generated: 11.10.2010 22:51:32
// Size          : 2 048 Bytes

//#include <avr/pgmspace.h>

const unsigned int tux[0x400] = {
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xE73C, 0x9CD3, 0x9CF3, 0xA514,   // 0x0010 (16)


it should start like this..
comment out #include <avr/pgmspace.h>
and change variable definition to:
const unsigned int varname[size] = {
Title: Re: TFT library compatible with Due?
Post by: amolinero on Dec 06, 2012, 12:42 am
Hello.
I adapted the library for Arduino DUE. I also added a method to paint buttons, I added some new parameters to several methods, and have optimized several loops gaining some speed.
I've only tested on a 480x272 screen with SSD1963.
I have not tried the method LCD_Writ_Bus to 8 bits.

I was sent to the developer UTFT, but if you want to have before, you can download from the following link http://www.piensayactua.com/tmp/UTFT.rar (http://www.piensayactua.com/tmp/UTFT.rar)

greetings
Title: Re: TFT library compatible with Due?
Post by: Dimdim on Dec 06, 2012, 01:15 am
Wow, this is some very interesting stuff!

I have several TFTs here, I will do some testing and report back.

You guys are great! :)
Title: Re: TFT library compatible with Due?
Post by: jake1981 on Dec 06, 2012, 09:54 am
I have also got UTFT_tinyFat ported, although - it uses sdfat instead of tinyfat because I was interested in higher speeds provided by DMA and.. Well, actually.. Code was already complete, so I decided to use it..

In HW_AVR_defines.h you need to make one change:
#define bitmapdatatype uint16_t*

instead of unsigned int*

--- Updates ---

My UTFT now ships with picojpeg and comes with function that can load and display a jpeg file from SD..

I will put it here later.. It's not good implementation.. But works..
Title: Re: TFT library compatible with Due?
Post by: jake1981 on Dec 07, 2012, 04:31 pm
I started using amolinero's version of UTFT, tested it and it works with my ITDB02-3.2S display on itdb02 mega shield.
Haven't checked out amolinero's sources yet, so cannot say anything about it. Didn't notice significant speed ups, but I was drawing a jpeg on screen, so there's propably other reasons for slowliness..

Here's my UTFT_tinyFat - actually, it should be UTFT_SDFAT.. Get SDFAT from this forum/sdfat site (version that supports due).. And tweak the spi speed up..

To get it working, it needs to be connected to icsp header, so you need header spacers and some 2x3 icd connectors with ribbon cable (cut out cs pin and connect it to pin 52)..

image files folder is missing from my package, grab it from original utft_tinyfat package..

---
Here's a sample code for displaying jpeg..

Code: [Select]



#include <SdFat.h>
#include <UTFT.h>
#include <UTFT_tinyFAT.h>
#include <picojpeg.h>
#include <UTFT_picojpeg.h>

// SD chip select pin
const uint8_t chipSelect = SS;

UTFTtf myGLCD(ITDB32S, 38, 39, 40, 41);   // Remember to change the model parameter to suit your display module!

// file system
SdFat sd;


void setup()
{
  Serial.begin(9600);
  while (!Serial){}  // wait for Leonardo
  Serial.println();

  myGLCD.InitLCD();
  myGLCD.clrScr();
 
  if (!sd.begin(chipSelect, SPI_FULL_SPEED)) sd.initErrorHalt();

  loadJpeg(myGLCD, "image15.jpg");
 
}

void loop()
{
}


display's image15.jpg from root of SD.. Check out picojpeg - it doesn't support all jpegs..
And my routine isn't foolproof - there's not that much checking so beware to disappoint :)

Or improve it..
Title: Re: TFT library compatible with Due?
Post by: jake1981 on Dec 07, 2012, 04:35 pm
One more thing.. Henning's utouch library (support for touch screen) works out of the box on due..

So now we have initial support for touchscreens with sd slots for due.
Title: Re: TFT library compatible with Due?
Post by: Dimdim on Dec 10, 2012, 12:42 am
I have tried amolinero's version of the UTFT library with my ITDB32WD display with great results, as you can see in the attachment.

(http://arduino.cc/forum/index.php?action=dlattach;topic=135341.0;attach=31109;image)

Tomorrow I will also try it with my own code and see if everything also runs OK.
Title: Re: TFT library compatible with Due?
Post by: baltasar on Dec 10, 2012, 11:33 pm
Me and alvesjc already ported UTFT from Henning Karlsen last month and send it to him as his the original author so he can do what feels like with that DUE version of UTFT library.

Anyway the basic info regarding the ports to change is on this post again from alvesjc:
http://arduino.cc/forum/index.php/topic,130714.msg1013319.html#msg1013319
Title: Re: TFT library compatible with Due?
Post by: Markus_L811 on Dec 11, 2012, 08:53 am

I have tried amolinero's version of the UTFT library with my ITDB32WD display with great results, as you can see in the attachment.

(http://arduino.cc/forum/index.php?action=dlattach;topic=135341.0;attach=31109;image)

Tomorrow I will also try it with my own code and see if everything also runs OK.



How did you wire it up?

Did it work proper with 3.3V Logic?
Title: Re: TFT library compatible with Due?
Post by: Dimdim on Dec 11, 2012, 09:27 am
I wired it up according to UTFT's documentation, adapting it to the specific TFT. It was not difficult. I should point out that it is an ITDB32WD compatible display that I got off of ebay, and not an ITead original.

The display works natively with 3.3V logic (I had to use resistors to use it with the older Arduinos) so it is actually easier to interface to the Due than to older Arduinos.

Here's a little video of it in action:

http://www.youtube.com/watch?v=S1ghut1rR7I
Title: Using the 8 bit ITDB28 model
Post by: liquidice007 on Dec 13, 2012, 04:25 am
Hello Folks,
I have the ITDB28 (2.8" with Touchscreen, Uno Shield pin layout). Here is the product link if anyone is curious:
http://imall.iteadstudio.com/im120417020.html

I would like to use it with my Due, unfortunately the Due modifications I have run across only work with the 16bit models. Could anyone give me some pointers for getting it running in 8 bit mode?

Much appreciated!
Title: Re: TFT library compatible with Due?
Post by: Dimdim on Dec 13, 2012, 04:34 pm
This should work just fine, it's just that the level converters will be redundant since the Due's logic is already 3.3V. It should be OK though.
Title: Re: TFT library compatible with Due?
Post by: liquidice007 on Dec 13, 2012, 04:51 pm

This should work just fine, it's just that the level converters will be redundant since the Due's logic is already 3.3V. It should be OK though.



Oh, I'm not worried about the board's electrical compatibility, its just that the current Due modifications to the UTFT Library only work with the 16 bit models of LCD. I am curious what I would need to modify in the library to get my 8 Bit LCD running properly.
Title: Re: TFT library compatible with Due?
Post by: Dimdim on Dec 13, 2012, 04:58 pm
I'm sorry, there seems to be a mixup.. I was replying to a post that now appears to be gone (it was regarding a shield that simplified wiring a TFT to a MEGA). :(
Title: Re: TFT library compatible with Due?
Post by: liquidice007 on Dec 13, 2012, 05:02 pm

I'm sorry, there seems to be a mixup.. I was replying to a post that now appears to be gone (it was regarding a shield that simplified wiring a TFT to a MEGA). :(


Ah, no problem :)
Title: Re: TFT library compatible with Due?
Post by: Markus_L811 on Dec 13, 2012, 08:26 pm

I'm sorry, there seems to be a mixup.. I was replying to a post that now appears to be gone (it was regarding a shield that simplified wiring a TFT to a MEGA). :(

Yes that was me, my post and I killed the post in hurry klicked the wrong button.

I found this Shield http://imall.iteadstudio.com/development-platform/arduino/shields/im120417024.html (http://imall.iteadstudio.com/development-platform/arduino/shields/im120417024.html) that works with Boards with 3.3V or 5V so it would make it easy to use an TFT with the UTFT Lib and dimdim's modifications. So you have the tft and the touch function together.
Title: Re: TFT library compatible with Due?
Post by: alvesjc on Dec 14, 2012, 01:23 am
Hi.

Speaking about speed in UTFT, would be nice to do some comparison.

We have two distinct situations.

With ITDB32WD I get 32s, with ITDB32WC my friend get 29,5s

Here is our code running in the ITDB32WC

http://youtu.be/-hWRFVth1iQ (http://youtu.be/-hWRFVth1iQ)


By the way, how do I set the youtube link to directly display the movie here?
Title: Re: TFT library compatible with Due?
Post by: alvesjc on Dec 15, 2012, 01:01 am

I am curious what I would need to modify in the library to get my 8 Bit LCD running properly.


Hi.

I've included code for 8 bit mode.

Replace (doing backup of your current file) the HW_ARM.h file in your library with the one attached with your IDE closed.

I don't have a display to test it, but should work, try it! ;)

Regards,

Joao
Title: Re: TFT library compatible with Due?
Post by: liquidice007 on Dec 15, 2012, 05:52 am


I am curious what I would need to modify in the library to get my 8 Bit LCD running properly.


Hi.

I've included code for 8 bit mode.

Replace (doing backup of your current file) the HW_ARM.h file in your library with the one attached with your IDE closed.

I don't have a display to test it, but should work, try it! ;)

Regards,

Joao


Thank you, I will give this a try and let you know how it goes.
Title: Re: TFT library compatible with Due?
Post by: liquidice007 on Dec 15, 2012, 07:40 pm


I am curious what I would need to modify in the library to get my 8 Bit LCD running properly.


Hi.

I've included code for 8 bit mode.

Replace (doing backup of your current file) the HW_ARM.h file in your library with the one attached with your IDE closed.

I don't have a display to test it, but should work, try it! ;)

Regards,

Joao


Ok, replaced the file and modified the demo code with this:

UTFT myGLCD(ITDB28,59,58,57,56);

Where 59-56 are the Due hardware pins corresponding to RST,CS,WR,RS

Unfortunately this did not work and I am still left with only a backlight on my LCD.
Title: Re: TFT library compatible with Due?
Post by: alvesjc on Dec 17, 2012, 02:03 am
Hummm, ok.

I don't understand why then, it should work, I'm using the same pins as in 16bit mode for the high port.

Without one to test, I can't move forward, sorry.

Regards,

Joao
Title: Re: TFT library compatible with Due?
Post by: Markus_L811 on Dec 17, 2012, 09:18 pm

One more thing.. Henning's utouch library (support for touch screen) works out of the box on due..

So now we have initial support for touchscreens with sd slots for due.

Henning's utouch library works without any changes.
Title: Re: TFT library compatible with Due?
Post by: Markus_L811 on Dec 19, 2012, 09:03 am

I wired it up according to UTFT's documentation, adapting it to the specific TFT. It was not difficult. I should point out that it is an ITDB32WD compatible display that I got off of ebay, and not an ITead original.

The display works natively with 3.3V logic (I had to use resistors to use it with the older Arduinos) so it is actually easier to interface to the Due than to older Arduinos.


Did someone has an benchmark from the lib between oldone on mega how fast is it?

I try to convert the UFT Clock from Henning Karlsen to work with the Due http://henningkarlsen.com/electronics/p_utft_analog_clock.php (http://henningkarlsen.com/electronics/p_utft_analog_clock.php). But my Calender is blinking the clock is working proper.
Title: Re: TFT library compatible with Due?
Post by: pYro_65 on Dec 19, 2012, 10:43 pm
Did someone has an benchmark from the lib between oldone on mega how fast is it?


I don't use the UTFT library, but I have a sainsmart TFT shield with a mega using an SSD1289. I'm interested to see how it compares to the Due implementation.

An easy, but important test is clearing the screen. To be able to present games flicker free, the clear operation needs to be one of the fastest.
I have achieved a rate of 51fps for a clear screen operation on a mega 2560, this is in a loop clearing to a random colour.

It will be interesting to see how well the Due performs in this basic operation.
Title: Re: TFT library compatible with Due?
Post by: thatdude624 on Dec 23, 2012, 10:57 am


I don't use the UTFT library, but I have a sainsmart TFT shield with a mega using an SSD1289.
I have achieved a rate of 51fps for a clear screen operation on a mega 2560, this is in a loop clearing to a random colour.

then what Library are you using? I also have a Mega and a TFT display, but it takes about a second to clear the screen! I would love to have it run faster!

also, I hope this gets noticed by the creator of the UTFT library, who wants to port it to the Due but can't because he doesn't yet own one. I guess this would make porting a whole lot easier.
Title: Re: TFT library compatible with Due?
Post by: Markus_L811 on Dec 23, 2012, 04:56 pm

Yeah, the library should be cleaned up.. It's a bit messy.. But this is a great starting point for everyone needing a display for due..

Here's one more thing, when using samples (or doing your own) - you need to change bitmap definitions a bit to make it work.. For example, tux.c in UTFT_Rotate_Bitmap example:

Code: [Select]

// Generated by  : ImageConverter 565 v1.0
// Generated from: tux.png
// Time generated: 11.10.2010 22:51:32
// Size          : 2 048 Bytes

//#include <avr/pgmspace.h>

const unsigned int tux[0x400] = {
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xE73C, 0x9CD3, 0x9CF3, 0xA514,   // 0x0010 (16)


it should start like this..
comment out #include <avr/pgmspace.h>
and change variable definition to:
const unsigned int varname[size] = {


Seems not working for me only geht an white screen
Title: Re: TFT library compatible with Due?
Post by: Markus_L811 on Dec 23, 2012, 05:06 pm

Yes, but you need to get itdb02_32s display and mega shield for it from iteadstudio.com, these sources are compatible with that display and propably only with that display, other than 16bit modes are removed and this library only supports arduino due as I replaced and removed code, instead of just making it compatible with due along others. But here's a library, examples work "as is" with mega pins chosen on utft init..

Oh, one more thing.. You need to apply this patch:
https://github.com/cmaglie/Arduino/commit/74dea07f2c7e977bacf5c61f7e8502609b285dbb


Now it works, sorry missed the patch.

Happy X-Mas
Title: Re: TFT library compatible with Due?
Post by: pYro_65 on Dec 24, 2012, 02:03 pm

then what Library are you using? I also have a Mega and a TFT display, but it takes about a second to clear the screen! I would love to have it run faster!


I'm having a go at building my own driver, the mainstream libraries are too slow for games and interactivity. They all suffer a similar overhead with respect to being portable between uC's and compatible with multiple devices. Whereas I've targeted my code directly to the 2560 and the display. I'll post the code on the forums eventually.
Title: Re: TFT library compatible with Due?
Post by: psteve on Dec 25, 2012, 06:15 pm
Quote
I'm having a go at building my own driver, the mainstream libraries are too slow for games and interactivity. They all suffer a similar overhead with respect to being portable between uC's and compatible with multiple devices. Whereas I've targeted my code directly to the 2560 and the display. I'll post the code on the forums eventually.


Very interesting a faster code ... Do you can post it Here???

Many thanks & Merry Christmas

Steve
Title: Re: TFT library compatible with Due?
Post by: pYro_65 on Jan 01, 2013, 04:19 pm

Quote
I'm having a go at building my own driver, the mainstream libraries are too slow for games and interactivity. They all suffer a similar overhead with respect to being portable between uC's and compatible with multiple devices. Whereas I've targeted my code directly to the 2560 and the display. I'll post the code on the forums eventually.


Very interesting a faster code ... Do you can post it Here???

Many thanks & Merry Christmas

Steve


I'll probably post the code in the display forum. If you would like to see its current performance, I have posted a video here: http://arduino.cc/forum/index.php/topic,140111.0.html

I'll also post any info on the library there. Remember my info was for a Mega 2560, not the Due. Although I guess its a good reference to see what we can expect at a minimum from the Due.
Title: Re: TFT library compatible with Due?
Post by: Adrculda on Jan 12, 2013, 04:53 pm
Hey guys...
Anyone tried the ITDB02-5.0 Touch TFT ??

Just wondering as I'm working on a DSP/DAC project and arduino due is the controller of choice running the Hifiduino code for now until I learn how to code.
Title: Re: TFT library compatible with Due?
Post by: evmaker on Jan 15, 2013, 03:03 am
If any one has a nice library that would work on a 240 by 320 with touch screen i sure would like it .


I have been poking around with it and sort of have the one from seedstudio working, The library would like to just write the data to the register but the due registers are all in different places in due so i made it digital read and digital write. Lots of overhead and poor performance. Was quite shocked it sort of worked at all. The touch screen was not at all hard to make work, but the tft is a nightmare.
Title: Re: TFT library compatible with Due?
Post by: kamil_szczepan on Jan 18, 2013, 12:13 am


Anyone tried the ITDB02-5.0 Touch TFT ??
i got 5 on it ;)
Its slow like my EX girl ;)

http://www.youtube.com/watch?v=u4U6vxT_m9k
Title: Re: TFT library compatible with Due?
Post by: alvesjc on Jan 18, 2013, 02:24 am

If any one has a nice library that would work on a 240 by 320 with touch screen i sure would like it .


Hi.

This is working for a long time, at least for 16bit mode.

You have attached the library, it's the Henning Karlsen library that I've adapted to DUE.

This has already posted in a old post, but here it goes.

Regards.
Title: Re: TFT library compatible with Due?
Post by: pdwyer on Jan 20, 2013, 10:13 pm
Thank you for your post about the Karlsen library.  I have installed the library and the examples compile without error.  However, I get nothing on my SainsSmart 3.2" 320x240 display which uses the SSD1289 driver.  I looked at the code samples and they are for the "uno" and "mega" boards (comment in/out appropriate myGLCD statements).  I presume the numbers assigned by myGLCD are pin specific for each processor.  I do not see any examples with the pins for the DUE board (SAM3E processor).  I tried the "mega" example" and I get nothing on my screen.  Does anyone know what the pin numbers for the DUE are?  If not, do anyone know what these pins are for (e.g., name, function) so I can look them up in the SAM3E datasheet?  Any other suggestions for getting started would be appreciated.  Thank you! 
Title: Re: TFT library compatible with Due?
Post by: alvesjc on Jan 20, 2013, 10:52 pm
Hi!

Have you completed the correct initialization to the library?

For SSD1289, you have to init with "TFT01_32".

The line:

UTFT myGLCD(ITDB32S,38,39,40,41);

should look like:

UTFT myGLCD(TFT01_32,38,39,40,41);

Don't forget to read the "UTFT_Supported_display_modules_&_controllers.pdf" file.

The pinout used is the same from mega.

Regards,

Joao

Title: Re: TFT library compatible with Due?
Post by: pdwyer on Jan 23, 2013, 12:46 am
Thank you very much!  I will try this tomorrow.  Patrick
Title: Re: TFT library compatible with Due?
Post by: Quequi on Mar 27, 2018, 04:03 pm
I have been using the UTFT library on the older Arduinos but it is not yet compatible with the Due so I am kind of stuck..

Has anyone managed to interface a TFT with the Due?
Hi everyone,

This is my first interaction in the forum.

For the incial subject, YOU CAN USE A MEGA TFT shield (al least, this one http://qqtrading.com.my/32-inch-lcd-tft-screen-for-arduino-mega-2560-shield-compatible) with the  Arduino DUE, even use the UTFT and the SdRaw librarys.

You'll need the following library (modifyded for the DUE) for laod images:

https://github.com/Bodmer/SdFat

There is no problem with the voltage's change (5 to 3.3). May be there some stability problem, but I don't found any.

Sorry for my english, I'm from Argentina.

Regards,

Ezequiel (QW)