Raspberry Pi HDMI - VGA Adapter
Some time ago, I ordered an HDMI to VGA adapter to use with my Raspberry PI, and connect it to an old monitor I have for using it as a secondary PC for lightweight tasks.
When I first connected the adapter to the RPi, it worked out of the box, without any modifications, with my current computer monitor. I tested it also with my livingroom TV and worked flawlesly.
The problems came when I tried to use the old monitor. My current monitor and TV are Full HD capable, and have resolutions aspect ratios for HD standards, but this old monitor maximum resolution is 1280x1024 pixels, and when I plugged the adapter in it, the screen showed pitch black.
So, having verified that VGA adapter was functional, I put hands on google and did some searchs about this kind of situations. Below is what I have found, and the information you need to know if you get to this situation too.
Note: I was using a Raspbian image to do this work. It sould be no problem to use this instructions in most of the images that can be used with Raspberry Pi due to the fact we are modifying bootloader options in config.txt file, not OS dependant configuration.
First of all, we have to edit the config.txt file. Usually, we can find this file in /boot. The file contains a lot of options related to several aspects of the Raspberry Pi parameters like overclocking speed, memory partition for video/system, and a lot or more advanced options like the HDMI related we want to modify.
Specially this ones:
hdmi_force_hotplug=1
hdmi_drive=2
hdmi_group=1
hdmi_mode=1
Each of this settings changes the way the HDMI driver behaves. That will allow us to switch to monitor mode and specify our monitor resolution:
hdmi_force_hotplug: This setting set to 1 will simulate that HDMI plug is always plugged in hdmi_drive: This one allow us to choose between 1 (DVI) and 2 (HDMI) modes. The main difference is DVI mode does not transport audio. If our VGA adapter has an audio output (almost all have it), then choose the HDMI mode. hdmi_group: Defines the HDMI type between 0 (automatically chose preferred value from EDID information), 1 (CEA mode, intended for TVs) or 2 (DMT mode, intended for monitors) hdmi_mode: Defines the resolution we want the output to be set. We have a list of valid modes for each mode at RPiconfig under the hdmi_mode explaination option. As you can see, there are plenty of settings that can be tweaked for this task, like overscan values etc, but with just this four, we can get our VGA adapter working.
In my case, the configuration I finally used was this:
hdmi_force_hotplug=1
hdmi_drive=2
hdmi_group=2
hdmi_mode=35