Sunday, July 21, 2013

Let there be /boot/config.txt

So I'm trying to get my display (an LG M2352T-PZ - 23" Full HD IPS LED-TV and computer monitor that I bought here in Sweden at SIBA) to display a full 1920x780 through HDMI. Your monitor might be different, so beware!

I'm using the NOOBS_v1_1 distribution for the Raspberry Pi, and I think the current one is NOOBS_v1_2 and I think the 1.2 handles this better, but I don't want to reinstall everything from scratch every time a new version arrives. Besides, I want to understand how this works.

There is a critical file in the /boot partition called config.txt that apparently sets up the frame buffer. There is a description at RPiconfig - eLinux.org that explains how it works. When I run vcgencmd to probe values I get:

pi@raspberrypi /boot $ vcgencmd get_config int
disable_splash=1
temp_limit=85
force_pwm_open=1
second_boot=1
pi@raspberrypi /boot $ vcgencmd get_config str
pi@raspberrypi /boot $

Note that there are no "str" keys to be shown. Now I want to fiddle with these values, but first I want a copy:

pi@raspberrypi /boot $ sudo cp config.txt config.txt.bak

Then I edit the file:

pi@raspberrypi /boot $ sudo viconfig.txt

and I add the following lines:

framebuffer_width=1920
framebuffer_height=1080
hdmi_force_hotplug=1

and I save and reboot. I have CRL-ALT-DEL set to reboot, and rebooting into shell, not directly into X. I log in as pi and do a startx.

My monitor says 16:9, 1080p at 60hz and is able to render perfectly all the way to the edges. Looks like it worked! (I have redacted a stupid mistake where I put in 780 instead of 1080. Oh well.)

I have no idea how much this traded off frame buffer for available RAM, but that is for future discovery.

Update 2013-07-23:

For the observant ones who noticed that I also set:

hdmi_force_hotplug=1

This is to always use the HDMI output. The default is to probe the HDMI to see if it is connected and otherwise default to the standard video output. This is problematic for me as I always use HDMI, but sometimes the TV/Monitor isn't on, or it has timed out and is in power saver mode (the timeout is stupidly short, 30s or something if there is no input on the selected HDMI input.) This way I can turn the Raspberry Pi and the TV in any order and it still works.

fbset

I also came across a command for probing (and fiddling with) the frame buffer. Check out fbset(1). This is what I get after the above changes to config.txt:

pi@raspberrypi ~ $ fbset

mode "1920x1080"
    geometry 1920 1080 1920 1080 16
    timings 0 0 0 0 0 0 0
    rgba 5/11,6/5,5/0,0/16
endmode

No comments:

Post a Comment