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:36 am

Still not working.

I just realized you said to post tft.log if there were any problems so here it is:

With HDMI plugged in:
is it HDMI or DMT?
state 0x12001a [HDMI DMT (35) RGB full 5:4], 1280x1024 @ 60Hz, progressive
HDMI / DVI screen

With out HDMI plugged in:
is it HDMI or DMT?
state 0x12001a [HDMI DMT (4) RGB full 4:3], 640x480 @ 60Hz, progressive
HDMI / DVI screen

Should we be testing for something like:
if (/usr/bin/tvservice -s | /bin/egrep '(35)') ; then
...
?
Last edited by bbeemer on Fri Dec 19, 2014 2:09 am, edited 2 times 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 19, 2014 2:44 am

bbeemer wrote: Should we be testing for something like:
if (/usr/bin/tvservice -s | /bin/egrep '(35)') ; then
...
?
That did not switch to the tft but the tft.log changed to:
is it HDMI or DMT?
state 0x12001a [HDMI DMT (4) RGB full 4:3], 640x480 @ 60Hz, progressive
switch on PiTFT

That seems like some progress.

And I would also like to mention... Finals Week Is OVER!!!

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

Re: Dual screen HDMI and 2.8 PiTFT

Fri Dec 19, 2014 10:24 am

bbeemer wrote:I hope you are saying that the touch controller will still work because I am using the adafruit kernel.
Yes, I had a look at the Adafruit kernel code and I think it's being loaded with the screen module.
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?
If I remove the 'fbtft_device' from /etc/modules and reboot tvservice will show 'HDMI' or 'DVI' depending on the type of screen I have attached.
If no HDMI/DVI monitor is connected tvservice will show 'NTSC'.

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 5:51 pm

DirkS wrote:
bbeemer wrote:I hope you are saying that the touch controller will still work because I am using the adafruit kernel.
Yes, I had a look at the Adafruit kernel code and I think it's being loaded with the screen module.
I ran the event viewer for the touch screen and it works even though I am using the HDMI and the tft is inactive.
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?
If I remove the 'fbtft_device' from /etc/modules and reboot tvservice will show 'HDMI' or 'DVI' depending on the type of screen I have attached.
If no HDMI/DVI monitor is connected tvservice will show 'NTSC'.

Gr.
Dirk.
I did that and I do not get NTSC, I get the same thing as the tft.logs that I posted above.
Notice that in the tft.logs posted above that if I test for "(35)" the tft.log says "switching to tft" but it does not actually switch

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

Re: Dual screen HDMI and 2.8 PiTFT

Fri Dec 19, 2014 6:10 pm

Do you have any HDMI related lines in /boot/config.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

Fri Dec 19, 2014 6:25 pm

bbeemer wrote:
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.
I notice that our /etc/modules are different is this the problem?

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 6:39 pm

DirkS wrote:Do you have any HDMI related lines in /boot/config.txt?

Gr.
Dirk.
Yes.

Code: Select all

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
disable_overscan=0

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=25
#overscan_right=25
#overscan_top=25
#overscan_bottom=25

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1920
#framebuffer_height=1440

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=4 # 87
# Put your VGA monitor resolution below
# hdmi_cvt =       
# width        width in pixels
# height       height in pixels
# framerate    framerate in Hz
# aspect       aspect ratio 1=4:3, 2=14:9, 3=16:9, 4=5:4, 5=16:10, 6=15:9
# margins      0=margins disabled, 1=margins enabled
# interlace    0=progressive, 1=interlaced
# rb           0=normal, 1=reduced blanking

# For example, 800x600 @ 60 Hz
#### hdmi_cvt=800 600 60 1 0 0 1
# or maybe 800x480 @ 60 Hz
#hdmi_cvt=800 480 60 6 0 0 1
# or, 1024 x 768 @ 50 Hz
#hdmi_cvt=1024 768 60 1 0 0 1
# or if you're not sure, nothing beats 640x480
#hdmi_cvt=640 460 60 1 0 0 1

hdmi_cvt=640 480 60 1 0 0 1

# see http://www.raspberrypi.org/forum/viewtopic.php?f=29&t=24679

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
###############################################################
### THIS LINE IS WHAT ENABLES THE AUDIO OUT OF THE ADAPTER! ###
#hdmi_drive=2
###############################################################

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
arm_freq=800

######### My Tweaks ##########

hdmi_drive=2
#hdmi_group=1
#hdmi_mode=4
#overscan_left=-40
#overscan_right=-47
#overscan_top=-37
#overscan_bottom=-400

# NOOBS Auto-generated Settings:

hdmi_force_hotplug=1
config_hdmi_boost=4
start_x=1
gpu_mem=128
core_freq=250
sdram_freq=400
over_voltage=0

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

Re: Dual screen HDMI and 2.8 PiTFT

Fri Dec 19, 2014 7:26 pm

Code: Select all

hdmi_cvt=640 480 60 1 0 0 1
This line probably causes the 'false HDMI' reading (HDMI mode 4).
Normally you wouldn't need it, so I would comment it out.
I notice that our /etc/modules are different is this the problem?
Not a problem, but it is why my latest proposal for rc.local looked a bit different.
It's all getting a bit muddled up after several attempts, so I'll post it again to be sure that we got the correct one:

Code: Select all

echo "is it HDMI or DVI?" > /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
fi
And make sure the 'fbtft_device' line in /etc/modules is commented out.
The difference in /etc/modules is the name of device that Adafruit and notro give to the device. Adafruit named it 'adafruitrt28' (for adafruit resistive touch 2.8") and notro's name for it is 'pitft'.

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 7:42 pm

DirkS wrote:

Code: Select all

hdmi_cvt=640 480 60 1 0 0 1
This line probably causes the 'false HDMI' reading (HDMI mode 4).
Normally you wouldn't need it, so I would comment it out.
All of my entries are what I had to do to get my HDMI adapter to work. I used a lot of different tutorials and posts that google found until something worked so I don't know if there is anything unnecessary in there, but as far as I know that one is necessary.
I notice that our /etc/modules are different is this the problem?
Not a problem, but it is why my latest proposal for rc.local looked a bit different.
It's all getting a bit muddled up after several attempts, so I'll post it again to be sure that we got the correct one:

Code: Select all

echo "is it HDMI or DVI?" > /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
fi
And make sure the 'fbtft_device' line in /etc/modules is commented out.
The difference in /etc/modules is the name of device that Adafruit and notro give to the device. Adafruit named it 'adafruitrt28' (for adafruit resistive touch 2.8") and notro's name for it is 'pitft'.

Dirk.
yes that is what I have (except that I just commented out the lines, but that wont make any difference), but I will print it out and double check.
one exception to the above line, I am still testing for "(35)" not "HDMI | DVI" so I will change that back.

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 8:40 pm

It seems that the "hdmi_cvt=640 480 60 1 0 0 1" was unnecessary, I checked all of the commands and made sure they matched your last post and rebooted - no change whatsoever.

tft.logs
Without HDMI plugged in:
is it HDMI or DMT?
state 0x12001a [HDMI DMT (4) RGB full 4:3], 640x480 @ 60Hz, progressive
HDMI / DVI screen

With HDMI plugged in:
is it HDMI or DMT?
state 0x12001a [HDMI DMT (35) RGB full 5:4], 1280x1024 @ 60Hz, progressive
HDMI / DVI screen
Last edited by bbeemer on Sat Dec 20, 2014 6:35 am, edited 1 time in total.

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

Re: Dual screen HDMI and 2.8 PiTFT

Sat Dec 20, 2014 1:07 am

For testing you could change the comparison from 'HDMI|DVI' to (34) as you tried before.
Not really a permanent solution; if you change HDMI monitors a different mode could be used.

If that does not give a result then there is one other change you could make:
Add the options from the .conf to rc.local too.

Code: Select all

echo "is it HDMI or DVI?" > /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 frequency=32000000
fi
and rename /etc/modprobe.d/adafruit.conf (for example add .save to it)

If that doesn't work...

Gr.
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 20, 2014 5:15 pm

I am doing these steps one at a time and documenting as I go.
DirkS wrote:For testing you could change the comparison from 'HDMI|DVI' to (34) as you tried before.
Not really a permanent solution; if you change HDMI monitors a different mode could be used.
I realized that when I suggested it. But only suggested it as a troubleshooter.
I made that change and my results were:
As before it did not switch to the tft but the tft.log changed to:
is it HDMI or DMT?
state 0x12001a [HDMI DMT (4) RGB full 4:3], 640x480 @ 60Hz, progressive
switch on PiTFT
If that does not give a result then there is one other change you could make:
Add the options from the .conf to rc.local too.

Code: Select all

echo "is it HDMI or DVI?" > /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 frequency=32000000
fi
and rename /etc/modprobe.d/adafruit.conf (for example add .save to it)

If that doesn't work...

Gr.
Dirk.
Changed the line in rc.local, I did not have a /etc/modprobe.d/adafruit.conf I have a /etc/modprobe.d/fbtft_device.conf so I renamed that. Then rebooted, my results were:
It did not switch and the tft.log was the same as 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 20, 2014 7:31 pm

Does it matter that I never set it to boot to the tft?
I am downloading the tft optimized image right now, to put on another sd card, but I don't really want to have to reinstall all my other packages if I don't have to.

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

Re: Dual screen HDMI and 2.8 PiTFT

Sun Dec 21, 2014 5:44 am

Got the new image setup and it did not switch to the HDMI but the the tft.log says:

is it HDMI or DMT?
state 0x12001a [HDMI CEA (16) RGB lim 16:9], 1920x1080 @ 60Hz, progressive
switch on PiTFT <<-------- (I think)

so I am going to test for CEA or maybe CEA (16).
result:

is it HDMI or DMT?
state 0x120016 DVI DMT (35) RGB full 5:4], 1280x1024 @ 60Hz, progressive
switch on PiTFT <<---------(I'm sure)

OK I'm totally confused now and its late so I am going to bed ... I'll try again in the morning

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

Re: Dual screen HDMI and 2.8 PiTFT

Sun Dec 21, 2014 6:03 am

I just realized that I only changed the rc.local file and did not comment out the line in the other file, I will do that in the morning.

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

Re: Dual screen HDMI and 2.8 PiTFT

Mon Dec 22, 2014 5:43 pm

Just to make sure that we are still on the same page here are all of my files / code.

/boot/config.txt

Code: Select all

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=0

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=25
#overscan_right=25
#overscan_top=25
#overscan_bottom=25

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1920
#framebuffer_height=1440

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=4 # 87
# Put your VGA monitor resolution below
# hdmi_cvt =       
# width        width in pixels
# height       height in pixels
# framerate    framerate in Hz
# aspect       aspect ratio 1=4:3, 2=14:9, 3=16:9, 4=5:4, 5=16:10, 6=15:9
# margins      0=margins disabled, 1=margins enabled
# interlace    0=progressive, 1=interlaced
# rb           0=normal, 1=reduced blanking

# For example, 800x600 @ 60 Hz
#hdmi_cvt=800 600 60 1 0 0 1
# or maybe 800x480 @ 60 Hz
#hdmi_cvt=800 480 60 6 0 0 1
# or, 1024 x 768 @ 50 Hz
#hdmi_cvt=1024 768 60 1 0 0 1
# or if you're not sure, nothing beats 640x480
#hdmi_cvt=640 460 60 1 0 0 1

# see http://www.raspberrypi.org/forum/viewtopic.php?f=29&t=24679

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
###############################################################
### THIS LINE IS WHAT ENABLES THE AUDIO OUT OF THE ADAPTER! ###
#hdmi_drive=2
###############################################################

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
arm_freq=800

######### My Tweaks ##########
#disable_overscan=0
#hdmi_cvt=640 480 60 1 0 0 1
hdmi_drive=2
#hdmi_group=1
#hdmi_mode=4
#overscan_left=-40
#overscan_right=-47
#overscan_top=-37
#overscan_bottom=-400

# NOOBS Auto-generated Settings:

hdmi_force_hotplug=1
config_hdmi_boost=4
start_x=1
gpu_mem=128
core_freq=250
sdram_freq=400
over_voltage=0
/etc/modules

Code: Select all

# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
# Parameters can be specified after the module name.

i2c-bcm2708
i2c-dev
# spi-bcm2708
# fbtft_device
snd-bcm2835
/etc/rc.local I added some code to get information about the framebuffer.

Code: Select all

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# ###################################  Set Things Up For My Project  ##################################
echo "********************************************************************************"
echo "*****                                                                      *****"
echo "*****                  Setting Things Up For My Project                    *****"
echo "*****                                                                      *****"
echo "********************************************************************************"

echo "*****"
sudo /usr/sbin/gpsd -n -F /var/run/gpsd.sock /dev/ttyAMA0 &
echo "*****"
sudo /usr/bin/stty -F /dev/ttyAMA0 38400 &
echo "*****"

sudo ifconfig

    cp /home/pi/tft.log /home/pi/tft_old.log
    echo "is it HDMI or DMT?" > /home/pi/tft.log
    /usr/bin/tvservice -s >> /home/pi/tft.log
    echo "Framebuffer information" >> /home/pi/tft.log
    /bin/fbset -i >> /home/pi/tft.log
    if (/usr/bin/tvservice -s | /bin/egrep '(35)') ; then   ####  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 spi-bcm2708
        modprobe fbtft_device name=adafruitrt28 rotate=90 frequency=32000000
      #  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
      #  export FRAMEBUFFER-/dev/fb1 startx
    fi
echo "********************************************************************************"

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi

exit 0
/home/pi/tft.log With the HDMI plugged in. Original sd card not the pitft image.

Code: Select all

is it HDMI or DMT?
state 0x12001a [HDMI DMT (35) RGB full 5:4], 1280x1024 @ 60Hz, progressive
Framebuffer information

mode "1280x1024"
    geometry 1280 1024 1280 1024 16
    timings 0 0 0 0 0 0 0
    rgba 5/11,6/5,5/0,0/16
endmode

Frame buffer device information:
    Name        : BCM2708 FB
    Address     : 0x18006000
    Size        : 2621440
    Type        : PACKED PIXELS
    Visual      : TRUECOLOR
    XPanStep    : 0
    YPanStep    : 0
    YWrapStep   : 0
    LineLength  : 2560
    Accelerator : No
HDMI / DVI screen
/home/pi/tft_old.log Without the HDMI plugged in.Original sd card not the pitft image.

Code: Select all

is it HDMI or DMT?
state 0x12001a [HDMI DMT (4) RGB full 4:3], 640x480 @ 60Hz, progressive
Framebuffer information

mode "640x480"
    geometry 640 480 640 480 16
    timings 0 0 0 0 0 0 0
    rgba 5/11,6/5,5/0,0/16
endmode

Frame buffer device information:
    Name        : BCM2708 FB
    Address     : 0x18006000
    Size        : 614400
    Type        : PACKED PIXELS
    Visual      : TRUECOLOR
    XPanStep    : 0
    YPanStep    : 0
    YWrapStep   : 0
    LineLength  : 1280
    Accelerator : No
switch on PiTFT
Looks like we are not changing the frambuffer, only changing the mode.

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

Re: Dual screen HDMI and 2.8 PiTFT

Mon Dec 22, 2014 11:17 pm

Just one thing to start with: you don't have to move 'spi_bcm2708' from /etc/modules to rc.local.
It would mean you have spi deactivated if you're using a HDMI monitor.

But I think I have found the main culprit.
I played around with the remaining hdmi settings in your config.txt and it appears that 'hdmi_force_hotplug' forces HDMI on.
I don't know if you need it, but for testing you could comment that one out to see if the tft screen is forced on or not.

If this works then you probably still have to make some changes for X, but let's not get over-excited just yet ;)

Gr
Dirk.

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

Re: Dual screen HDMI and 2.8 PiTFT

Mon Dec 22, 2014 11:37 pm

DirkS wrote:Just one thing to start with: you don't have to move 'spi_bcm2708' from /etc/modules to rc.local.
It would mean you have spi deactivated if you're using a HDMI monitor.
Ok I will change that.
But I think I have found the main culprit.
I played around with the remaining hdmi settings in your config.txt and it appears that 'hdmi_force_hotplug' forces HDMI on.
I don't know if you need it, but for testing you could comment that one out to see if the tft screen is forced on or not.
I do not know if it is needed or not, I will check and find out. To bad it is such a PITA to fix it if it goes wrong. :)
If this works then you probably still have to make some changes for X, but let's not get over-excited just yet ;)

Gr
Dirk.
One thing at a time is good. :) I will post tft.logs when I am done.

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

Re: Dual screen HDMI and 2.8 PiTFT

Tue Dec 23, 2014 12:16 am

Some good news!!!!
using the original sd card not the pitft image.
After your last changes I found several things had changed:
1 'hdmi_force_hotplug' was not necessary.
2 Rebooting with HDMI unplugged - the tft turned dark, and the tft.log changed to NTSC, and when I plugged the HDMI cord back in I got nothing on the monitor (whoop whoop) here is the tft.log:

is it HDMI or DMT?
state 0x40002 [NTSC 4:3], 720x480 @ 60Hz, interlaced
Framebuffer information
mode "656x416"
geometry 656 416 656 416 16
timings 0 0 0 0 0 0 0
rgba 5/11,6/5,5/0,0/16
endmode

Frame buffer device information:
Name : BCM2708 FB
Address : 0x18006000
Size : 545792
Type : PACKED PIXELS
Visual : TRUECOLOR
XPanStep : 0
YPanStep : 0
YWrapStep : 0
LineLength : 1312
Accelerator : No
switch on PiTFT

3 Rebooting with HDMI plugged in - the tft stayed bright, and the tft.log did not change from what we have been getting before.
I will change the test back to the HDMI version, or should we test for !0x40002 (that is not0x40002).
I am going to try the HDMI version now.

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

Re: Dual screen HDMI and 2.8 PiTFT

Fri Dec 26, 2014 3:17 am

I have been away for a couple of days, my dad was in the hospital.
Testing for HDMI works just the same as the above, I think it is switching to the TFT but there is some setting or something that is keeping it from displaying anything. Any ideas?

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

Re: Dual screen HDMI and 2.8 PiTFT

Sun Dec 28, 2014 4:43 pm

I'm a bit lost at the moment. Not sure what the current status is.

I think it is:
* If you start up with HDMI: HDMI screen works fine.
* If you start up with HDMI unplugged: pitft lights up, but doesn't show text (login screen).
is this correct?

Gr.
Dirk.

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

Re: Dual screen HDMI and 2.8 PiTFT

Sun Dec 28, 2014 4:51 pm

Try adding 'fbcon=map:10' to the end of the first line of /etc/cmdline.txt (see https://github.com/notro/fbtft/wiki/Boo ... le-console, don't bother with the font right now)
It connects the default console with framebuffer 1 (pitft). It should not have any effect if pitft is switched off.

It's also possible to do this after logging in with

Code: Select all

con2fbmap 1 1
Gr.
Dirk.

User avatar
ragnarjensen
Posts: 332
Joined: Wed May 15, 2013 6:13 pm
Location: Stockholm, Sweden
Contact: Website

Re: Dual screen HDMI and 2.8 PiTFT

Sun Dec 28, 2014 11:01 pm

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

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

Re: Dual screen HDMI and 2.8 PiTFT

Mon Dec 29, 2014 8:57 am

DirkS wrote:I'm a bit lost at the moment. Not sure what the current status is.

I think it is:
* If you start up with HDMI: HDMI screen works fine.
yes
* If you start up with HDMI unplugged: pitft lights up, but doesn't show text (login screen).
is this correct?
close... it always starts out "bright" or "lit up" on power up then goes "dark" when "accessed" (this is true when using the PiTFT image also, but it then shows the last part of the boot, then either a login or desktop depending on settings) now it starts "bright" then goes dark (as it should) but no display at all after that.

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

Re: Dual screen HDMI and 2.8 PiTFT

Mon Dec 29, 2014 9:03 am

DirkS wrote:Try adding 'fbcon=map:10' to the end of the first line of /etc/cmdline.txt (see https://github.com/notro/fbtft/wiki/Boo ... le-console, don't bother with the font right now)
It connects the default console with framebuffer 1 (pitft). It should not have any effect if pitft is switched off.

It's also possible to do this after logging in with

Code: Select all

con2fbmap 1 1
Gr.
Dirk.
I don't have an /etc/cmdline.txt.

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