Home » Computers, pcDuino » Setting pcDuino Display Resolution
Mar
10

One of the things I had noted earlier was that the HDMI output resolution is fixed at 720p (1280×720) and there was no documented way of setting a new resolution. There was a posting in the comments at Sparkfun that a script for setting the resolution was being worked on. Well, I decided to take a look at it myself and see what was required. It is actually quite simple once you have the right tools. With a little research, I had my display running at 1080p (1920×1080).

Background

The resolution of the frame buffer device and subsequently the X11 display is set at system boot. The default setting for the display is in the evb.bin configuration file. This is a binary configuration file compiled from a fex text file. Learn more about the fex file format at Sunxi Wiki in the Fex Guide. To change values in the /boot/evb.bin it must first be decompiled back to the text format, edited, then recompiled to the binary format. Luckily, there is an open source set of tools for accomplishing just what is needed — sunxi-tools.

Preparation

To install sunxi-tools, there some additional packages that must be installed on the pcDuino first. To fetch the sources, you need git. To compile sunxi-tools, you also need to have libusb and pkg-config. The following commands will need to be done from a terminal window.

Now that the prerequisites have been installed, the sunxi-tools source files can be fetched from github. The following commands will need to be done from a terminal window.

This will fetch the source files and build the binary programs needed to update the evb.bin configuration file.

Accessing evb.bin

The evb.bin file is stored in the NAND flash boot partition. By default, this is not available after the pcDuino boots. The default boot partition is /dev/nanda and can be mounted to /boot using the following command.

If you look at the directory of /boot, you will now see several files.

Editing Display Resolution

We are only interested in the evb.bin file at this time. Use the following commands make a backup of your original file and to extract the content of the evb.bin file to evb.fex.

Open the new evb.fex file and locate the disp_init section. It will look like this:

To change the default HDMI resolution, the line of interest is the screen0_output_mode line. The value to the right of the equal sign is the resolution selection. The available resolutions as listed on the Sunxi site are:

HDMI Mode Resolution
0 480i
1 576i
2 480p
3 576p
4 720p50
5 720p60 (default)
6 1080i50
7 1080i60
8 1080p24
9 1080p50
10 1080p60
11 PAL
12 PAL_SVIDEO
14 NTSC
15 NTSC_SVIDEO
17 PAL_M
18 PAL_M_SVIDEO
19 PAL_NC
21 PAL_NC_SVIDEO
23 1080p24-3D
24 720p50-3D
25 720p60-3D
26 1360×768-60
27 1280×1024-60

Change the screen0_output_mode to your desired resolution selection and save the file. As an example, for 1080p60:

Activate New Display Settings

To make the new display resolution settings active, the evb.bin file in the boot partition must be replaced with a compiled version of your new evb.fex file. This is accomplished with the following commands.

This compiles the new text configuration to a binary configuration file, copies the new file to the /boot partition, and unmounts the boot partition.

Moment of Truth

Once the configuration file has been updated, it is time to test. Reboot your pcDuino and enjoy the new setting.

WARNING

ONLY PERFORM THE ABOVE IF YOU UNDERSTAND WHAT YOU ARE DOING. Editing the evb.bin file has the potential to make your pcDuino unusable. If this occurs, you will need to restore your original evb.bin file from the backup. This can be done from a remote network login (you have set up the ssh server?) or using the debug serial port with the appropriate adapter.

Update 11-Mar-2013: Added additional HDMI modes to table.
Update 14-Mar-2013: Corrected HTML markup issue.
Update 5-Apr-2013: Corrected typo in HDMI mode table.

, ,

41 Responses to “Setting pcDuino Display Resolution”

  1. BB
    March 11th, 2013 at 13:22 | #1

    Thank you for sharing.
    Very well written tutorial.

    Have you had any luck getting Flash Player working on the pcduino?

    Thanks again,
    -Bill

  2. March 11th, 2013 at 13:25 | #2

    Have not tried as I do not normally have a need for Flash based content.

  3. BB
    March 11th, 2013 at 13:34 | #3

    Bill :
    Have not tried as I do not normally have a need for Flash based content.

    I can not seem to get away from flash.
    Thanks for sharing your pcduino development.
    You are leading the charge for sure.
    -Bill

  4. March 13th, 2013 at 01:40 | #4

    These adjustments worked first time.

    This is great. Now I have control over the evb.bin file and all of the parameters!

    Next step is to adjust the “boot” and get the file system larger and faster.

    Thank you!
    Edward M. Goldberg

  5. Jeff
    March 14th, 2013 at 02:03 | #5

    Bill:
    Can you explain this command: ./bin2fex /boot/evb.bin >evb.fex
    I do not understand ‘ >evb.fex ‘ mean.
    And when I run this command ,I have not found the evb.fex file ,but it print the message in the terminal.

  6. March 14th, 2013 at 06:11 | #6

    HTML markup issue I need to correct. That should be:
    ./non2fex /boot/evb.bin >evb.fex

  7. March 14th, 2013 at 06:21 | #7

    Corrected HTML markup issues with “>” then commands this morning. Sorry for any confusion.

  8. Tim
    March 19th, 2013 at 18:02 | #8

    @Jeff
    That ‘>evb.fex’ is just Unix for “send the output to this file”.

    If you run ‘./bin2fex /boot/evb.bin’ without that part, it would just spit the text version of the BIN file to the screen, tacking on the last bit tells it to send it to a file instead of the screen. evb.fex is the filename to send it to.

  9. Bill S.
    April 3rd, 2013 at 14:13 | #9

    This worked somewhat. The display is set to 1920×1080 @ 60Hz but the timing is a little off. The image does not fit the entirety of the LCD panel as far as I can tell, and there’s slight fringing around the edges of the letters (no, not antialiasing ;-) So it looks like it’s not quite displaying 1:1 somehow. I’ll do a little more research.

  10. April 3rd, 2013 at 16:27 | #10

    The final result is dependent on the timings for each of the resolutions as defined in the pcDuino. Of particular impact is the overscan values that are set for the screen.

    The current active setting is in the /etc/screen.conf file. It has a single line with 4 values — percent center x y — where:

    The default values in screen.conf are:

    If screen.conf does not exist, 95 1 0 0 is used. This gives a wide border around the image on my monitor with the image centered.

    If you can see that the display is not filling the screen, you can try modifying the first value. I am not certain if it require integer values or will except float values also. Since the default is “98 1 0 0″, you may want to try “99 1 0 0″ to fill a larger area of the monitor.

    Enjoy!
    Bill

  11. April 4th, 2013 at 17:59 | #11

    @Bill
    I ran some tests and can confirm on my monitor, the default screen.conf values result in the image not filling the display due to some overscan. It is easy to test this dynamically by using the “setwindow” command and observing the impact on the display.

    For my monitor the “100%” setting was best.

    After identifying the best setting for your monitor, just place the values in the /etc/screen.conf file and it will be permanent.

    Enjoy!
    Bill

  12. goalone
    April 5th, 2013 at 04:24 | #12

    Display Resolution “PAL_NC” , HDMI CODE should be 19 not 10.

  13. April 5th, 2013 at 07:28 | #13

    @goalone
    Thank you, it is now corrected.

    Enjoy!
    Bill

  14. April 5th, 2013 at 10:48 | #14

    thanks a lot – worked perfectly!

  15. April 13th, 2013 at 18:04 | #15

    Hi. Thanks a lot for this article. I’ve got a question though: I’m using a VGA monitor through a HDMI to VGA adaptor. The monitor’s native res is 1280*1024, so I tried modifying evb.bin with screen0_output_mode = 27, according to the table you provided.
    It failed, I had to restore the original value. After a bit of googling, I found the FEX guide: http://linux-sunxi.org/Fex_Guide#.5Bdisp_init.5D
    I’d like to know where you got your values greater than 14 from?

    According to this guide, I tried setting up my evb like this:
    screen0_output_type = 4
    screen0_output_mode = 3
    But it failed again :(

  16. April 13th, 2013 at 21:12 | #16

    Simple question first… The mode values are directly from the sunxi video driver source code.

    As to why the 1280×1024 mode did not work for you, my first instinct is that the problem is with the HDMI to VGA adapter. The pcDuino output must match the inputs as supported by the adapter. Some adapters only support 480i, 480p, 720i, 720p, 1080i, and 1080p modes.

    I have seen reports of the same experience with HDMI to VGA apapters on the Raspberry Pi forums, so this is not unique to the pcDuino.

    Enjoy!
    Bill

  17. gnmckinney
    April 25th, 2013 at 11:33 | #17

    Very Nice!

    I just received my PC-Durino board from SparkFun a couple of days ago and just got around to firing it up. I was a little disappointed the loaded OS did not have a method to adjust the screen resolution so I could match it to my Viewsonic 28 monitor. I ran across your posting on changing the configuration settings in the evb.bin file so the system would bootup with the correct settings (I run in 1080p mode on this monitor for most work and my living room Samsung 53″ HDTV also runs in the same mode (grin).

    After changing the default settings to 1080p the display now works mostly with the monitor – the only other thing required was ‘tuning’ the screen.conf file to get the display within the display area (was over-scanning). Instead of the 98 percent setting I had to drop it to 94% to get the display in the display area correctly.

    Now everything ‘display wise’ is working great!

    I followed your instructions to the ‘letter’ and everything worked as advertised! Nice Job!

    Thanks for the instructions!

    now on to bigger and better things with this board :)

    gm

  18. Robert Diamond
    May 6th, 2013 at 22:47 | #18

    just updated to the 0413 system, and there is no evb.bin file in /boot after mounting dev/nanda. I modified script.bin and script0.bin, and added an evb.bin to no avail. Any idea where it went or what they replaced it with?

  19. May 7th, 2013 at 07:27 | #19

    The resolution change affects the frame buffer resolution. For the desktop GUI, you must also set the resolution in the /etc/X11/xorg.conf file to match your new resolution for it to be effective.

    As an example, for 1920×1080 (1080p), set the “Screen” section of /etc/X11/xorg.conf:

    The key is the Modes line. Also, the entered mode must match a modeline entry from the “Monitor” section.

    I really need to get this updated information on my blog, but have been too busy. Maybe tonight.

    Enjoy!
    Bill

  20. Chris
    May 12th, 2013 at 09:42 | #20

    Hello,
    First, thank you for sharing!!

    I have tried to change the resolution using your tutorial, but when I “make”, I have got some warnings and I have’n t been able to find the /boot/evb.bin …

    So I have tried to change some value in xorg.conf file:
    Modes “1920×1080-60″ instead of “1280×720-60″
    I got a blank screen.

    I have reset my xorg.conf like it was first (renaming a backup done before any change) and my hdmi screen is still blank

    Luckily I still can ssh my pcduino

    Who can help me??
    Where can I get help?

    Thank in advance

  21. May 12th, 2013 at 10:31 | #21

    First question: What are the warnings?

    Second part, to see “evb.bin” is within the /boot directory for the first pcDuino OS releases. For subsequent releases, it has been replaced by “script.bin”. To have access to the file, you must properly mount the boot partition to the /boot directory.

    The changes for xorg.conf file are only applicable to the newer OS releases. Note, that I have not tried the newest release for the pcDuino where there has been a first boot configuration option for setting the initial resolution. I would suspect the requirements have changed, and I will need to investigate at some time.

    Restoring the original “evb.bin” (or “script.bin”) and “xorg.conf” should restore a system to the original operation settings. If something else has changed and you are unable to get the pcDuino to operate normally, the best alternative is to simply restore via micro-SD card to a fresh OS install.

    Enjoy!
    Bill

  22. Chris
    May 12th, 2013 at 12:37 | #22

    Thank you very much Bill!!

    I have booted my pcduino from Ubuntu on a external SDcard (http://www.pcduino.com/?p=653) and I got the resolution I wanted on hdmi.

    After having rebooted without the sdcard, I have tried to follow again your tutorial to show you the warning but now I get:

    ubuntu@ubuntu:~$ git clone https://github.com/linux-sunxi/sunxi-tools
    fatal: could not create work tree dir ‘sunxi-tools’.: No space left on device

    ubuntu@ubuntu:~$ df -h
    Filesystem Size Used Avail Use% Mounted on
    /dev/nandd 1.8G 1.7G 0 100% /
    none 406M 4.0K 406M 1% /dev
    none 407M 8.0K 407M 1% /tmp
    none 82M 216K 82M 1% /run

    So, I think I’ll learn how to reinstall ubuntu from the external sdcard
    After that, I’ll come to ask you how to set my display at the high resolution :)

    Thank you one more time!!

  23. May 12th, 2013 at 12:49 | #23

    You do not have enough storage left for the tools according to the message. If you reinstall the new image, you should not need my instructions. There is a first time boot option for setting the resolution.

    Enjoy!
    Bill

  24. Chris
    May 13th, 2013 at 09:06 | #24

    Hello Bill,
    I plan to reinstall ubuntu on my pcduino ; like you probably have seen, I’m new for all thoses things :)

    Is the method discribed here: http://pcduino.com/forum/index.php?topic=3613.msg3690#msg3690 the good way to do it?

    Thank you in advance
    Chris

  25. May 13th, 2013 at 10:07 | #25

    @Chris
    Use the latest download (28-Apr-2013) (raw images or 7zip files) from pcDuino Downloads and follow the Release Note instructions. The forum instructions are for an older release.

    Enjoy!
    Bill

  26. Joseph
    May 28th, 2013 at 16:13 | #26

    I did it today. It worked exactly as you described although the evb.fex file in my pcduino looked very different from yours shown above.

    I managed to find the line with

    screen0_mode=5

    and changed to 10. This was followed by

    screen1_mode=9

    I do not know what is this for and how to get the system go to screen mode1. However, I changed this to number 5.

  27. Joseph
    May 28th, 2013 at 16:15 | #27

    I find it no fun to not have flash player running on pcduino.

  28. abhishek
    June 18th, 2013 at 15:15 | #28

    How can i do the same on android?

    I flashed my pcduino with the latest img provided (3-13-2013). Everything works on it but the resolution is 720p. I need to increase it to 1080p. Any ideas?

  29. June 18th, 2013 at 15:20 | #29

    @abhishek
    With the current releases, it is a two step process. Setting the resolution per my instructions, sets the “framebuffer” resolution. To set the X server resolution, you will need to edit the /etc/X11/xorg.conf file with the correct entry. Hopefully I can get back to my pcDuino and document this soon.

    Enjoy!
    Bill

  30. abhishek
    June 18th, 2013 at 15:44 | #30

    @Bill
    Alright. I think i dont understand. I have done a lot of android development but am very novice with all this Linux stuff. (slowly learning)

    i dont see the /etc/X11/ folder. i have /system/etc/ which has a bunch of config files for audio/3g/camera. But nothing for display

    Are you saying i should return back to the ubunto image it came with. Then follow your steps and then load android? (not sure if loading the android img would negate the steps done on ubuntu).

    any help getting this work on an android device would be appretiated. I even commit to documenting the process if you help me get there (i know developers hate documenting =)

  31. June 18th, 2013 at 16:34 | #31

    @abhishek
    My instructions apply only to Ubuntu. The Android run time configuration is different and I do not have experience with it. Setting up Ubuntu and then switching to Android will not preserve any display settings.

    I know there was discussion on the pcDuino user forums concerning the Android display resolution. Have you checked there for a solution?

    Enjoy!
    Bill

  32. Norda
    August 26th, 2013 at 10:43 | #32

    First of all, thanks for sharing!
    But I have a question here, it seems that this tutorial of changing resolution is all about LUbuntu, but do you know how to do this under Android. Because the highest resolution I can adjust of my PCduino end at 720P, as my monitor is 23” large and support up to 1080P, that’s makes me sick.
    By the way, I can’t see any evb.bin after typing ls /boot, of cause following this tutorial without a single word mistaken.
    Hope you could reply soon.
    Norda

  33. August 26th, 2013 at 10:52 | #33

    Sorry, but I only run Linux at this time. I have no experience with Android on the pcDuino. If I come across information on setting the Android resolution, I will post the link.

    Enjoy!
    Bill

  34. Norda
    August 26th, 2013 at 21:27 | #34

    @Bill
    It seems that the latest version of lubuntu on pcduino have supported users to change display resolution, with a much more easier way.
    I posted my questions on a pcduino BBS, and somebody told me that because we don’t get the Android core which run on pcduino, so we are unable to do this action right now.

    Norda

  35. Trevor
    April 10th, 2014 at 21:18 | #35

    Hi
    I have just purchased a pcDuino V2 and you site was listed as being able to
    change the default screen resolution of 720 which is engorging my screen.
    It would seem I have been able install sunxi-tools as this appears in the ubuntu@ ubuntu directory.
    In the Accessing evb.bin section on entering the
    ” sudo mount /dev/nanda/boot command
    I received a message
    mount: can’t find /dev/nanda/boot in /etc/fstab/ or /etc/mtab.
    I was also unable ls /boot
    Can you please advise me how I can Access evb.bin to complete the operation or give me alternative advice on changing my resolution .
    Regards Trevor

  36. April 10th, 2014 at 21:44 | #36

    Trevor,

    There is a space between “/dev/nanda” and “/boot” when you type the mount command. This will explicitly mount “/dev/nanda” to “/boot”.

    Enjoy!

  37. Trevor
    April 10th, 2014 at 22:29 | #37

    Hi Bill
    Thanks for the reply .
    On incorporating the space I was able to look in the
    /boot directory it was minus the evb.bin
    but had os_show and vendor
    listed.
    The os_show had a series of .bmp files while the vendor had a system directory in which a media directory was listed and on ls /media the addresses of two micro sd cards i had connected.
    Regards Trevor

  38. April 11th, 2014 at 07:40 | #38

    @Trevor
    Trevor,

    I have not looked at the directory layout changes on the current pcDuino. I hope to get a pcDuino V2 and check it out in the near future. If you find anything, let me know.

    You may want to check the /etc/X11/xorg.conf file resolution settings. The last release I use for the pcDuino required adding the resolution settings to the X11 server settings.

    Bill

  39. Trevor
    April 11th, 2014 at 08:05 | #39

    Hi Bill
    Thanks for the suggestion.
    I’ll keep you informed.
    Regards Trevor

Add reply