Henry_Jones
Posts: 8
Joined: Mon Feb 16, 2015 1:35 pm

Re: Dual screen HDMI and 2.8 PiTFT

Wed Jun 24, 2015 10:47 am

Hello,

after I had created a dual Monitor setup I now struggle with the resizing / transforming of the touch area of one of the two Monitors to only it's own Surface

The command stated on this thread is:

xinput set-prop "stmpe-ts" --type=float "Coordinate Transformation Matrix" 0.16 0 0 0 0.2285 0.7714 0 0 1 (some numbers shortend)

The Problem is, I only have those Input devices (xinput --list):

⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Windows pointer id=6 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Windows keyboard id=7 [slave keyboard (3)]

Even if I apply (successful) the transformation matrix, there is no change, the small monitor with the touch still covers both monitors.

The touch Driver is loaded via /boot/config.txt as follows:
dtoverlay=ads7846,speed=500000,penirq=17

The similar line in /etc/modules is commented out, but even keep it active does not change a thing. Should'nt there be a device "ADS7846" or something in the xinput list ?

Anyone has an idea ?

IonicaBizau
Posts: 2
Joined: Fri Aug 14, 2015 4:37 am

Re: Dual screen HDMI and 2.8 PiTFT

Fri Aug 14, 2015 4:44 am

DirkS wrote:Did a bit of testing and this works for me.

Assumption: pitft drivers / modules are loaded using /etc/modules. Entries in my /etc/modules look like this:

Code: Select all

# fbtft_device name=pitft rotate=90
# stmpe_device cs=1 chip=stmpe610 blocks=gpio,ts irq-pullup irq-gpio=24 irq-base=330 sample-time=4 mod-12b=1 ref-sel=0 adc-freq=2 ave-ctrl=3 touch-det-delay=4 settling=2 fraction-z=7 i-drive=0
These need to be commented out (as I have done above)

Then edit /etc/rc.local. Add *before* the line with 'exit 0':

Code: Select all

echo "is it HDMI or DMT?" > /home/pi/tft.log
/usr/bin/tvservice -s >> /home/pi/tft.log
if (/usr/bin/tvservice -s | /bin/egrep 'HDMI|DVI') ; then
    echo "HDMI / DVI screen" >> /home/pi/tft.log
else
    echo "switch on PiTFT" >> /home/pi/tft.log
    modprobe fbtft_device name=pitft rotate=90
    modprobe stmpe_device cs=1 chip=stmpe610 blocks=gpio,ts irq-pullup irq-gpio=24 irq-base=330 sample-time=4 mod-12b=1 ref-sel=0 adc-freq=2 ave-ctrl=3 touch-det-delay=4 settling=2 fraction-z=7 i-drive=0
fi
I left in some echo's for debugging.
The arguments on the 'modprobe' lines should be an exact copy of the ones commented out in /etc/modules.
Tested with HDMI output (HDMIPi), HDMI to VGA converter (resulting in DVI status) and PiTFT screen (Adafruit 1601).
Post the contents of tft.log if there are any problems.

Would like to hear of anyone who can think of a better solution...

HTH
Dirk.
DirkS's solution helped me to make my HDMI monitor usable when this is connected. So, thanks! :)
...but, my problem now is that the GUI fails to start. If I write

Code: Select all

startx
, I get an error which says

Code: Select all

no screens found error
.

Does anybody know how to solve this?

I asked a similar question here: http://raspberrypi.stackexchange.com/q/34347/33613

doobedo
Posts: 1
Joined: Mon Nov 23, 2015 5:52 am

Re: Dual screen HDMI and 2.8 PiTFT

Mon Nov 23, 2015 5:55 am

Here Tutorial Step by Step How To dual monitor

https://www.youtube.com/watch?v=d2ouG1VmD88

IanLWT
Posts: 3
Joined: Sun Jan 17, 2016 3:35 am

Re: Dual screen HDMI and 2.8 PiTFT

Sun Jan 17, 2016 3:38 am

bbeemer wrote:
DirkS wrote:Download my version from dropbox:

Code: Select all

wget http://rasp.is/4y5xTG -O 99-fbdev.conf
(don't forget to put it in ~/scripts after downloading.
Worked booting to console on TFT.
Worked booting to console on HDMI.
Worked booting to GUI on TFT.
Worked booting to GUI on HDMI.

WOOOO HOOOO !!!!

How can I get lxterminal and other things to fit on the TFT screen ?
So is all that I have to do to achieve this is to download this file? I am confused since there were so many solutions thrown out in this file (ps Im using rpi2 with kali 2.0 and custom kernel. tft is already up and running but I cant see anything if hdmi is connected.

IanLWT
Posts: 3
Joined: Sun Jan 17, 2016 3:35 am

Re: Dual screen HDMI and 2.8 PiTFT

Sun Jan 17, 2016 3:48 am

ragnarjensen wrote:
bbeemer wrote:Is it possible to use both the HDMI and the 2.8 PiTFT screen at the same time just to use the desktop?
Yes. I have a PiTFT running together with a HP 1680x1050 monitor on the HDMi port.
Image
I have four server layouts in my /etc/X11/xorg.conf, so I can choose if I want to use the PiTFT, the HDMI monitor or both on the startx command line.

I use Adafruit's kernel, installed with their "DIY Installer script" as described here: https://learn.adafruit.com/adafruit-pit ... sy-install

Code: Select all

[email protected]:~$ uname -a
Linux speedyplus 3.12.26+ #7 PREEMPT Wed Sep 17 14:25:24 EDT 2014 armv6l GNU/Linux
[email protected]:~$ cat /proc/version
Linux version 3.12.26+ ([email protected]) (gcc version 4.4.7 (Ubuntu/Linaro 4.4.7-1ubuntu2) ) #7 PREEMPT Wed Sep 17 14:25:24 EDT 2014
My /etc/X11/xorg.conf:

Code: Select all

# /etc/X11/xorg.conf for the Adafruit 2.8" 320x240 PiTFT, together with an HP 1680x1050 monitor on the RPi's HDMI port.
# We're using a single X server, so if running both monitors as separate desktops they will be DISPLAY :0.0 and :0.1 respectively.
#
#######################################################################################################
#
#  This file contains four server layouts. If none is selected when starting X, the first one is used.
#
# startx			# Adafruit monitor only.
#
# startx -- -layout HDMI	# RPi HDMI monitor only.
#				# The Adafruit's touch function is still active and maps to the entire HDMI monitor.
#				# It can be used as a touchpad of sorts.
#
# startx -- -layout OneDesk	# Both monitors, one extended desktop. Touch area must be transformed.
#
# startx -- -layout TwoDesk	# Both monitors, two separate desktops. Touch area must be transformed.
# 				# Both desktops share the mouse and keyboard.
# 				# The mouse pointer can move between desktops, but nothing else can.
# 				# You have to start a window manager on the secondary screen yourself.
#
#######################################################################################################

Section "Device" 
# RPi builtin video, framebuffer 0
	Identifier	"RPi_HDMI" 
	Driver		"fbdev" 
	Option		"fbdev"			"/dev/fb0"
EndSection 

Section	"Device" 
# Adafruit PiTFT 2.8" resistive touchscreen, framebuffer 1
	Identifier	"fbtft_dev" 
	Driver		"fbdev" 
	Option		"fbdev"			"/dev/fb1"
EndSection 

Section	"Monitor" 
# Primary monitor. Adafruit 320x240
	Identifier	"Adafruit28r" 
EndSection 

Section	"Monitor" 
# Secondary monitor. HP 1680x1050
	Identifier	"HDMI_monitor" 
EndSection 


Section	"Screen" 
	Identifier	"Primary" 
	Device		"fbtft_dev" 
	Monitor		"Adafruit28r" 
EndSection 

Section	"Screen" 
	Identifier	"Secondary" 
	Device		"RPi_HDMI" 
	Monitor		"HDMI_monitor" 
EndSection 



Section	"ServerLayout" 
# Adafruit monitor only.
	Identifier	"Default" 
	Screen 0	"Primary"		0 0
EndSection

#####################################################
Section	"ServerLayout" 
# RPi HDMI monitor only.
	Identifier	"HDMI" 
	Screen 0	"Secondary"		0 0
EndSection

#####################################################
Section	"ServerLayout" 
# Both monitors, one extended desktop.
# Adafruit to the left of the secondary monitor. Monitors aligned at the bottom.
	Identifier	"OneDesk" 
	Screen 0	"Primary"		0 810 	# Adafruit monitor is 240 pixels high, 810 pixels less than the HP.
							# Place its top-left corner 810 pixels below the HP's upper edge,
							# in order to align monitors along the bottom edge.

	Screen 1	"Secondary"		320 0	# Secondary monitor's left edge 320 pixels to the right of Adafruit's left edge.
	Option		"Xinerama"		"true"  # Enable XINERAMA extension to get one desktop over both monitors.
EndSection

#####################################################
Section	"ServerLayout" 
# Same as "OneDesk" but without Xinerama, i.e. two desktops. You have to start secondary screen's window manager yourself.
	Identifier	"TwoDesk" 
	Screen 0	"Primary"		0 810 
	Screen 1	"Secondary"		320 0
	Option		"Xinerama"		"false" # Disable XINERAMA extension to get two separate desktops.
EndSection
At the moment, I always use the "TwoDesk" configuration (two separate desktops). I have to start the desktop environment on the secondary monitor myself, so I have created a file ~/.config/autostart/10-desktopmgr-autostart.desktop.
which contains

Code: Select all

[Desktop Entry]
Encoding=UTF-8
Name=Desktop autostart for secondary display
Comment=Start the LXDE environment on secondary display
Exec=/home/pi/bin/desktopmgr.sh
OnlyShowIn=LXDE
Then, in my ~/bin directory, I have the script desktopmgr.sh:

Code: Select all

#!/bin/bash
#
# Start the LXDE desktop environment on the secondary display in a Dual-Head setup, where Xinerama is OFF.
# 

export SECONDARY_DISPLAY=:0.1
export LXDE_CONF_DIR=LXDE_01			# Directory under ~/.config/pcmanfm/ with LXDE configuration for this desktop.
export OPENBOX_CONFIG=$HOME/.config/openbox/lxde_01-rc.xml

#xsetroot -display ${SECONDARY_DISPLAY} -solid thistle # For debug. If the secondary screen changes colour, we know that this script is running.

# Start a window manager.
DISPLAY=${SECONDARY_DISPLAY} openbox --config-file ${OPENBOX_CONFIG} &

# Start the desktop environment (wallpaper and desktop icons). It is actually the file manager pcmanfm that manages the desktop, when started with its --desktop option.
#
# Alas, there is a bug in pcmanfm.
# It won't start on DISPLAY :0.1 if there already is another pcmanfm running on the main DISPLAY :0.0
# It seems like it only checks if it already is running on the same X server,
# not taking the possible multiple displays on that server into consideration.
# Workaround by using the DISPLAY environment variable to point to a non-existing DISPLAY :9.0, where it does its check-if-i-am-already-running
# and using the --display argument to point out the real DISPLAY we want it running on.

DISPLAY=:9.0 pcmanfm --display=${SECONDARY_DISPLAY} --desktop  --profile LXDE &

# Start a terminal in the lower left corner of the display.
cd $HOME	# To make the terminal open in our home directory.
xterm -bg LightGoldenrodYellow -fg black -geometry +0-0 -display :0.1 &

# A clock is always nice to have.
DISPLAY=${SECONDARY_DISPLAY} xclock  -geometry +150+10 &

# Shrink the touch area. By default the Adafruit touchscreen will map to the entire X server screen area (both displays.)
# We need to shrink the touch area into a rectangle which is smaller than the total screen. 
#
# The below transformation is for an Adafruit PiTFT 320x240 monitor to the left of a 1680x1050 monitor. The two monitors are aligned at the bottom edges.
# The touch area is shrunk to only encompass the Adafruit monitor.
# If your setup differs at all from the above, you have to recalculate the transformation.
# All the nitty, gritty details at https://wiki.archlinux.org/index.php/Calibrating_Touchscreen
# You have to "sudo apt-get install xinput" for the next line to work...

xinput set-prop "stmpe-ts" --type=float "Coordinate Transformation Matrix" 0.16 0 0 0 0.22857142857142857142857142857143 0.77142857142857142857142857142857 0 0 1

which sets up the desktop environment on the secondary monitor and transforms the PiTFT's touch area to only cover its own screen.
Easy, really ;)
--
Ragnar
Will this work on the rpi2 with kali2? already have the tft up and running but trying to use hdmi too

AppleTechy
Posts: 2
Joined: Tue Feb 16, 2016 2:00 am

Re: Dual screen HDMI and 2.8 PiTFT

Tue Feb 16, 2016 2:06 am

Hello. Don't know if anyone on this is still active but I am currently running Raspberrian Jesse and was interested in having it output solely to the HDMI connected monitor and when no monitor connected via HDMI for it to automatically output to the TFT screen. Though if it is outputting to the HDMI monitor I want the TFT screen shut off NOT a dual monitor setup. This is because I want to use it as a server at home but then be able to take it on the go. To be completely honest I probably won't be using Raspberrian on the go so I need it to always output to the HDMI but if possible I would like the option/ more elegant solution of it picking up the TFT screen later when it isn't connected via HDMI and switching the output for me. I believe someone else got this working but I was wondering if anyone could provide some clear guidance/steps on how to implement the devised solution. Thank you for any advice or guidance on the matter!

citenx
Posts: 1
Joined: Tue Aug 23, 2016 2:19 pm

Re: Dual screen HDMI and 2.8 PiTFT

Tue Aug 23, 2016 2:22 pm

AppleTechy wrote:Hello. Don't know if anyone on this is still active but I am currently running Raspberrian Jesse and was interested in having it output solely to the HDMI connected monitor and when no monitor connected via HDMI for it to automatically output to the TFT screen. Though if it is outputting to the HDMI monitor I want the TFT screen shut off NOT a dual monitor setup. This is because I want to use it as a server at home but then be able to take it on the go. To be completely honest I probably won't be using Raspberrian on the go so I need it to always output to the HDMI but if possible I would like the option/ more elegant solution of it picking up the TFT screen later when it isn't connected via HDMI and switching the output for me. I believe someone else got this working but I was wondering if anyone could provide some clear guidance/steps on how to implement the devised solution. Thank you for any advice or guidance on the matter!
This is exactly what I want to do. I'd even create a shell script to automate the process if someone could explain how to do this.

gkgeorgiev
Posts: 2
Joined: Mon Oct 26, 2015 9:03 pm

Re: Dual screen HDMI and 2.8 PiTFT

Sat Sep 17, 2016 9:10 pm

I have exactly the same problem.

I have 7 inch touch screen (connected over SPIO) and 40 inches LCD (HDMI connected).
I'd like to be able to have them running as either dual screen or at least to switch between them without the need of reboot.

nordom
Posts: 1
Joined: Wed Nov 02, 2016 8:47 pm

Re: Dual screen HDMI and 2.8 PiTFT

Wed Nov 02, 2016 8:54 pm

gkgeorgiev wrote:I have exactly the same problem.

I have 7 inch touch screen (connected over SPIO) and 40 inches LCD (HDMI connected).
I'd like to be able to have them running as either dual screen or at least to switch between them without the need of reboot.
Same here I can't even switch between them even if I reboot, dont know what I'm doing wrong. Have mix around with the /boot/config.txt but nothing seems to work.

Did you find a solution for this?
And can I ask how you switch between them when rebooting?

AndySax
Posts: 4
Joined: Thu Feb 02, 2017 1:39 pm

Re: Dual screen HDMI and 2.8 PiTFT

Mon Feb 06, 2017 9:10 am

Hi Guys,
I’ve been looking for this for a while and then found this thread and it’s just what I needed, thanks for all the info.
I’m a complete noob so forgive me if this is a daft question or the info is elsewhere.
To help with my work testing screens and projectors I plan to build a small unit with controls on a 7 inch touch screen and sending out to the second screen a full image of video or pictures. This will save me carrying around (or having to buy) two laptops.
My question is, will a Pi3 processor handle this if I’m moving around things on the control screen while it’s still playing an HD video on the second screen?
Or is it better (or possible) to network two Pi’s with the second one only handling the second display?

Your thoughts and any help would be appreciated.
Andy.

AndySax
Posts: 4
Joined: Thu Feb 02, 2017 1:39 pm

Re: Dual screen HDMI and 2.8 PiTFT

Tue May 09, 2017 6:00 pm

Hi, just thought I’d answer my own question in case anyone else came across this thread.
I attached an official 7” touch screen and using OMXPlayer (which is installed by default) you can send videos to the HDMI port. From terminal type;
omxplayer --display=5 video.mkv
Display 5 is the HDMI so this will play the video through HDMI and video.mkv is the name of the video.
If you want to use a GUI then install the excellent TBOPlayer. Open Options-Edit and in the box that is marked OMXPlayer options type;
--display=5
Also activate Forbid Windowed Mode to make full screen.
And that’s it enjoy.

BigE
Posts: 12
Joined: Tue Mar 27, 2018 2:04 pm

Re: Dual screen HDMI and 2.8 PiTFT

Tue Apr 03, 2018 4:05 pm

if your seeing this comment in 2018, adafruit recently updated their easy install option. check it out

abedds
Posts: 1
Joined: Wed Jan 23, 2019 4:13 pm

Re: Dual screen HDMI and 2.8 PiTFT

Wed Jan 23, 2019 4:48 pm

Help, i installed drivers for my LCD 3.5 screen, and its working, but i cannot connect my TV through HDMI anymore, how do i turn the LCD off?

Return to “Interfacing (DSI, CSI, I2C, etc.)”