That's great news, rick!
I'm also interested in using it with the Due, is the display's speed(writing pixels) same as the Uno or faster?
I'm also wondering what do you usually have to change to make it work with Due ? just pin mapping or it also involves writing more function to control the Due controller?
2.8" TFT Touchscreen Shield and Arduino Due?
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- raikenkun
- Posts: 3
- Joined: Mon Aug 19, 2013 1:39 am
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: 2.8" TFT Touchscreen Shield and Arduino Due?
I don't really know - I don't have any sort of a benchmark. There's a bit more overhead involved in writing to the GPIO ports, especially in the case of the shield - the bit mapping is all over the place, and I have to individually shift and mask each bit. With the breakout, I'll be able to select a single port with a contiguous bit mapping.raikenkun wrote:I'm also interested in using it with the Due, is the display's speed(writing pixels) same as the Uno or faster?
I don't have the tftbmp_shield example working yet. Once that's going, it will clearly demonstrate any speed differences. It didn't want to read my SD card - that's something else I'll have to work out.
The bit mapping is the biggest change. Direct use of port registers and other hardware-dependent features is another challenge. Arduino could help with some of that, but they don't as yet. For instance, references to PROGMEM, use of the F("") macro, etc., have to be dealt with by defining empty macros. The compiler could do that. They could also create empty versions of AVR include files. Things like that.raikenkun wrote:I'm also wondering what do you usually have to change to make it work with Due ? just pin mapping or it also involves writing more function to control the Due controller?
The closer the code is to plain, vanilla Arduino, the easier it is to port. The TouchScreen driver was optimized to directly twiddle bits in the output registers. I had to change those back to digitalWrite calls.
The nastiest problems will be timing related - for instance, the pulse-width on the read strobe was too narrow because of the faster CPU speed. However, it worked in Atmel Studio because I was compiling a debug version - that stretched the timing out enough so that it worked.
Other nasty problems are inherent assumptions about how the hardware works. The touch screen driver was initializing a digital pin to INPUT, then setting the pin to LOW, which was the old way of disabling the internal pullup. Later on, it changed the pin to OUTPUT, and expected that the pin would still be LOW. That works on AVRs, but it didn't work on the Due. It took me a while to find that. The fix was to explicitly set the pin LOW after setting the pinMode to OUTPUT.
- raikenkun
- Posts: 3
- Joined: Mon Aug 19, 2013 1:39 am
Re: 2.8" TFT Touchscreen Shield and Arduino Due?
Well I guess nothing works from the first time , those nasty problems can screw up your time schedule of any project. but great work overall !
I'll be sure to keep my mind on those issues, Thanks !
looking forward for release/alpha !
I'll be sure to keep my mind on those issues, Thanks !
looking forward for release/alpha !
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: 2.8" TFT Touchscreen Shield and Arduino Due?
I've created a "Due" branch on github for the Due version of the TFTLCD library.
The tftpaint example doesn't work, because I haven't put in the breakout-board support yet.
But the tftpaint_shield example works for me.
https://github.com/adafruit/TFTLCD-Library/tree/Due
The tftpaint example doesn't work, because I haven't put in the breakout-board support yet.
But the tftpaint_shield example works for me.
https://github.com/adafruit/TFTLCD-Library/tree/Due
- John_Rickey
- Posts: 2
- Joined: Tue May 21, 2013 2:45 pm
Re: 2.8" TFT Touchscreen Shield and Arduino Due?
Hi Rick,
I'm glad to hear the library now works with the Due. One thing I'm not clear on is whether you also got the SD library working with these mods.
I'm glad to hear the library now works with the Due. One thing I'm not clear on is whether you also got the SD library working with these mods.
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: 2.8" TFT Touchscreen Shield and Arduino Due?
Sorry - not yet. I've got a breakout on order- once I get it I'll try to work out the SD issues on that so I don't have to mess around with jumpering SPI on my shield.John Rickey wrote:Hi Rick,
I'm glad to hear the library now works with the Due. One thing I'm not clear on is whether you also got the SD library working with these mods.
-
- Posts: 74
- Joined: Thu Feb 20, 2014 5:36 pm
Re: 2.8" TFT Touchscreen Shield and Arduino Due?
Any news about ?
Im thinking in buy an Arduino DUE and i want to use tft 2.8 touch shield with, is it possible ?
Im thinking in buy an Arduino DUE and i want to use tft 2.8 touch shield with, is it possible ?
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: 2.8" TFT Touchscreen Shield and Arduino Due?
The 2.8" Touchscreen Shield and SD works with the Due.
- scott_fx
- Posts: 26
- Joined: Wed Jan 18, 2012 7:30 pm
Re: 2.8" TFT Touchscreen Shield and Arduino Due?
Was there a speed improvement over the mega? Also, do you need a logic level shifter or can the shield plug right into the due?
thank you for the due implementation! can't wait for the 2.8" to arrive!
thank you for the due implementation! can't wait for the 2.8" to arrive!
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: 2.8" TFT Touchscreen Shield and Arduino Due?
A logic level shifter is a good idea on the MISO line.
There is some speed improvement, but not a lot.
There is some speed improvement, but not a lot.
-
- Posts: 18
- Joined: Sun Jun 24, 2012 12:08 am
Re: 2.8" TFT Touchscreen Shield and Arduino Due?
Hi!
I got one of the 3.5" touchscreens and got some code working brilliantly on an Uno... but then I tried to also use the SD card and now everything is broken. I think it's simply using up all of the onboard RAM, because doing things like commenting out the SD library header makes it work better.
So I tried to set it up on a Due I have handy, since the added power should make it work more reliably. But, the touchscreen library won't compile!
This is the error I get, using the Adafruit_GFX, Adafruit_HX8357, and TouchScreen libraries, which certainly looks like the same port twiddling stuff that's described here. Any hope of getting this to work, or am I stuck with AVR chips?
I got one of the 3.5" touchscreens and got some code working brilliantly on an Uno... but then I tried to also use the SD card and now everything is broken. I think it's simply using up all of the onboard RAM, because doing things like commenting out the SD library header makes it work better.
So I tried to set it up on a Due I have handy, since the added power should make it work more reliably. But, the touchscreen library won't compile!
This is the error I get, using the Adafruit_GFX, Adafruit_HX8357, and TouchScreen libraries, which certainly looks like the same port twiddling stuff that's described here. Any hope of getting this to work, or am I stuck with AVR chips?
Code: Select all
In file included from /home/neltnerb/downloads/software/arduino-1.5.8/hardware/arduino/sam/variants/arduino_due_x/pins_arduino.h:20:0,
from /home/neltnerb/Dropbox/Stim24Ch/libraries/TouchScreen/TouchScreen.cpp:6:
/home/neltnerb/Dropbox/Stim24Ch/libraries/TouchScreen/TouchScreen.cpp: In member function 'TSPoint TouchScreen::getPoint()':
/home/neltnerb/downloads/software/arduino-1.5.8/hardware/arduino/sam/variants/arduino_due_x/variant.h:62:65: error: invalid conversion from 'Pio*' to 'uint8_t {aka unsigned char}' [-fpermissive]
#define digitalPinToPort(P) ( g_APinDescription[P].pPort )
^
/home/neltnerb/Dropbox/Stim24Ch/libraries/TouchScreen/TouchScreen.cpp:57:21: note: in expansion of macro 'digitalPinToPort'
uint8_t xp_port = digitalPinToPort(_xp);
^
/home/neltnerb/downloads/software/arduino-1.5.8/hardware/arduino/sam/variants/arduino_due_x/variant.h:62:65: error: invalid conversion from 'Pio*' to 'uint8_t {aka unsigned char}' [-fpermissive]
#define digitalPinToPort(P) ( g_APinDescription[P].pPort )
^
/home/neltnerb/Dropbox/Stim24Ch/libraries/TouchScreen/TouchScreen.cpp:58:21: note: in expansion of macro 'digitalPinToPort'
uint8_t yp_port = digitalPinToPort(_yp);
^
/home/neltnerb/downloads/software/arduino-1.5.8/hardware/arduino/sam/variants/arduino_due_x/variant.h:62:65: error: invalid conversion from 'Pio*' to 'uint8_t {aka unsigned char}' [-fpermissive]
#define digitalPinToPort(P) ( g_APinDescription[P].pPort )
^
/home/neltnerb/Dropbox/Stim24Ch/libraries/TouchScreen/TouchScreen.cpp:59:21: note: in expansion of macro 'digitalPinToPort'
uint8_t xm_port = digitalPinToPort(_xm);
^
/home/neltnerb/downloads/software/arduino-1.5.8/hardware/arduino/sam/variants/arduino_due_x/variant.h:62:65: error: invalid conversion from 'Pio*' to 'uint8_t {aka unsigned char}' [-fpermissive]
#define digitalPinToPort(P) ( g_APinDescription[P].pPort )
^
/home/neltnerb/Dropbox/Stim24Ch/libraries/TouchScreen/TouchScreen.cpp:60:21: note: in expansion of macro 'digitalPinToPort'
uint8_t ym_port = digitalPinToPort(_ym);
^
/home/neltnerb/downloads/software/arduino-1.5.8/hardware/arduino/sam/variants/arduino_due_x/variant.h:65:44: error: base operand of '->' is not a pointer
#define portOutputRegister(port) ( &(port->PIO_ODSR) )
^
/home/neltnerb/Dropbox/Stim24Ch/libraries/TouchScreen/TouchScreen.cpp:73:4: note: in expansion of macro 'portOutputRegister'
*portOutputRegister(yp_port) &= ~yp_pin;
^
/home/neltnerb/downloads/software/arduino-1.5.8/hardware/arduino/sam/variants/arduino_due_x/variant.h:65:44: error: base operand of '->' is not a pointer
#define portOutputRegister(port) ( &(port->PIO_ODSR) )
^
/home/neltnerb/Dropbox/Stim24Ch/libraries/TouchScreen/TouchScreen.cpp:74:4: note: in expansion of macro 'portOutputRegister'
*portOutputRegister(ym_port) &= ~ym_pin;
^
/home/neltnerb/downloads/software/arduino-1.5.8/hardware/arduino/sam/variants/arduino_due_x/variant.h:65:44: error: base operand of '->' is not a pointer
#define portOutputRegister(port) ( &(port->PIO_ODSR) )
^
/home/neltnerb/Dropbox/Stim24Ch/libraries/TouchScreen/TouchScreen.cpp:82:4: note: in expansion of macro 'portOutputRegister'
*portOutputRegister(xp_port) |= xp_pin;
^
/home/neltnerb/downloads/software/arduino-1.5.8/hardware/arduino/sam/variants/arduino_due_x/variant.h:65:44: error: base operand of '->' is not a pointer
#define portOutputRegister(port) ( &(port->PIO_ODSR) )
^
/home/neltnerb/Dropbox/Stim24Ch/libraries/TouchScreen/TouchScreen.cpp:83:4: note: in expansion of macro 'portOutputRegister'
*portOutputRegister(xm_port) &= ~xm_pin;
^
/home/neltnerb/downloads/software/arduino-1.5.8/hardware/arduino/sam/variants/arduino_due_x/variant.h:65:44: error: base operand of '->' is not a pointer
#define portOutputRegister(port) ( &(port->PIO_ODSR) )
^
/home/neltnerb/Dropbox/Stim24Ch/libraries/TouchScreen/TouchScreen.cpp:98:5: note: in expansion of macro 'portOutputRegister'
*portOutputRegister(xp_port) &= ~xp_pin;
^
/home/neltnerb/downloads/software/arduino-1.5.8/hardware/arduino/sam/variants/arduino_due_x/variant.h:65:44: error: base operand of '->' is not a pointer
#define portOutputRegister(port) ( &(port->PIO_ODSR) )
^
/home/neltnerb/Dropbox/Stim24Ch/libraries/TouchScreen/TouchScreen.cpp:102:5: note: in expansion of macro 'portOutputRegister'
*portOutputRegister(yp_port) |= yp_pin;
^
/home/neltnerb/downloads/software/arduino-1.5.8/hardware/arduino/sam/variants/arduino_due_x/variant.h:65:44: error: base operand of '->' is not a pointer
#define portOutputRegister(port) ( &(port->PIO_ODSR) )
^
/home/neltnerb/Dropbox/Stim24Ch/libraries/TouchScreen/TouchScreen.cpp:121:5: note: in expansion of macro 'portOutputRegister'
*portOutputRegister(xp_port) &= ~xp_pin;
^
/home/neltnerb/downloads/software/arduino-1.5.8/hardware/arduino/sam/variants/arduino_due_x/variant.h:65:44: error: base operand of '->' is not a pointer
#define portOutputRegister(port) ( &(port->PIO_ODSR) )
^
/home/neltnerb/Dropbox/Stim24Ch/libraries/TouchScreen/TouchScreen.cpp:125:5: note: in expansion of macro 'portOutputRegister'
*portOutputRegister(ym_port) |= ym_pin;
^
/home/neltnerb/downloads/software/arduino-1.5.8/hardware/arduino/sam/variants/arduino_due_x/variant.h:65:44: error: base operand of '->' is not a pointer
#define portOutputRegister(port) ( &(port->PIO_ODSR) )
^
/home/neltnerb/Dropbox/Stim24Ch/libraries/TouchScreen/TouchScreen.cpp:129:5: note: in expansion of macro 'portOutputRegister'
*portOutputRegister(yp_port) &= ~yp_pin;
^
Error compiling.
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: 2.8" TFT Touchscreen Shield and Arduino Due?
I modified the Touchscreen library to work with the Due. Replace the touchscreen library with this one and restart the IDE
-
- Posts: 18
- Joined: Sun Jun 24, 2012 12:08 am
Re: 2.8" TFT Touchscreen Shield and Arduino Due?
Thanks so much, I was having a hard time following the thread. Wonderful news!
An earlier poster asked about graphics update rate. I happen to have just switched from rending a full bitmap from an UNO microSD card image to the Due. Load time went from roughly 6 seconds to roughly 5 seconds. I think both devices are using the same SPI frequency (I'm going to look into this since this is really slow) of 4MHz.
Not entirely sure where the bottleneck is, but loading 320x480 24-bit values is a minimum of 922 ms at 4MHz SPI, and writing the translated 320x480 16-bit values back to the LCD is another 614 ms for a total theoretical best speed of 1.5 seconds. I see 5-6 seconds in practice.
I'm not sure if the extra overhead is the translation math. It is a bit strange to me that the Due, with it's 16-bit math built in, doesn't do this vastly more quickly than the AVR chip. So I guess it's not the math. Not sure what it is then though. A simple clear screen takes the same ~600ms on both Due and UNO boards. Maybe the microSD card driver has a lot of overhead.
An earlier poster asked about graphics update rate. I happen to have just switched from rending a full bitmap from an UNO microSD card image to the Due. Load time went from roughly 6 seconds to roughly 5 seconds. I think both devices are using the same SPI frequency (I'm going to look into this since this is really slow) of 4MHz.
Not entirely sure where the bottleneck is, but loading 320x480 24-bit values is a minimum of 922 ms at 4MHz SPI, and writing the translated 320x480 16-bit values back to the LCD is another 614 ms for a total theoretical best speed of 1.5 seconds. I see 5-6 seconds in practice.
I'm not sure if the extra overhead is the translation math. It is a bit strange to me that the Due, with it's 16-bit math built in, doesn't do this vastly more quickly than the AVR chip. So I guess it's not the math. Not sure what it is then though. A simple clear screen takes the same ~600ms on both Due and UNO boards. Maybe the microSD card driver has a lot of overhead.
- bkuehner
- Posts: 14
- Joined: Sun Jan 09, 2011 8:19 pm
Re: 2.8" TFT Touchscreen Shield and Arduino Due?
In case anyone finds this thread while looking for info on using the captouch/TFT shield, I was able to use it with the current standard libraries. The only thing I had to do was the standard ICSP modification. After that, everything worked fine.
I did the following:
1) Solder the ICSP jumpers (and cut the other "11/12/13" jumpers)
2) Download the ILI9341, graphics core, and FT6206 (cap touch) libraries from the links here:
https://learn.adafruit.com/adafruit-2-8 ... phics-test
and here:
https://learn.adafruit.com/adafruit-2-8 ... paint-demo
3) Installed the libraries via the usual "Sketch/Import Library/Add Library" menu
4) Loaded the "File/Examples/Adafruit FT6206 Library/CapTouchPaint" example code
5) Compiled and uploaded to the Due
I did the following:
1) Solder the ICSP jumpers (and cut the other "11/12/13" jumpers)
2) Download the ILI9341, graphics core, and FT6206 (cap touch) libraries from the links here:
https://learn.adafruit.com/adafruit-2-8 ... phics-test
and here:
https://learn.adafruit.com/adafruit-2-8 ... paint-demo
3) Installed the libraries via the usual "Sketch/Import Library/Add Library" menu
4) Loaded the "File/Examples/Adafruit FT6206 Library/CapTouchPaint" example code
5) Compiled and uploaded to the Due
Please be positive and constructive with your questions and comments.