JimmyBT
Posts: 3
Joined: Sun Sep 15, 2013 6:37 pm

Re: 2.8" TFT + Touch Shield Board

Wed Sep 18, 2013 8:37 pm

Hey Texy,

I've been working through trying to get Kivy to work with the touchscreen, but to no avail. Someone suggested that for a touchscreen to work with Kivy, it must, at the very least, broadcast the following touchscreen events:

Code: Select all

ABS_MT_TRACKING_ID
ABS_MT_POSITION_X
ABS_MT_POSITION_Y
However using evtest, I only see these events:

Code: Select all

 Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 330 (BTN_TOUCH)
  Event type 3 (EV_ABS)
    Event code 0 (ABS_X)
      Value      0
      Min      230
      Max     3850
    Event code 1 (ABS_Y)
      Value      0
      Min      190
      Max     3850
    Event code 24 (ABS_PRESSURE)
      Value      0
      Min        0
      Max      255
I am thinking I need to either rewrite using a different framework, or try a different screen, but was hoping to get you expert opinion first :D

Thank again for your help

advancetom
Posts: 2
Joined: Mon Jan 21, 2013 5:08 pm

Re: 2.8" TFT + Touch Shield Board

Thu Sep 19, 2013 4:29 pm

Hello today im get my TFT and have to say nice work...
but it works now and im happy too.
Nice work and nice conversation with Texy was also very good.

Working Display pic attached:
http://sdrv.ms/1575azP

:D :shock:

araczkowski
Posts: 4
Joined: Tue Aug 27, 2013 8:41 pm

Re: 2.8" TFT + Touch Shield Board

Sat Sep 21, 2013 3:27 pm

My problem is the touch panel is reversed. Screen orientation is correct. When I touch left/right the cursor moves correctly. Up/down are reversed. I have tweaked screen orientation and such but no luck. Just stays the same.?
I have the same problem -> shield v1b and Raspberry PI model A.
I'm able to rotate the screen but touch is always reversed :(
Any suggestion?

texy
Forum Moderator
Forum Moderator
Posts: 5160
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: 2.8" TFT + Touch Shield Board

Sun Sep 22, 2013 5:37 am

This us in X11, right? Not my python test program?
Are you able to upload an image if your sd card somewhere for me to download and try it?
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

NeillyThere
Posts: 7
Joined: Thu Jul 25, 2013 12:41 pm
Location: England, UK

Re: 2.8" TFT + Touch Shield Board

Sun Sep 22, 2013 8:23 am

An update on my ongoing inverted Y axis saga:

A very brief reminder of my situation:
I installed Rasbian (2013-07-26), followed Texy's instructions and all worked fine, including in X11 (no Y axis problem) - This was about the 13th of September (Friday 13th :evil: ). A day or two later I started experiencing the problem with the Y axis being incorrectly inverted (when moving up the cursor goes down & vice-versa). I checked my settings and that I still had all of Texy's modifications, installed. I confirmed that all worked properly (Y axis was normal) outside of X, and that the problem was specifically related to X11.

I started again from a fresh install of Raspbian (2013-07-26) and this time the problem Y-axis was present from the start (unlike the delay of a day or so from the initial install). I also tried a clean install of the latest Raspbian (2013-09-10) with the same result :- a duff Y axis. Just in case I had a dodgy SD card, I repeated the exercise again on a brand new unused card - no difference, still a stuffed Y axis.

So something in the distributions must have changed between about the 12th and the 14th September! There are only two real points at which Texy's instructions 'update' any system components (unless i'm mistaken):
  • 1. The installation of the replacement kernel,
    2. The installation of xinput.
Of course xinput is actively used by the configuration of the TFT and Touchscreen, so do we have a smoking gun?

xinput sets attributes for the touchscreen (or other devices), specifically 'Evdev Axis Inversion' 0 1 to Invert the Y axis, in this case. I confirmed that xinput does seem to set the property correctly (e.g. by subsequent xinput -list). So the next element in the chain is evdev when it tries to configure the touchscreen to work with X11. By examining the logs it appears evdev doesn't see the property telling it to Invert the Y-axis. Having scanned the source code for evdev it does check for the relevant values, but they don't appear to be set when/where it looks. So it would never invert the axis (nor the X axis, for that matter).

I did a quick one word modification to evdev to coerce it to invert the Y axis, and hey presto the touchscreen works properly.

In the original version we have:

pEvdev->invert_y = xf86SetBoolOption(pInfo->options, "InvertY", FALSE);

which sets the InvertY property to whatever the value of "InvertY" is within the pInfo->options structure, or to FALSE if a value for "InvertY" is not found. All i did was change the FALSE to TRUE, so it becomes:

pEvdev->invert_y = xf86SetBoolOption(pInfo->options, "InvertY", TRUE);

(Actually I did make some other changes but they were to examine the various pInfo->options that evdev was seeing).
This fiddle is of course not a proper solution, its merely a proof of concept. I am currently digging to try and find how and where the Axis inversion gets lost in the chain of events...

(to be continued, unless some bright spark has a proper solution)

texy
Forum Moderator
Forum Moderator
Posts: 5160
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: 2.8" TFT + Touch Shield Board

Sun Sep 22, 2013 8:40 am

Hey good work ;) So the evdev source code needs modifying and recompiling? It would be useful to others if some instructions to do this were posted.
Cheers,
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

araczkowski
Posts: 4
Joined: Tue Aug 27, 2013 8:41 pm

Re: 2.8" TFT + Touch Shield Board

Sun Sep 22, 2013 1:04 pm

Hi,

in my case it's on X11 too.
If you would like to reproduce the issue you can download a image of my sd card, is on this url: http://cwms.pl/20130922.7z
(1,08 GB img is compressed via 7z - hope that this will be ok for you)

to reproduce the problem:
1. boot PI on this distro and display connected directly to the GPIO
2. calibrate -> sudo TSLIB_FBDEVICE=/dev/fb1 TSLIB_TSDEVICE=/dev/input/event0 ts_calibrate
3. startx -> FRAMEBUFFER=/dev/fb1 startx -- -dpi 60


thanks in advance for your support

BTW
Texy you did amazing work!
I'm trying to use the display with my project -> RoughPi* :)
*mobile barcode scanner based on Raspberry Pi

dorarosi
Posts: 2
Joined: Sun Sep 22, 2013 6:43 pm

Re: 2.8" TFT + Touch Shield Board

Sun Sep 22, 2013 6:50 pm

Test TEst

NeillyThere
Posts: 7
Joined: Thu Jul 25, 2013 12:41 pm
Location: England, UK

Re: 2.8" TFT + Touch Shield Board

Mon Sep 23, 2013 11:39 am

The X11 Y-axis problem - a simple solution!

If you've got the problem with the Y-axis being inverted (it goes up as you move down, or vice-versa), a simple solution is as follows:

Using your preferred text editor with sudo (or root access) edit usr/share/X11/xorg.conf.d/10-evdev.conf
It contains configuration details for evdev (that which handles the touchscreen). You'll note that the file is divided into several (5) sections following the comment block at the top. Each section beginning with the word Section and ending with the word EndSection (yes it is obvious but ...). One of those sections, most probably the last one will be:

Code: Select all

Section "InputClass"
        Identifier "evdev touchscreen catchall"
        MatchIsTouchscreen "on"
        MatchDevicePath "/dev/input/event*"
        Driver "evdev"
EndSection
before that EndSection insert a new line:

Option "InvertY" "true"

So the section now reads:

Code: Select all

Section "InputClass"
        Identifier "evdev touchscreen catchall"
        MatchIsTouchscreen "on"
        MatchDevicePath "/dev/input/event*"
        Driver "evdev"
        Option "InvertY" "true"
EndSection
Save the file and try starting X11 again.

I've successfully tested this on both the 2013-07-26 and 2013-09-10 versions of Raspbian.

So hopefully problem solved.

texy
Forum Moderator
Forum Moderator
Posts: 5160
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: 2.8" TFT + Touch Shield Board

Mon Sep 23, 2013 12:20 pm

Fantastic - well done. One assumes different configs of either

Code: Select all

        Option "InvertY" "true"
or

Code: Select all

        Option "InvertX" "true"
Will be required for the other orientations.
Thanks for sharing ;)

Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

araczkowski
Posts: 4
Joined: Tue Aug 27, 2013 8:41 pm

Re: 2.8" TFT + Touch Shield Board

Mon Sep 23, 2013 8:44 pm

Hi :)

I can confirm - it works.

thanks you all!

btw
in my case -> portrait
I did this:

Code: Select all

Section "InputClass"
        Identifier "evdev touchscreen catchall"
        MatchIsTouchscreen "on"
        MatchDevicePath "/dev/input/event*"
        Driver "evdev"
        Option "SwapAxes" "True"
        Option "GrabDevice" "True"
EndSection

mpl
Posts: 34
Joined: Sun Aug 12, 2012 6:14 pm

Re: 2.8" TFT + Touch Shield Board

Sun Sep 29, 2013 9:25 am

Where can i get this tft?

texy
Forum Moderator
Forum Moderator
Posts: 5160
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: 2.8" TFT + Touch Shield Board

Sun Sep 29, 2013 9:51 am

mpl wrote:Where can i get this tft?
...only from me ;-)
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

chr1s
Posts: 2
Joined: Sun Sep 29, 2013 12:08 pm

Re: 2.8" TFT + Touch Shield Board

Sun Sep 29, 2013 12:45 pm

Hello texy,

I received one of the screens some days ago. I tried to install it like described here, but unfortunately I faced several problems. First problem evolved when I added the lines
"fbtft_device name=hy28a rotate=270
ads7846_device pressure_max=255 y_min=190 y_max=3850 gpio_pendown=17 x_max=3850 x_min=230 x_plate_ohms=100 swap_xy=1 verbose=3"
to etc/module. dmesg says "190 invalid for parameter y_min".

also when I tried "sudo TSLIB_FBDEVICE=/dev/fb1 TSLIB_TSDEVICE=/dev/input/event0 ts_calibrate" it says "sudo: ts_calibrate: command not found". I am using USB-Keyboard an mouse so I tried with event1 as well, but didn't change anything. So I commented out the touchscreen in /etc/modules and tried to first get TFT running as all the problems seem to come from the touchscreen. But when I run the python program, it only opens a new window and draws the colour stripes in it. Nothing to see on the TFT (it's black so initialization seemed to work). I tried to run the script directly logged in on the board (have a beamer attached to the chinch) and via remote desktop. The fb_tft seems to be installed correctly, but I have the feeling that output is not routed correctly. I tried with fb0 and fb1 in the python script (both listet in the system). Same outcome. Any Ideas? About my background: I'm an experienced programmer, but new to Linux.
Thanks for your help!

texy
Forum Moderator
Forum Moderator
Posts: 5160
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: 2.8" TFT + Touch Shield Board

Sun Sep 29, 2013 5:04 pm

Hi chr1s,
sorry you've been having problems. The world of raspberry pi and it's software is ever changing, so it is possible that something has 'broken' recently.
I am have been away the weekend, but I am now in the process of downloading the latest raspbian release (25-09-2013), and going through my instructions to check that they are still accurate.
Moving on to your particular issues -
"190 invalid for parameter y_min" - I,ve seen seen or heard of this issue before, so I will let you know how I get on with my efforts shortly. This could be as a result of changes to the way notro's drivers work, but we will see.

"sudo: ts_calibrate: command not found". This could be a result of the drivers no loading due to the error above, or are you sure this was successful:

Code: Select all

sudo apt-get update
sudo apt-get install libts-bin evtest xinput python-dev python-pip
and this :

Code: Select all

sudo pip install evdev
And for the 3rd issue of nothing on the display using my python test program - sounds like you have a hdmi screen connected at the same time. Can you disconnect it and reboot the pi. I usually ssh into the pi when I am running the TFT. Having both hdmi and the TFT can confue the pi, depending on how you are driving it, ie which software you are using.
I shall report back shortly with my findings of using the latest raspbian image and notro's drivers (if they have also been updated).
Thanks,
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

mpl
Posts: 34
Joined: Sun Aug 12, 2012 6:14 pm

Re: 2.8" TFT + Touch Shield Board

Sun Sep 29, 2013 7:14 pm

Can i Uwe this tft for own output or only x11 Desktop?

texy
Forum Moderator
Forum Moderator
Posts: 5160
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: 2.8" TFT + Touch Shield Board

Sun Sep 29, 2013 7:18 pm

Hi,
you can use it for your own designs - see the first post of this thread where I use python to display colour bars. The python program doesn't even X11 to run
Thanks,
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

texy
Forum Moderator
Forum Moderator
Posts: 5160
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: 2.8" TFT + Touch Shield Board

Sun Sep 29, 2013 7:26 pm

chr1s wrote:Hello texy,

I received one of the screens some days ago. I tried to install it like described here, but unfortunately I faced several problems. First problem evolved when I added the lines
"fbtft_device name=hy28a rotate=270
ads7846_device pressure_max=255 y_min=190 y_max=3850 gpio_pendown=17 x_max=3850 x_min=230 x_plate_ohms=100 swap_xy=1 verbose=3"
to etc/module. dmesg says "190 invalid for parameter y_min".

also when I tried "sudo TSLIB_FBDEVICE=/dev/fb1 TSLIB_TSDEVICE=/dev/input/event0 ts_calibrate" it says "sudo: ts_calibrate: command not found". I am using USB-Keyboard an mouse so I tried with event1 as well, but didn't change anything. So I commented out the touchscreen in /etc/modules and tried to first get TFT running as all the problems seem to come from the touchscreen. But when I run the python program, it only opens a new window and draws the colour stripes in it. Nothing to see on the TFT (it's black so initialization seemed to work). I tried to run the script directly logged in on the board (have a beamer attached to the chinch) and via remote desktop. The fb_tft seems to be installed correctly, but I have the feeling that output is not routed correctly. I tried with fb0 and fb1 in the python script (both listet in the system). Same outcome. Any Ideas? About my background: I'm an experienced programmer, but new to Linux.
Thanks for your help!
Hi again chr1s,
as discussed above, I have gone through the setup procedure as explained in the first post and using the latest raspbian image of 25/09/2013.
All is as expected, no errors and the display and touchscreen are working. I used my vista laptop and networked to the pi with ssh. At no point did I connect the pi to my hdmi tv, and the TFT display card was connected right from the start.
Hope his helps,
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

mypifi
Posts: 131
Joined: Sun Oct 21, 2012 1:28 pm
Location: oxford
Contact: Website

Re: 2.8" TFT + Touch Shield Board

Sun Sep 29, 2013 8:05 pm

hi texy, ive just got my screen back out to try all over again, is there an .img already compiled somewhere as im not having much luck after 6 hours of following the guide.

newkie
Posts: 7
Joined: Wed Jul 03, 2013 10:58 pm

Re: 2.8" TFT + Touch Shield Board

Sun Sep 29, 2013 8:08 pm

hi texy
is there use some way of using some of the GPIO and the touch shield at the same time?

texy
Forum Moderator
Forum Moderator
Posts: 5160
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: 2.8" TFT + Touch Shield Board

Sun Sep 29, 2013 8:37 pm

newkie wrote:hi texy
is there use some way of using some of the GPIO and the touch shield at the same time?
Of course! The first post explains which gpio lines are used by the display and touch panel, all the others are available to be used as you wish.
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

texy
Forum Moderator
Forum Moderator
Posts: 5160
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: 2.8" TFT + Touch Shield Board

Sun Sep 29, 2013 8:38 pm

smstext wrote:hi texy, ive just got my screen back out to try all over again, is there an .img already compiled somewhere as im not having much luck after 6 hours of following the guide.
'Fraid not. What are you having problems with?
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

chr1s
Posts: 2
Joined: Sun Sep 29, 2013 12:08 pm

Re: 2.8" TFT + Touch Shield Board

Mon Sep 30, 2013 8:37 pm

Hey Texy,

I just reinstalled my Raspbian distribution and went through your whole tutorial again. This time it worked fine :-)! Have rally no idea what went wrong last time. Guess there are some things that one should not do at 3:00am :-). Had also the Y-Axis issue but thanks to NeillyThere I was able to fix it immediately. Thanks!
Cannot wait to play with the screen :-)!
Regards,
Chris

newkie
Posts: 7
Joined: Wed Jul 03, 2013 10:58 pm

Re: 2.8" TFT + Touch Shield Board

Tue Oct 01, 2013 7:22 am

might be a dumb question but will i need to solder a connection block in to the breakout gpio?

texy
Forum Moderator
Forum Moderator
Posts: 5160
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: 2.8" TFT + Touch Shield Board

Tue Oct 01, 2013 7:43 am

Hi
Version 1a you'll need to solder individual wires to it.
For version b and c there is already a connector soldered.
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

Return to “HATs and other add-ons”