When I purchased my first Raspberry Pi two years ago, I was unable to hook it up to a proper monitor to do the initial configuration. All I had available was an aging JVC rear-projection TV in my family room. Shortly thereafter I bought a second Raspberry Pi along with an HDMI-DVI cable so I could use one of my Sun 19″ flat panel monitors. The cable worked well but since I normally run my Pi’s headless I gave it to my son and would simply use his desk whenever I needed to do an initial config.
Fast forward two years and the cable has disappeared into the void. This time around I simply disconnected the Xbox 360 from the 36″ Hitachi HDTV and used an HDMI cable to attach the Pi. I recently purchased an iPazzPort wireless keyboard/touchpad so I didn’t have to drag a full-sized keyboard into the family room. The Hitachi also has a USB port for service use and I used it to provide power for the Pi.
Of course, taking all that into the family room and back to my office can get tiresome, even if it’s only about a 12-foot walk. I then bought a LinkS Active HDMI to VGA adapter from Amazon so I could use one of the Samsung SyncMaster S24A460 monitors on my desk. However, even though I made several attempts, I was unable to get the LinkS adapter to work so I returned it to Amazon. To be fair, I don’t know if the real reason is that the adapter didn’t work or if it was just because I didn’t think of the right method to get it to work. I had read that several Pi owners had been able to use the Ableconn HDMI2VGAD Active HDMI to VGA Adapter successfully so I ordered one.
One important thing to note is that when selecting an HDMI-to-VGA adapter you need to make sure that the adapter draws very little power from the Pi or that it is externally powered. Otherwise, it will draw too much power from the Pi and you will be unable to use it. The Ableconn adapter is bus-powered from the Pi’s HDMI port and does not draw too much power.
I had mixed experiences with the Ableconn at first. I was unable to get the adapter to work initially when I first powered up the Pi. However, if I connected to the Pi with SSH and rebooted it, the adapter worked and I was able to use the monitor. I was frustrated and thought about sending it back to Amazon as well, but I didn’t and I thought about the issue for a while.
I tried several other times to get the adapter to work and was able to recreate the problem consistently. When the Pi was initially powered up, the adapter would not work but it did when the Pi was already powered up and I just issued a reboot command. I figured that either the Pi itself was unable to properly detect the attached monitor when initially powered up or maybe that the adapter had not had time to properly sync up with the monitor before the Pi attempted to initialize the HDMI port. I don’t have any way of verifying this either way but I highly suspect that the latter is the reason.
I ran “
tvservice -s” to see what the settings the HDMI port was using. The result was, “
state 0x40002 [NTSC 4:3], 720x480 @ 60.00Hz, interlaced“. Obviously, this mode didn’t work for me but knowing what settings were used gave me a baseline which which I could compare future results.
My first step to resolve the matter was to edit
/boot/config.txt and uncomment the line containing “
hdmi_force_hotplug=1” in order to force the Pi to use the HDMI rather than the composite port.
This worked. Sort of. I got a display on the monitor but it was mostly green and barely legible. It was a change from the first time so I knew I was making progress.
Obviously, this was not the correct mode either. The “
tvservice -s” output was, “
state 0x120016 [DVI DMT (4) RGB full 4:3], 640x480 @ 60.00Hz, progressive“.
I looked over
/boot/config.txt and saw a couple of parameters that could be of use so I uncommented them. According to the comment in
/boot/config.txt this would place the port in VGA mode.
I was back to the black screen. The output from “
tvservice -s” was “
state 0x12001a [HDMI CEA (1) RGB full 4:3], 640x480 @ 60.00Hz, progressive“. I commented out the
hdmi_mode lines and issued a “
sudo reboot” command. Up to this point all my reboots were complete power cycles. I need to see what the mode was when it worked.
As with the non-power-cycle reboots before, tere was a display on the monitor. The output from “
tvscreen -s” was “
state 0x12001a [HDMI CEA (16) RGB lim 16:9], 1920x1080 @ 60.00Hz, progressive“. Now I knew what mode I needed to put the monitor in.
As the old adage goes, “When in doubt, read the documentation.” I went to https://www.raspberrypi.org/documentation/configuration/config-txt.md to find out how to set this mode in
There are three different settings for
|0||Auto-detect from EDID|
Since the “
tvservice -s” output contained “
CEA” I used “
For hdmi_mode there are 59 different settings when using “
hdmi_group=1“, I won’t list them all here but you can see them at https://www.raspberrypi.org/documentation/configuration/config-txt.md. My Samsung monitor’s recommended resolution is 1920×1080 so I used “
hdmi_mode=16” for 1080p resolution.
Time for a power-cycle reboot.
There were black bars around the screen so I disabled overscan in
/boot/config.txt by uncommenting the line “
disable_overscan=1” and rebooted again. This time I had a perfect
display on the monitor.
In summary, here are the settings I enabled in
disable_overscan=1 hdmi_force_hotplug=1 hdmi_group=1 hdmi_mode=16
This was all performed on a Raspberry Pi Model B which has both an HDMI and a composite output. I tested this on my Raspberry Pi 2 with the single HDMI and had to go through the same process.
If you run into a black screen when you first boot a new Raspbian image be sure to do the following so as to avoid corrupting your SD card and having to write the Raspbian image again. Remember that your first boot of a freshly installed Raspbian image automatically starts raspi-config. You will be entering these keystrokes blindly so be careful.
Tab twice and then
Space. This will exit raspi-config.
2. Then enter
sudo shutdown -h now to shut the Pi down. Keep an eye on the green activity LED on the Pi. Once it flashes ten times in a row and stops the Pi is shutdown and it is safe to remove the power.
At this point, remove the SD card from the Pi and insert it into another system and edit the
/boot/config.txt file and make your updates. Then eject the card, insert it back into your Pi and power it back up. This time you will need to login as the
pi user and manually run “
sudo raspi-config” since it ran automatically when you first booted the image.
Hopefully this has been helpful. If so, please leave a comment!