17

I've found that my Raspberry Pi2's HDMI port only works if there's something attached to it when the RPi initially boots. If it boots with nothing attached, and I later attach a monitor, nothing shows up on the monitor.

My application is headless, but occasionally I want to attach a monitor to do debugging, and in those cases having to reboot the RPi risks losing debugging information.

How do I configure the RPi to either keep the HDMI port "turned on" even when nothing's connected, or continuously poll the HDMI port and enable the driver when it finds something there?

2
  • 2
    what debug info can't you get via SSH? Jan 6, 2016 at 17:38
  • 1
    @SteveRobillard, Info about why SSH/Wifi/LAN isn't working :)
    – Cerin
    Jan 7, 2016 at 0:48

3 Answers 3

9

To /boot/config.txt add:

hdmi_force_hotplug=1

You will have to reboot to make that effective (this applies to anything in config.txt), but the display should work now if you plug it in after boot. However, the resolution may not be set as correctly as it is when booted with the screen attached. To ensure that, set an explicit mode as explained here.

6
  • This requires a reboot ...
    – flakeshake
    Apr 25, 2017 at 11:46
  • @flakeshake Which is why the last paragraph begins, "You will have to reboot to make that effective..." The monitor does not have to be attached at the time, however.
    – goldilocks
    Apr 25, 2017 at 12:08
  • I have ubuntu desktop on my raspberry pi 4. Does the same instructions work? The /boot/config.txt file doesn't exist by default
    – vishesh
    May 7, 2021 at 9:25
  • @vishesh You should be able to just create one and it will be used. It is applied by the GPU firmware, so what OS you are running doesn't matter.
    – goldilocks
    May 9, 2021 at 15:41
  • Does this setting us more CPU resources?
    – Kaigo
    Apr 19, 2022 at 8:56
7

Try

tvservice --explicit="DMT 35 HDMI"

This powers on HDMI explicitly with "DMT mode 35" which is 60 HZ at 1280x1024 pixels.

There is also tvservice --off if you've got enough.

For more information try both

tvservice --help and looking here for a tabular listing of modes.

0

For me, with an "ACER V233H" LCD Monitor connecting with a DVI to HDMI converter to My RPi3, I had to set a few variables in the /boot/config.txt to make the "HDMI Force Hotplug" work with "1024x768 XGA 60Hz":

hdmi_force_hotplug=1
hdmi_group=1
hdmi_mode=16
hdmi_drive=1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.