2014-07-11

Tweaking Rapsberry Pi HDMI

Tweaking Rapsberry Pi HDMI

fixed monitor size problem for acer panel + raspberry pi

Found several interesting things while examining the drive image(s) for the 8-gig Raspbian image that became inoperable on the Pi during intensive installation and removal of build packages...

  1. The Raspbian Linux install image is actuall more than one partition. When the SD card is plugged into a USB SD card reader connected to the T42 system, two partitions are shown [and optionally auto-mounted] for the device. These show up here under Mint / Debian ~ Ubunbtu as

        /dev/sdb1
        /dev/sdb2 
    

    which are mounted at

        /media/boot
        /media/fc254b57-8fff-4f96-9609-ea202d871acf
    
    respectively.

  2. Not sure why /dev/sdb2 is not mounted on /media/sdb2 as one might expect...

    Further investigation includes checking the mount data from within the pi acconut on the Raspbian install on the Raspberry Pi device itself.

    This shows that the root file system of the Pi is mounted as

        /dev/root  -> /
    

    Since there is no way to identify hard disc partitions from that mount listing, we try

        ls -lh /dev/root
    

    which returns

        lrwxrwxrwx 1 root root 9 Jul 11 08:10 /dev/root -> mmcblk0p2
    

    so we try

        ls -lh /dev/mmcblk0*
    

    which gives us

        brw-rw---T 1 root floppy 179, 0 Jan  1  1970 /dev/mmcblk0
        brw-rw---T 1 root floppy 179, 1 Jan  1  1970 /dev/mmcblk0p1
        brw-rw---T 1 root floppy 179, 2 Jul 11 08:10 /dev/mmcblk0p2
    

    ... furthermore, looking in the /boot directory of the filesystem mounted on / we see that there is nothing there -- it is not the location of the filesystem automounted from /dev/sdb1 on /media/boot on the T42 system.

    So this:

       sudo mount /dev/mmcblk0p1 /boot
    

    and

        ls -lh /boot total 9.5M
        -rwxr-xr-x 1 root root  18K Jul 10 02:48 bootcode.bin
        -rwxr-xr-x 1 root root  120 Jun 20 06:51 cmdline.txt
        -rwxr-xr-x 1 root root 1.2K Jul 11 08:10 config.txt
        -rwxr-xr-x 1 root root 2.1K Jul 10 02:48 fixup_cd.dat
        -rwxr-xr-x 1 root root 5.8 K Jul 10 02:48 fixup.dat
        -rwxr-xr-x 1 root root 8.7K Jul 10 02:48 fixup_x.dat
        -rwxr-xr-x 1 root root  137 Jun 20 10:33 issue.txt
        -rwxr-xr-x 1 root root 3.1M Jul 10 02:49 kernel.img
        -rwxr-xr-x 1 root root  19K Sep 25  2013 LICENSE.oracle
        -rwxr-xr-x 1 root root 503K Jul 10 02:48 start_cd.elf
        -rwxr-xr-x 1 root root 2.5M Jul 10 02:48 start.elf
        -rwxr-xr-x 1 root root 3.4M Jul 10 02:48 start_x.elf
    

    Which leads us to the next fascinating discovery:

  3. HDMI Boot-time Cofiguration Parameters

    cat /boot/config.txt 
    

    ... and find ...

        # uncomment if you get no picture on HDMI for a
        # default "safe" mode 
        hdml_safe=1
    
        # uncomment this if your display has a black border 
        # of unused pixels visible and your display can 
        # output without overscan 
        disable_overscan=1 
        # uncomment the following to adjust overscan. Use
        # positive numbers if console goes off screen, and 
        # negative if there is too much border 
        #overscan_left=16 
        #overscan_right=16 
        #overscan_top=16 
        #overscan_bottom=16 
    
        # uncomment to force a console size. By default 
        # it will be display's  size minus overscan. 
        framebuffer_width=1280 
        framebuffer_height=960 
    
        # 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=1
    
        # uncomment to force a HDMI mode rather than DVI. 
        # This can make audio work
        # in DMT (computer monitor) modes
        #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.
        #ar_freq=800
    
        # for more options see http://elinux.org/RPi_config.txt
        gpu_mem=128
        start_x=1
    

    Interesting - this config.txt file looks like it might have something to do with the raspi-config utility that's used to change many of the settings that are listed in the file.

    Even more interestingly, I don't remember seeing these setting in the curses interface raspi-config always presents. So. No idea what this stuff is, but it looks like these lines

        # 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=1
    
        # uncomment the following to adjust overscan. Use positive numbers if 
        # console goes off screen, and negative if there is too much border
        #overscan_left=16
        #overscan_right=16
        #overscan_top=16
        #overscan_bottom=16
    
        # uncomment to force a console size. By default it will be display's 
        # size minus overscan.
        framebuffer_width=1280
        framebuffer_height=960
    
        # 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=1
    
        # uncomment to force a HDMI mode rather than DVI. This can 
        # make audio work in DMT (computer monitor) modes
        #hdmi_drive=2
    
        # uncomment to increase signal to HDMI, if you have 
        # interference, blanking, or no display 
        #config_hdmi_boost=4
    

    ... may well have to do with the HDMI Video Sub-System Startup operations - not sure why this would be on a seperate partion, and not sure what the other files in this directory are, yet, but uncommenting the hdmi_safe line, the disable_overscan line, changing the framebuffer_width and framebuffer_height lines (uncomment and edit to have the values shown above) fixed the problem we were having of the Rapsberry Pi HDMI output locking itself to 1600x900 on acer 20" flat panel - the panel was intializing itself to 1280x960 - now it running with the X display nicely centered on the screen, but the panel's bezel-buttun MENU says that the display is set to 640x480.

    ... this after rebooting the Pi with settings as shown above; am guessing that the hdmi_safe=1 line may be responsible am checking the display dimensions again, commenting out the "safe" line again, and rebooting.

    So. After several hours messing about with these settings the best I can do right now is this:

        #hdmi_safe=1
        #disable_overscan=1
        overscan_left=-192
        overscan_right=96
        overscan_top=16
        overscan_bottom=0
        framebuffer_width=1280
        framebuffer_height=960
        #hdmi_force_hotplug=1
        #hdmi_group=1
        #hdmi_mode=1
        #hdmi_drive=2
        #config_hdmi_boost=4
    

    This gets the entire display on the screen (or at least so it appears thus far) but there is still a wide black border across the bottom of the screen - the overscan value can cause the console to write off the bottom edge of its display, but it does not reduce the size of that border area.

  4. The aspect ratio of the screen seems whack - 1280x960 - and there are obviously lines of pixels across hte bottom of the display that are not getting lit up - it looks like about 64 of them. This is as far as I'm prepared to go with this right now, since the immediate problem of the Pi drawing most of it's display off the right edge of the screen now seems to be solved.