Sunday, June 23, 2013

Force BeagleBone Black HDMI Resolution

UPDATE: You may find the modedb documentation helpful, in particular note you can add an 'M' to the settings below to force a non-standard resolution, and an 'e' to force the HDMI output to be enabled.  I also have another post on setting a custom resolution.

A lot of people seem to be having problems with the HDMI output on the BeagleBone Black (myself included, when I tried it...I usually live at the serial console).

While the newer image releases seem to be improving the operation of HDMI "out of the box", the auto-detection software always seems to pick some crazy resolution with my HDMI monitor and things just don't work properly.  If you don't see HDMI output or are still having problems with the latest images (like the display disappears once the 'Bone has booted), you can try forcing your resolution to something your monitor supports.

ALL HDMI monitors are REQUIRED to support 640x480@60 and one of 720x480@60 (NTSC) or 720x576@50 (PAL) depending on their native format.  If you force the 'Black output to one of these formats, you should get a working HDMI display.

To force the resolution, you need to add a kernel command line parameter in the uBoot file on the FAT partition of the SD Card (or in the eMMC boot partition if you're running out of the on-board memory).

The kernel command line parameter you need to pass is one of:
video=HDMI-A-1:640x480@60
video=HDMI-A-1:720x480@60
video=HDMI-A-1:720x576@50
...and typically you would add this to the optargs= setting to get it passed to the kernel, ie:
optargs=video=HDMI-A-1:640x480@60
Note that you can edit the uEnv.txt file on a Windows machine if you boot from an SD card, just be careful not to change the line endings.  If you're stuck with a 'Black that doesn't display an interface, upgrade to a recent Angstrom release and you'll at least have a serial console via USB you can use to edit the uEnv.txt file in the on-board eMMC.

If your HDMI is still not working, you can verify you got the setting actually passed to the kernel by looking at the kernel command line in /proc.  Here's mine (from a Debian based SD card boot):
$ cat /proc/cmdline
console=ttyO0,115200n8 video=HDMI-A-1:640x480@60 root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait fixrtc ip=
...if you see the "video=..." section and HDMI still isn't working, something lower level is wrong.

Once you get HDMI working at all, you can start to play around and see if you can get a higher resolution to work.  The 'Bone can't handle full 1080p60, but 720p should work on almost any modern HDMI display:
NTSC (North America, Japan):
  video=HDMI-A-1:1280x720@60

PAL (Europe):
  video=HDMI-A-1:1280x720@50
...configuring your HDMI display to disable overscan so you can see the entire image is left as an exercise for the reader!  :)

Note that my Samsung monitor/TV only disables overscan on one of the two HDMI inputs, and you have to set the source name to "DVI-PC" or it assumes you're feeding it from a video source and stretches the image a bit to get rid of any garbage at the edges.

IMPORTANT

All of the above only applies to what you see while the kernel is booting and simply verifies your monitor and BeagleBone will communicate properly.  Once the kernel boots, the BeagleBone launches a Gnome session which takes over full control of the display and picks it's own screen resolution.  My system typically defaults to 1080p24, which the BeagleBone can handle (vs. 1080p60, which requires a higher pixel clock frequency than the 'Bone can generate).

One issue I have had with the 'Black is if you do not have a keyboard or mouse plugged in, the system immediately goes into a power-saving mode and shuts down the HDMI output to turn off the monitor.  This apparently only happens if Ethernet is connected, which sets the system clock via NTP on boot (and makes your BeagleBone think it has been sitting idle 13+ years waiting for user input!).  You can disable the monitor power management for good via the graphical configuration settings in the GUI, or temporarily by giving the frame buffer a "wake up call" and telling it to come out of blanking:
echo 0 > /sys/class/graphics/fb0/blank
Obviously you have to do this from a serial console or an ssh session, and you'll need a mouse hooked to the BeagleBone temporarily to disable the display power management for good.  Once power management is disabled, you can remove the mouse and your display will stay alive on subsequent boots.

If you know a way to use the command line to disable Gnome monitor power management or force a particular display resolution, let me know in the comments.

6 comments:

  1. You read my mind, neglected to order the serial cable, and can't see anything on my hdmi display out. This should do the trick.

    Thanks

    Pete

    ReplyDelete
  2. Hi Charles,

    however I still got a blank screen on the HDMI port ... but I was able to log into a root shell using a blank passwd.

    My beaglebone (Rev: A5C) does a dhcp request and receives an IP address from my router while booting. With knowing the IP address and any ssh client (windows: PuTTY) you can log in as root (press enter on password request). ;-)

    Back to the problem:

    cat /proc/cmdline
    console=ttyO0,115200n8 video=HDMI-A-1:640x480@60 root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait

    looks like this - no screen on HDMI.

    Anyway, these were my first 20 minutes touching the beaglebone, I'll keep on going.

    best & thx for posting

    ReplyDelete
  3. add consoleblank=0 to uEnv.txt

    $ vi /media/BEAGLEBONE/uEnv.txt
    optargs=quiet drm.debug=7 consoleblank=0

    ReplyDelete
  4. Hi!

    I edited as video=HDMI-A-1:720x480@60 and video=HDMI-A-1:1280x1024@75 but the screen is black. I have only one monitor, it is difficult to switch every time. I have no way to use PuTTY.

    ReplyDelete
  5. UPDATE: You may find the modedb documentation helpful, in particular note you can add an 'M' to the settings below to force a non-standard ... bildschirmhdmi.blogspot.de

    ReplyDelete
  6. Mine needed an additional M to work, so:

    optargs=video=HDMI-A-1:640x480M@60

    ReplyDelete