bbeemer
Posts: 73
Joined: Sun Nov 16, 2014 5:50 am
Location: Iowa, US

Dual screen HDMI and 2.8 PiTFT

Sun Nov 16, 2014 7:40 am

I hope that someone like notro will chime in on this but I will be happy with a solution from anyone. Is it possible to use both the HDMI and the 2.8 PiTFT screen at the same time just to use the desktop?
Or as a second choice to use the HDMI when connected and the PiTFT when the HDMI is disconnected?
Raspberry Pi B+ with 2.8" resistive TFT running current Raspbian Wheezy with the PiTFTr optimizations
and a HDMI to VGA adapter when using the HDMI.
Willing to use other distro if necessary.
I am new to all this(Linux Raspberry Pi etc) this is for a project in school.
Thank you.

Posts: 1
Joined: Sat Nov 15, 2014 11:50 pm
Last edited by bbeemer on Thu Dec 04, 2014 12:37 am, edited 1 time in total.

n7net
Posts: 8
Joined: Wed Dec 25, 2013 2:40 pm

Re: Dual screen HDMI and 2.8 PiTFT

Tue Nov 18, 2014 3:49 am

I don't think so. The configuration are set for on or the other. Sorry

notro
Posts: 695
Joined: Tue Oct 16, 2012 6:21 pm
Location: Drammen, Norway

Re: Dual screen HDMI and 2.8 PiTFT

Tue Nov 18, 2014 7:54 pm

I did some testing a while back, but couldn't figure out the input devices: https://github.com/notro/fbtft-spindle/ ... -multiseat

bbeemer
Posts: 73
Joined: Sun Nov 16, 2014 5:50 am
Location: Iowa, US

Re: Dual screen HDMI and 2.8 PiTFT

Wed Nov 19, 2014 2:40 am

notro wrote:I did some testing a while back, but couldn't figure out the input devices: https://github.com/notro/fbtft-spindle/ ... -multiseat
Ok so how about my second option of detecting if HDMI is attached and displaying to HDMI if not then display to the TFT?
This would work for me because this is a portable device and the HDMI would only be needed for setup, debugging and updating etc.

DirkS
Posts: 9732
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Dual screen HDMI and 2.8 PiTFT

Wed Nov 19, 2014 10:18 am

Maybe you can use 'tvservice -s' to detect HDMI status and act on that.
See http://www.raspberrypi.org/forums/viewt ... 29&t=52309

Gr.
Dirk.

bbeemer
Posts: 73
Joined: Sun Nov 16, 2014 5:50 am
Location: Iowa, US

Re: Dual screen HDMI and 2.8 PiTFT

Thu Nov 20, 2014 2:49 am

DirkS wrote:Maybe you can use 'tvservice -s' to detect HDMI status and act on that.
See http://www.raspberrypi.org/forums/viewt ... 29&t=52309

Gr.
Dirk.
Thanks, I will give it a try

bbeemer
Posts: 73
Joined: Sun Nov 16, 2014 5:50 am
Location: Iowa, US

Re: Dual screen HDMI and 2.8 PiTFT

Tue Nov 25, 2014 9:31 pm

Anyone know how, where and when I could check for this?
Could I do it during boot or would I have to put it into a program?
I would prefer to do it before the desktop opens.

bbeemer
Posts: 73
Joined: Sun Nov 16, 2014 5:50 am
Location: Iowa, US

Re: Dual screen HDMI and 2.8 PiTFT

Thu Dec 04, 2014 12:22 am

DirkS wrote:Maybe you can use 'tvservice -s' to detect HDMI status and act on that.
See http://www.raspberrypi.org/forums/viewt ... 29&t=52309

Gr.
Dirk.

I finally got around to trying this and I get the same thing whether the hdmi is plugged in or not, I get:
0x12001a followed by a bunch of info about screen size, aspect ratio and frequency etc
looking at my OP I see I forgot to mention that I am using a hdmi to VGA adapter but tvservice -n gives the correct manufacturer and model number of the monitor (edited in OP).
And I am only testing using the terminal after boot from the desktop, would I get better results during boot or not?
any one have any ideas ?
Last edited by bbeemer on Mon Dec 15, 2014 11:56 pm, edited 1 time in total.

bbeemer
Posts: 73
Joined: Sun Nov 16, 2014 5:50 am
Location: Iowa, US

Re: Dual screen HDMI and 2.8 PiTFT

Fri Dec 05, 2014 2:32 am

Anyone, Please and thank you.

DirkS
Posts: 9732
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Dual screen HDMI and 2.8 PiTFT

Fri Dec 05, 2014 4:10 pm

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.

bbeemer
Posts: 73
Joined: Sun Nov 16, 2014 5:50 am
Location: Iowa, US

Re: Dual screen HDMI and 2.8 PiTFT

Sat Dec 06, 2014 3:53 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:

HTH
Dirk.
after some mucking about I found that due to all the mucking about to get the HDMI to VGA adapter to work which caused me to rewrite my sd card many times, I do not have the pitft installed (although I did at some point/s) I will get that setup and get back to you soon.
I am using the adafruit tutorial for the tft here: https://learn.adafruit.com/adafruit-pit ... stallation I think it is the same as your "assumption" above

bbeemer
Posts: 73
Joined: Sun Nov 16, 2014 5:50 am
Location: Iowa, US

Re: Dual screen HDMI and 2.8 PiTFT

Sat Dec 06, 2014 10:20 pm

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.
/etc/modules says this:
spi-bcm2708
fbtft_device
snd-bcm2835
the last line that was already there when I added the top 2.
And /etc/modprobe.d/adafruit.conf says this:
options fbtft_device name=adafruitrt28 rotate=90 frequency=32000000
So I don't know what to change.
Last edited by bbeemer on Sun Dec 07, 2014 3:31 pm, edited 1 time in total.

DirkS
Posts: 9732
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Dual screen HDMI and 2.8 PiTFT

Sat Dec 06, 2014 11:52 pm

I assume you used the 'easy install' option (using full image downloaded from the Adafruit tutorial).
It probably has the drivers built into the kernel.
I did it the 'hard way' because I did not want to start from scratch.

Can you post the contents of /boot/cmdline.txt?

Gr.
Dirk.

bbeemer
Posts: 73
Joined: Sun Nov 16, 2014 5:50 am
Location: Iowa, US

Re: Dual screen HDMI and 2.8 PiTFT

Sun Dec 07, 2014 1:19 am

DirkS wrote:I assume you used the 'easy install' option (using full image downloaded from the Adafruit tutorial).
It probably has the drivers built into the kernel.
I did it the 'hard way' because I did not want to start from scratch.

Can you post the contents of /boot/cmdline.txt?

Gr.
Dirk.
I also did it the hard way (this time) because I also did not want to start over.
Here is my /boot/cmdline.txt:

Code: Select all

dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p6 rootfstype=ext4 elevator=deadline rootwait

bbeemer
Posts: 73
Joined: Sun Nov 16, 2014 5:50 am
Location: Iowa, US

Re: Dual screen HDMI and 2.8 PiTFT

Sun Dec 14, 2014 4:52 am

I hope bumping is not frowned upon here.

User avatar
DougieLawson
Posts: 34762
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Dual screen HDMI and 2.8 PiTFT

Sun Dec 14, 2014 8:38 am

bbeemer wrote: And /etc/modprobe.d/adafruit.conf says this:
options fbtft_device name=adafruitrt28 rotate=90 frequency=32000000
So I don't know what to change.

Rename /etc/modprobe.d/adafruit.conf to /etc/modprobe.d/fbtft_device.conf (the config file name MUST match the module name). change it to have

Code: Select all

options fbtft_device name=adafruit28 rotate=90 frequency=32000000
then reboot.
Note: Having anything remotely humorous in your signature is completely banned on this forum.

Any DMs sent on Twitter will be answered next month.

This is a hippy & doctor free zone.

bbeemer
Posts: 73
Joined: Sun Nov 16, 2014 5:50 am
Location: Iowa, US

Re: Dual screen HDMI and 2.8 PiTFT

Mon Dec 15, 2014 8:50 pm

DougieLawson wrote:
Rename /etc/modprobe.d/adafruit.conf to /etc/modprobe.d/fbtft_device.conf (the config file name MUST match the module name). change it to have

Code: Select all

options fbtft_device name=adafruit28 rotate=90 frequency=32000000
then reboot.
Am I correct in assuming that this will get me different output from tvservice so I can test and choose which display to use?
I will do this as soon as I can and get back to you.

User avatar
DougieLawson
Posts: 34762
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Dual screen HDMI and 2.8 PiTFT

Mon Dec 15, 2014 9:34 pm

tvservice doesn't have any relevance here. The LCD is an entirely separate framebuffer device to the HDMI interface.
Note: Having anything remotely humorous in your signature is completely banned on this forum.

Any DMs sent on Twitter will be answered next month.

This is a hippy & doctor free zone.

bbeemer
Posts: 73
Joined: Sun Nov 16, 2014 5:50 am
Location: Iowa, US

Re: Dual screen HDMI and 2.8 PiTFT

Tue Dec 16, 2014 12:22 am

DougieLawson wrote:tvservice doesn't have any relevance here. The LCD is an entirely separate framebuffer device to the HDMI interface.
Ahhh I see.

I have set everything up as stated above and if I reboot or shutdown / restart with the HDMI unplugged I get a lower resolution on the HDMI when I plug it back in (after waiting plenty long enough for it to finish booting , the desktop was up when I plugged back in) but it does not go to the TFT (but it did this before also)
Any Ideas?
This may or may not be helpful but when I switch to the TFT manually it only shows part of the desktop.
EDIT:
I changed the code given by DirkS above to reflect the correct device name like this:
DirkS wrote: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=adafruitrt28 rotate=90      #### not "name=pitft"  ######
    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
modprobe fbtft_device name=adafruitrt28 rotate=90 #### not "name=pitft" ###### < this is the line I changed.

But it still wont work.

User avatar
DougieLawson
Posts: 34762
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Dual screen HDMI and 2.8 PiTFT

Tue Dec 16, 2014 2:35 pm

bbeemer wrote: modprobe fbtft_device name=adafruitrt28 rotate=90 #### not "name=pitft" ###### < this is the line I changed.

But it still wont work.
Where does the name "adafruitrt28" come from? Are you using Notro's kernel or a custom built Adafruit one?
Note: Having anything remotely humorous in your signature is completely banned on this forum.

Any DMs sent on Twitter will be answered next month.

This is a hippy & doctor free zone.

DirkS
Posts: 9732
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Dual screen HDMI and 2.8 PiTFT

Tue Dec 16, 2014 3:08 pm

DougieLawson wrote:
bbeemer wrote: modprobe fbtft_device name=adafruitrt28 rotate=90 #### not "name=pitft" ###### < this is the line I changed.

But it still wont work.
Where does the name "adafruitrt28" come from? Are you using Notro's kernel or a custom built Adafruit one?
That's Adafruit kernel + tutorial (http://www.raspberrypi.org/forums/viewt ... 64#p650440, https://learn.adafruit.com/adafruit-pit ... stallation)

DirkS
Posts: 9732
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Dual screen HDMI and 2.8 PiTFT

Tue Dec 16, 2014 3:23 pm

DougieLawson wrote:
bbeemer wrote: modprobe fbtft_device name=adafruitrt28 rotate=90 #### not "name=pitft" ###### < this is the line I changed.

But it still wont work.
Where does the name "adafruitrt28" come from? Are you using Notro's kernel or a custom built Adafruit one?
BTW: you *do* realise what the idea is in this exercise? The pitft as such works, but we're trying to only have the pitft switch on when no HDMI is detected.
That's why I came up with the addition in rc.local, which works on my system.
I switched to notro's kernel at some point, that's why the name is 'pitft'

Gr.
Dirk.

DirkS
Posts: 9732
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Dual screen HDMI and 2.8 PiTFT

Tue Dec 16, 2014 3:43 pm

bbeemer wrote:But it still wont work.
Try this:

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
    # 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
(NB: I commented out the line for the touch controller; don't think you need that with the adafruit kernel)

Gr.
Dirk.

bbeemer
Posts: 73
Joined: Sun Nov 16, 2014 5:50 am
Location: Iowa, US

Re: Dual screen HDMI and 2.8 PiTFT

Fri Dec 19, 2014 12:53 am

DougieLawson wrote:
bbeemer wrote: modprobe fbtft_device name=adafruitrt28 rotate=90 #### not "name=pitft" ###### < this is the line I changed.

But it still wont work.
Where does the name "adafruitrt28" come from? Are you using Notro's kernel or a custom built Adafruit one?
I followed adafruit's instructions and did it the hard way, I did not burn the custom image to the sd but followed the instructions for changing an already setup sd card.
As for the name, in the instruction text they recommended using that name because it was more descriptive since they have more screens now or something like that.

bbeemer
Posts: 73
Joined: Sun Nov 16, 2014 5:50 am
Location: Iowa, US

Re: Dual screen HDMI and 2.8 PiTFT

Fri Dec 19, 2014 1:04 am

DirkS wrote: (NB: I commented out the line for the touch controller; don't think you need that with the adafruit kernel)

Gr.
Dirk.
I hope you are saying that the touch controller will still work because I am using the adafruit kernel.
I will give your change a try shortly and get back to you soon.

in your code are you testing for HDMI/DMI? because when i boot without the HDMI plugged in the only difference in the output from tvservic is the mode(?) and the resolution, could this be the problem?

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