February 23, 2025
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).
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.
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.
1 2 3 4 |
sudo apt-get update sudo apt-get install git sudo apt-get install libusb-1.0.0-dev sudo apt-get install pkg-config |
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.
1 2 3 |
git clone https://github.com/linux-sunxi/sunxi-tools cd sunxi-tools make |
This will fetch the source files and build the binary programs needed to update the evb.bin configuration file.
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.
1 |
sudo mount /dev/nanda /boot |
If you look at the directory of /boot, you will now see several files.
1 2 3 |
ls /boot boot.axf drv_de.drv font24.sft linux script.bin sprite uImage boot.ini evb.bin font32.sft magic.bin script0.bin sprite.axf |
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.
1 2 |
sudo cp /boot/evb.bin /boot/evb_orig.bin ./bin2fex /boot/evb.bin >evb.fex |
Open the new evb.fex file and locate the disp_init section. It will look like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
[disp_init] disp_init_enable = 1 disp_mode = 0 screen0_output_type = 3 screen0_output_mode = 5 screen1_output_type = 3 screen1_output_mode = 9 fb0_framebuffer_num = 2 fb0_format = 10 fb0_pixel_sequence = 0 fb0_scaler_mode_enable = 1 fb1_framebuffer_num = 2 fb1_format = 10 fb1_pixel_sequence = 0 fb1_scaler_mode_enable = 0 |
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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
[disp_init] disp_init_enable = 1 disp_mode = 0 screen0_output_type = 3 screen0_output_mode = 10 screen1_output_type = 3 screen1_output_mode = 9 fb0_framebuffer_num = 2 fb0_format = 10 fb0_pixel_sequence = 0 fb0_scaler_mode_enable = 1 fb1_framebuffer_num = 2 fb1_format = 10 fb1_pixel_sequence = 0 fb1_scaler_mode_enable = 0 |
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.
1 2 3 |
./fex2bin evb.fex >evb.bin sudo cp evb.bin /boot/evb.bin sudo umount /boot |
This compiles the new text configuration to a binary configuration file, copies the new file to the /boot partition, and unmounts the boot partition.
Once the configuration file has been updated, it is time to test. Reboot your pcDuino and enjoy the new setting.
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.
Pingback: Getting Started with pcDuino
Pingback: pcDuino安装synergy(添加PART2) | LinkSprite中文Blog