Raspberry Pi, Raspbian and an old TV with DVI

I finally bought some Raspberry Pi stuff. I picked up the package yesterday after my night shift at and mounted one of them in the case I got for it and connected it to my ancient tv, with DVI as the most modern input choice.
The first thing I tried was raspbmc. It boots, and works, bMy Raspberry Pi in its Pi Holder aluminum case, and some dust.ut I’m not very impressed with XBMC, and not with the analog audio, which doesn’t work at all in it, except for a few seconds when listening to a radio stream, but most of the time it was only giving some clicks in the speakers when switching streams. It’s not for me anyway. Moving on.

Then I fell asleep, and now it is Saturday.

 

Raspbian

So, off with that. Next thing to try will be the Raspberry Pi foundation Raspbian image. (After that I will probably end up using the Raspbian installer and make my own stripped down base image, or check if there exists some sane image from here, we’ll see.).

Installation

Note: This is not a guide or how-to, and possibly not correct, always follow the instructions of whatever it is you are installing. (Even though this might be correct, and even more so than those.)

So let’s try the “official” Raspbian image (of the unofficial Debian port Raspbian):

beardy@messtent:~/raspberrypi/raspbian$ time dd bs=4M if=2013-02-09-wheezy-raspbian.img of=/dev/mmcblk0
462+1 records in
462+1 records out
1939865600 bytes (1.9 GB) copied, 548.189 s, 3.5 MB/s

real	9m8.279s
user	0m0.000s
sys	0m11.733s

Configuration

Raspberry Pi connected to DVI on old tv.

Always change the default password.

Enlarged partition.

Booted it, used raspi-config to resize the partition to utilize the whole SD-card. Set my preferred timezone and keyboard layout and set a new password for the default user. Always change default passwords.

Wi-Fi

I bought this little USB 802.11n NIC which seems to work very well, even when sitting right next to a 2.4Ghz wireless keyboard dongle. It is a Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter

802.11n Wifi adapter in Raspberry Pi

/etc/network/interfaces:

auto lo

iface lo inet loopback
iface eth0 inet dhcp

# Sane Wi-Fi configuration //beardy
allow-hotplug wlan0
iface wlan0 inet dhcp
   wpa-ssid "myssid"
   wpa-passphrase "mywpa2passphrase"

# commented out raspbian default, or whoever's it is //beardy
#iface wlan0 inet manual
#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
#iface default inet dhcp

Then I cycled the wlan0 interface and:

WE GET SIGNAL.

pi@raspberrypi ~ $ iwconfig 
wlan0     IEEE 802.11bgn  ESSID:"myssid"  Nickname:"<WIFI@REALTEK>"
          Mode:Managed  Frequency:2.412 GHz  Access Point: 00:0C:42:xx:xx:xx   
          Bit Rate:150 Mb/s   Sensitivity:0/0  
          Retry:off   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality=100/100  Signal level=100/100  Noise level=0/100
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

I also toggled SSH in raspi-config on first boot, not sure if it was default on or off, but now it is on atleast.
Edited /etc/ssh/sshd_config and set PermitRootLogin no and restarted sshd by running sudo /etc/init.d/sshd restart.

Update

Installed screen and denyhosts (more on this another time, always install it), update/upgrade in aptitude.

Framebuffer

With that out of the way it’s time to figure out the correct mode for my monitor (my tv, with the Raspberry Pi connected with an HDMI to DVI cable), because it isn’t very happy with the current mode (as seen in the images above). The current mode is:

pi@raspberrypi ~ $ fbset 

mode "800x600"
    geometry 800 600 800 600 16
    timings 0 0 0 0 0 0 0
    rgba 5/11,6/5,5/0,0/16
endmode

But it turned Sunday, and I came to the conclusion that this is not what needs configuring. The thing that needs changing is the HDMI mode that is set.

config.txt

/boot/config.txt is the configuration file for the Pi’s bootloader. The best documentation on it is found on this page at elinux.org. config.txt is where the HDMI mode, the framebuffer size, overclocking, RAM-split configuration and more is configured.
After some experimenting and trial and error I concluded that the following is what my tv wants:

# Forcing group=2, DMT and mode=39, 1360x768  60Hz //beardy
hdmi_group=2     
hdmi_mode=39

Booting with this mode gives me 1360×768 60Hz, and the OUT OF RANGE message is gone. The defaults in config.txt sets the framebuffer to the resolution picked minus the configured overscan, if any.

Now, it is possible to change HDMI mode on the fly without having to reboot, using the tvservice program. It can change HDMI mode, and also control the RCA composite video-out and force audio modes. This utility can also dump the EDID-data from your monitor, to be parsed by another tool simply called edidparser to make the information readable for humans.

Analyze your monitor

This is how I should have gone about this from the beginning.

Set the output format to VGA 60Hz (hdmi_group=1 hdmi_mode=1) and boot up the Raspberry Pi
Enter the following command to give a list of CEA supported modes

/opt/vc/bin/tvservice -m CEA

Enter the following command to give a list of DMT supported modes

/opt/vc/bin/tvservice -m DMT

Enter the following command to show your current state

/opt/vc/bin/tvservice -s

Enter the following commands to dump more detailed information from your monitor

/opt/vc/bin/tvservice -d edid.dat
/opt/vc/bin/edidparser edid.dat

My EDID

From the parsed EDID of my monitor I can see the following:

HDMI:EDID version 1.1, 0 extensions, screen size 70x40 cm
HDMI:EDID features - videodef 0x81 !standby !suspend !active off; colour encoding:RGB444|YCbCr422; sRGB is not default colourspace; preferred format is not native; does not support GTF
HDMI:EDID found monitor range descriptor tag 0xfd
HDMI:EDID monitor range offsets: V min=0, V max=0, H min=0, H max=0
HDMI:EDID monitor range: vertical is 56-85 Hz, horizontal is 30-80 kHz, max pixel clock is 90 MHz
HDMI:EDID monitor range does not support GTF
HDMI:EDID found monitor name descriptor tag 0xfc
HDMI:EDID monitor name is DT-3003X
HDMI:EDID found preferred DMT detail timing format: 800x600p @ 85 Hz (12)
HDMI:EDID failed to find a matching detail format for 1360x768p hfp:64 hs:144 hbp:208 vfp:1 vs:5 vbp:21 pixel clock:84 MHz
HDMI:EDID calculated refresh rate is 60 Hz
HDMI:EDID guessing the format to be 1360x768p @60 Hz
HDMI:EDID found DMT detail timing format: 1360x768p @ 60 Hz (39)
HDMI:EDID established timing I/II bytes are BF EE 00
HDMI:EDID found DMT format: code 4, 640x480p @ 60 Hz in established timing I/II
HDMI:EDID found DMT format: code 5, 640x480p @ 72 Hz in established timing I/II
HDMI:EDID found DMT format: code 6, 640x480p @ 75 Hz in established timing I/II
HDMI:EDID found DMT format: code 8, 800x600p @ 56 Hz in established timing I/II
HDMI:EDID found DMT format: code 9, 800x600p @ 60 Hz in established timing I/II
HDMI:EDID found DMT format: code 10, 800x600p @ 72 Hz in established timing I/II
HDMI:EDID found DMT format: code 11, 800x600p @ 75 Hz in established timing I/II
HDMI:EDID found DMT format: code 16, 1024x768p @ 60 Hz in established timing I/II
HDMI:EDID found DMT format: code 17, 1024x768p @ 70 Hz in established timing I/II
HDMI:EDID found DMT format: code 18, 1024x768p @ 75 Hz in established timing I/II

HDMI:EDID standard timings block x 8: 0x3119 31C9 3B19 3BC9 4500 450F 6100 610F 
HDMI:EDID unknown standard timing 640x640 @ 85 Hz aspect ratio (1:1)
HDMI:EDID unknown standard timing 640x360 @ 69 Hz aspect ratio (16:9)
HDMI:EDID unknown standard timing 720x720 @ 85 Hz aspect ratio (1:1)
HDMI:EDID unknown standard timing 720x405 @ 69 Hz aspect ratio (16:9)
HDMI:EDID unknown standard timing 800x800 @ 60 Hz aspect ratio (1:1)
HDMI:EDID unknown standard timing 800x800 @ 75 Hz aspect ratio (1:1)
HDMI:EDID unknown standard timing 1024x1024 @ 60 Hz aspect ratio (1:1)
HDMI:EDID unknown standard timing 1024x1024 @ 75 Hz aspect ratio (1:1)
HDMI:EDID filtering formats with pixel clock > 162 MHz or h. blanking > 1023
HDMI:EDID best score mode initialised to DMT (4) 640x480p @ 60 Hz with pixel clock 25 MHz (score 0)
HDMI:EDID best score mode is now DMT (4) 640x480p @ 60 Hz with pixel clock 25 MHz (score 36864)
HDMI:EDID best score mode is now DMT (5) 640x480p @ 72 Hz with pixel clock 31 MHz (score 44236)
HDMI:EDID best score mode is now DMT (6) 640x480p @ 75 Hz with pixel clock 31 MHz (score 46080)
HDMI:EDID best score mode is now DMT (8) 800x600p @ 56 Hz with pixel clock 36 MHz (score 53760)
HDMI:EDID best score mode is now DMT (9) 800x600p @ 60 Hz with pixel clock 40 MHz (score 57600)
HDMI:EDID best score mode is now DMT (10) 800x600p @ 72 Hz with pixel clock 50 MHz (score 69120)
HDMI:EDID best score mode is now DMT (11) 800x600p @ 75 Hz with pixel clock 49 MHz (score 72000)
HDMI:EDID best score mode is now DMT (12) 800x600p @ 85 Hz with pixel clock 56 MHz (score 5081600)
HDMI:EDID DMT mode (16) 1024x768p @ 60 Hz with pixel clock 65 MHz has a score of 94370
HDMI:EDID DMT mode (17) 1024x768p @ 70 Hz with pixel clock 75 MHz has a score of 110100
HDMI:EDID DMT mode (18) 1024x768p @ 75 Hz with pixel clock 78 MHz has a score of 117964
HDMI:EDID DMT mode (39) 1360x768p @ 60 Hz with pixel clock 85 MHz has a score of 4625336
HDMI:EDID preferred mode remained as DMT (12) 800x600p @ 85 Hz with pixel clock 56 MHz
HDMI:EDID has only DVI support and no audio support
edid_parser exited with code 0

So now there is an explanation for why it chose the DMT (12) 800x600p @ 85 Hz with pixel clock 56 MHz-mode, well not exactly why, but the reason for it atleast, it scored highest.
Another interesting piece of information is monitor name is DT-3003X. This can also be gotten with the command tvservice --name:

pi@raspberrypi ~ $ tvservice --name
device_name=GSM-DT-3003X

Anyway, the information:

EDID DMT mode (39) 1360x768p @ 60 Hz with pixel clock 85 MHz has a score of 4625336

is the reason (in retrospect) I chose to force that mode in my config.txt.

DT-3003X

My TV is branded “PROline”, I bought it in 2005. I don’t know where it was assembled, eastern Europe probably. The information above interestingly shows that the DVI and VGA board in it seems to be manufactured by LG. Searching for it reveals “LG DT-3003X Driver Board” which looks like this:

LG_DT-3003X_Driver_Board

Getting comfortable

After setting a better video mode I ran

sudo dpkg-reconfigure console-setup

and chose the Terminus font in a size I liked. I purged LXDE, installed scrotwm, started lightdm which was installed already, installed xfce4-terminal, and started playing the SLAYRadio stream with omxplayer to test the audio output. Now I can go on DOING something. Like figure out how to control the volume of the analog audio output.

rpi_6

rpi_7

rpi_8

Feel free to comment, thank you for reading.

Links

http://elinux.org/RPi_config.txt
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=29&t=24679
https://en.wikipedia.org/wiki/Extended_display_identification_data
https://en.wikipedia.org/wiki/HDMI

3 Replies to “Raspberry Pi, Raspbian and an old TV with DVI”

  1. Interesting read. Where did you get the Raspberry Pi from, and where the case? How much did they cost? 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *