{"id":214,"date":"2013-03-10T22:05:38","date_gmt":"2013-03-11T02:05:38","guid":{"rendered":"http:\/\/www.the-greathouses.net\/blog\/?p=214"},"modified":"2014-04-11T07:36:00","modified_gmt":"2014-04-11T11:36:00","slug":"setting-pcduino-display-resolution","status":"publish","type":"post","link":"https:\/\/www.the-greathouses.net\/blog\/2013\/03\/setting-pcduino-display-resolution\/","title":{"rendered":"Setting pcDuino Display Resolution"},"content":{"rendered":"<p>One of the things I had noted earlier was that the HDMI output resolution is fixed at 720p (1280&#215;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&#215;1080).<!--more--><\/p>\n<h6>Background<\/h6>\n<p>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 <strong>evb.bin<\/strong> configuration file. This is a binary configuration file compiled from a <strong>fex<\/strong> text file. Learn more about the <strong>fex<\/strong> file format at <a title=\"Sunxi Wiki\" href=\"http:\/\/linux-sunxi.org\/\" target=\"_blank\">Sunxi Wiki<\/a> in the <a title=\"Fex Guide\" href=\"http:\/\/linux-sunxi.org\/Fex_Guide#12.1_.5Bdisp_init.5D\" target=\"_blank\">Fex Guide<\/a>. To change values in the <strong>\/boot\/evb.bin<\/strong> 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 &#8212; <a title=\"Sunxi Tools\" href=\"https:\/\/github.com\/linux-sunxi\/sunxi-tools\" target=\"_blank\">sunxi-tools<\/a>.<\/p>\n<h6>Preparation<\/h6>\n<p>To install sunxi-tools, there some additional packages that must be installed on the pcDuino first. To fetch the sources, you need <strong>git<\/strong>. To compile sunxi-tools, you also need to have <strong>libusb<\/strong> and <strong>pkg-config<\/strong>. The following commands will need to be done from a terminal window.<\/p>\n<pre title=\"Preparation\">sudo apt-get update\r\nsudo apt-get install git\r\nsudo apt-get install libusb-1.0.0-dev\r\nsudo apt-get install pkg-config<\/pre>\n<p>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.<\/p>\n<pre title=\"sunxi-tools build\">git clone https:\/\/github.com\/linux-sunxi\/sunxi-tools\r\ncd sunxi-tools\r\nmake<\/pre>\n<p>This will fetch the source files and build the binary programs needed to update the <strong>evb.bin<\/strong> configuration file.<\/p>\n<h6>Accessing evb.bin<\/h6>\n<p>The <strong>evb.bin<\/strong> 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.<\/p>\n<pre title=\"Mount \/boot\">sudo mount \/dev\/nanda \/boot<\/pre>\n<p>If you look at the directory of \/boot, you will now see several files.<\/p>\n<pre title=\"Directory of \/boot\">ls \/boot\r\nboot.axf  drv_de.drv  font24.sft  linux      script.bin   sprite      uImage\r\nboot.ini  evb.bin     font32.sft  magic.bin  script0.bin  sprite.axf<\/pre>\n<h6>Editing Display Resolution<\/h6>\n<p>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 <strong>evb.bin<\/strong> file to <strong>evb.fex<\/strong>.<\/p>\n<pre title=\"decompile evb.bin\">sudo cp \/boot\/evb.bin \/boot\/evb_orig.bin\r\n.\/bin2fex \/boot\/evb.bin &gt;evb.fex<\/pre>\n<p>Open the new <strong>evb.fex<\/strong> file and locate the <em>disp_init<\/em> section. It will look like this:<\/p>\n<pre class=\"lang:default mark:5 decode:true\" title=\"evb.fex disp_init section\">[disp_init]\r\ndisp_init_enable = 1\r\ndisp_mode = 0\r\nscreen0_output_type = 3\r\nscreen0_output_mode = 5\r\nscreen1_output_type = 3\r\nscreen1_output_mode = 9\r\nfb0_framebuffer_num = 2\r\nfb0_format = 10\r\nfb0_pixel_sequence = 0\r\nfb0_scaler_mode_enable = 1\r\nfb1_framebuffer_num = 2\r\nfb1_format = 10\r\nfb1_pixel_sequence = 0\r\nfb1_scaler_mode_enable = 0<\/pre>\n<p>To change the default HDMI resolution, the line of interest is the <em>screen0_output_mode<\/em> line. The value to the right of the equal sign is the resolution selection. The available resolutions as listed on the Sunxi site are:<\/p>\n<table>\n<tbody>\n<tr>\n<td><strong>HDMI Mode<\/strong><\/td>\n<td><strong>Resolution<\/strong><\/td>\n<\/tr>\n<tr>\n<td>0<\/td>\n<td>480i<\/td>\n<\/tr>\n<tr>\n<td>1<\/td>\n<td>576i<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>480p<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>576p<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>720p50<\/td>\n<\/tr>\n<tr>\n<td>5<\/td>\n<td>720p60 (default)<\/td>\n<\/tr>\n<tr>\n<td>6<\/td>\n<td>1080i50<\/td>\n<\/tr>\n<tr>\n<td>7<\/td>\n<td>1080i60<\/td>\n<\/tr>\n<tr>\n<td>8<\/td>\n<td>1080p24<\/td>\n<\/tr>\n<tr>\n<td>9<\/td>\n<td>1080p50<\/td>\n<\/tr>\n<tr>\n<td>10<\/td>\n<td>1080p60<\/td>\n<\/tr>\n<tr>\n<td>11<\/td>\n<td>PAL<\/td>\n<\/tr>\n<tr>\n<td>12<\/td>\n<td>PAL_SVIDEO<\/td>\n<\/tr>\n<tr>\n<td>14<\/td>\n<td>NTSC<\/td>\n<\/tr>\n<tr>\n<td>15<\/td>\n<td>NTSC_SVIDEO<\/td>\n<\/tr>\n<tr>\n<td>17<\/td>\n<td>PAL_M<\/td>\n<\/tr>\n<tr>\n<td>18<\/td>\n<td>PAL_M_SVIDEO<\/td>\n<\/tr>\n<tr>\n<td>19<\/td>\n<td>PAL_NC<\/td>\n<\/tr>\n<tr>\n<td>21<\/td>\n<td>PAL_NC_SVIDEO<\/td>\n<\/tr>\n<tr>\n<td>23<\/td>\n<td>1080p24-3D<\/td>\n<\/tr>\n<tr>\n<td>24<\/td>\n<td>720p50-3D<\/td>\n<\/tr>\n<tr>\n<td>25<\/td>\n<td>720p60-3D<\/td>\n<\/tr>\n<tr>\n<td>26<\/td>\n<td>1360&#215;768-60<\/td>\n<\/tr>\n<tr>\n<td>27<\/td>\n<td>1280&#215;1024-60<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Change the <em>screen0_output_mode<\/em> to your desired resolution selection and save the file. As an example, for 1080p60:<\/p>\n<pre class=\"lang:default mark:5 decode:true\" title=\"evb.fex disp_init section\">[disp_init]\r\ndisp_init_enable = 1\r\ndisp_mode = 0\r\nscreen0_output_type = 3\r\nscreen0_output_mode = 10\r\nscreen1_output_type = 3\r\nscreen1_output_mode = 9\r\nfb0_framebuffer_num = 2\r\nfb0_format = 10\r\nfb0_pixel_sequence = 0\r\nfb0_scaler_mode_enable = 1\r\nfb1_framebuffer_num = 2\r\nfb1_format = 10\r\nfb1_pixel_sequence = 0\r\nfb1_scaler_mode_enable = 0<\/pre>\n<h6>Activate New Display Settings<\/h6>\n<p>To make the new display resolution settings active, the <strong>evb.bin<\/strong> file in the boot partition must be replaced with a compiled version of your new <strong>evb.fex<\/strong> file. This is accomplished with the following commands.<\/p>\n<pre title=\"Activate New Display Settings\">.\/fex2bin evb.fex &gt;evb.bin\r\nsudo cp evb.bin \/boot\/evb.bin\r\nsudo umount \/boot<\/pre>\n<p>This compiles the new text configuration to a binary configuration file, copies the new file to the <em>\/boot<\/em> partition, and unmounts the boot partition.<\/p>\n<h6>Moment of Truth<\/h6>\n<p>Once the configuration file has been updated, it is time to test. Reboot your pcDuino and enjoy the new setting.<\/p>\n<h6><span style=\"color: #ff0000;\">WARNING<\/span><\/h6>\n<p><strong>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.<\/strong><\/p>\n<p><strong>Update 11-Mar-2013:<\/strong> Added additional HDMI modes to table.<br \/>\n<strong>Update 14-Mar-2013:<\/strong> Corrected HTML markup issue.<br \/>\n<strong>Update 5-Apr-2013:<\/strong> Corrected typo in HDMI mode table.<\/p>\n","protected":false},"excerpt":{"rendered":"One of the things I had noted earlier was that the HDMI output resolution is fixed at 720p (1280&#215;720) and &hellip;<a href=\"https:\/\/www.the-greathouses.net\/blog\/2013\/03\/setting-pcduino-display-resolution\/\">Continue reading &rarr;<\/a>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20,35],"tags":[38,27,26],"class_list":["post-214","post","type-post","status-publish","format-standard","hentry","category-computers","category-pcduino","tag-cooking-3","tag-fex","tag-hdmi"],"_links":{"self":[{"href":"https:\/\/www.the-greathouses.net\/blog\/wp-json\/wp\/v2\/posts\/214","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.the-greathouses.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.the-greathouses.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.the-greathouses.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.the-greathouses.net\/blog\/wp-json\/wp\/v2\/comments?post=214"}],"version-history":[{"count":30,"href":"https:\/\/www.the-greathouses.net\/blog\/wp-json\/wp\/v2\/posts\/214\/revisions"}],"predecessor-version":[{"id":394,"href":"https:\/\/www.the-greathouses.net\/blog\/wp-json\/wp\/v2\/posts\/214\/revisions\/394"}],"wp:attachment":[{"href":"https:\/\/www.the-greathouses.net\/blog\/wp-json\/wp\/v2\/media?parent=214"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.the-greathouses.net\/blog\/wp-json\/wp\/v2\/categories?post=214"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.the-greathouses.net\/blog\/wp-json\/wp\/v2\/tags?post=214"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}