{"id":4628,"date":"2022-11-26T16:20:13","date_gmt":"2022-11-26T22:20:13","guid":{"rendered":"https:\/\/dev.iachieved.it\/iachievedit\/?p=4628"},"modified":"2022-11-26T16:23:18","modified_gmt":"2022-11-26T22:23:18","slug":"using-a-hyperpixel-4-0-tft-display-on-a-pi-3","status":"publish","type":"post","link":"https:\/\/dev.iachieved.it\/iachievedit\/using-a-hyperpixel-4-0-tft-display-on-a-pi-3\/","title":{"rendered":"Using a HyperPixel 4.0 TFT Display on a Pi 3"},"content":{"rendered":"<p>You may have noticed that Raspberry Pi 4s are a bit <a href=\"https:\/\/www.jeffgeerling.com\/blog\/2022\/you-cant-buy-raspberry-pi-right-now\">hard to come by<\/a> these days.  The all-knowing Google even predicts you&#8217;re searching for an alternative to a Pi 4!<\/p>\n<p><a href=\"https:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2022\/11\/Screenshot-2022-11-26-at-10.27.33-AM.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2022\/11\/Screenshot-2022-11-26-at-10.27.33-AM.png\" alt=\"\" width=\"598\" height=\"273\" class=\"aligncenter size-full wp-image-4630\" srcset=\"https:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2022\/11\/Screenshot-2022-11-26-at-10.27.33-AM.png 598w, https:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2022\/11\/Screenshot-2022-11-26-at-10.27.33-AM-300x137.png 300w\" sizes=\"(max-width: 598px) 100vw, 598px\" \/><\/a><\/p>\n<p>Well, if you&#8217;re like me, you probably have some Pi 3s lying around and wonder if they&#8217;re still up to the task.  They are, even if you have to coax some hardware or software that has since moved on.  This includes the <a href=\"https:\/\/github.com\/pimoroni\/hyperpixel4\">HyperPixel 4.0<\/a> that took a little work.  In particular, we&#8217;ll be looking at the <a href=\"https:\/\/shop.pimoroni.com\/products\/hyperpixel-4-square?variant=30138251444307\">720&#215;720 pixel 4.0 Inch Square<\/a> which I&#8217;m using for a <a href=\"https:\/\/github.com\/iachievedit\/weatherfxlite\">weather display<\/a>.<\/p>\n<p><b>Disclaimer!<\/b>  These instructions are for using the HyperPixel 4.0 with a Raspberry 3 and shouldn&#8217;t be used with a Pi 4!  Head over to <a href\"https:\/\/github.com\/pimoroni\/hyperpixel4\">GitHub<\/a> if you have a Pi 4.<\/p>\n<p>Start off with a fresh Raspberry Pi image. I&#8217;m on a Mac and will use <a href=\"https:\/\/www.raspberrypi.com\/software\/\">Raspberry Pi Imager<\/a>. You can choose either the 32 or 64-bit image.  After flashing your image and setting up the Pi, log in and download the Hyperpixel 4.0 firmware for the Pi 3. Note the branch!<br \/>\n[code lang=&#8221;text&#8221;]<br \/>\ngit clone https:\/\/github.com\/pimoroni\/hyperpixel4 -b pi3<br \/>\n [\/code]<\/p>\n<p>After cloning the repository go into it and run <code>sudo .\/install.sh<\/code>.<\/p>\n<pre>    \njoe@raspberrypi:~ $ cd hyperpixel4\/\njoe@raspberrypi:~\/hyperpixel4 $ sudo .\/install.sh    \nNotice: building hyperpixel4.dtbo    \nCreated symlink \/etc\/systemd\/system\/multi-user.target.wants\/hyperpixel4-init.service -> \/etc\/systemd\/system\/hyperpixel4-init.service.    \nInstalled: \/usr\/bin\/hyperpixel4-init     \nInstalled: \/etc\/systemd\/system\/hyperpixel4-init.service  \nInstalled: \/usr\/bin\/hyperpixel4-rotate   \nInstalled: \/boot\/overlays\/hyperpixel4.dtbo   \nConfig: Added dtoverlay=hyperpixel4 to \/boot\/config.txt\nConfig: Added overscan_left=0 to \/boot\/config.txt\nConfig: Added overscan_right=0 to \/boot\/config.txt\nConfig: Added overscan_top=0 to \/boot\/config.txt\nConfig: Added overscan_bottom=0 to \/boot\/config.txt\nConfig: Added enable_dpi_lcd=1 to \/boot\/config.txt\nConfig: Added display_default_lcd=1 to \/boot\/config.txt\nConfig: Added display_rotate=0 to \/boot\/config.txt\nConfig: Added dpi_group=2 to \/boot\/config.txt\nConfig: Added dpi_mode=87 to \/boot\/config.txt\nConfig: Added dpi_output_format=0x7f216 to \/boot\/config.txt\nConfig: Added hdmi_timings=480 0 10 16 59 800 0 15 113 15 0 0 0 60 0 32000000 6 to \/boot\/config.txt\n\nBefore rebooting, use 'hyperpixel4-rotate left\/right\/normal\/inverted' to rotate your display!\n\n  left - Landscape, power\/HDMI on bottom\n  right - Landscape, power\/HDMI on top\n  normal - Portrait, USB ports on top\n  inverted - Portrait, USB ports on bottom\n<\/pre>\n<p>Ignore the <code>hyperpixel4-rotate<\/code> command for now.  Here&#8217;s where the tweaks begin.  Edit <code>\/boot\/config.txt<\/code> and comment out the following line:<\/p>\n<p>[code lang=text]<br \/>\ndtoverlay=vc4-kms-v3d<br \/>\n[\/code]<\/p>\n<p>That is you should have something like:<\/p>\n<p>[code lang=text]<br \/>\n# Enable DRM VC4 V3D driver<br \/>\n#dtoverlay=vc4-kms-v3d<br \/>\nmax_framebuffers=2<br \/>\n[\/code]<\/p>\n<p>Then go down to the section that looks like this:<\/p>\n<p>[code lang=text]<br \/>\ndtoverlay=hyperpixel4<br \/>\noverscan_left=0<br \/>\noverscan_right=0<br \/>\noverscan_top=0<br \/>\noverscan_bottom=0<br \/>\nenable_dpi_lcd=1<br \/>\ndisplay_default_lcd=1<br \/>\ndisplay_rotate=0<br \/>\ndpi_group=2<br \/>\ndpi_mode=87<br \/>\ndpi_output_format=0x7f216<br \/>\nhdmi_timings=480 0 10 16 59 800 0 15 113 15 0 0 0 60 0 32000000 6<br \/>\n[\/code]<\/p>\n<p>Change <code>dpi_output_format<\/code> to <code>0x5f026<\/code>.  Then, comment out the <code>hdmi_timings<\/code> line and add:<\/p>\n<p>[code lang=text]<br \/>\ndpi_timings=720 0 20 20 40 720 0 15 15 15 0 0 0 60 0 36720000 4<br \/>\n[\/code]<\/p>\n<p>Your configuration section for the Hyperpixel should look like:<\/p>\n<p>[code lang=text]<br \/>\n[all]<br \/>\ndtoverlay=hyperpixel4<br \/>\noverscan_left=0<br \/>\noverscan_right=0<br \/>\noverscan_top=0<br \/>\noverscan_bottom=0<br \/>\nenable_dpi_lcd=1<br \/>\ndisplay_default_lcd=1<br \/>\ndisplay_rotate=0<br \/>\ndpi_group=2<br \/>\ndpi_mode=87<br \/>\ndpi_output_format=0x5f026<br \/>\n#hdmi_timings=480 0 10 16 59 800 0 15 113 15 0 0 0 60 0 32000000 6<br \/>\ndpi_timings=720 0 20 20 40 720 0 15 15 15 0 0 0 60 0 36720000 4<br \/>\n[\/code]<\/p>\n<h2>Rotating the Display<\/h2>\n<p>In its original configuration, the Hyperpixel 4.0 is &#8220;upside down&#8221; for my purposes.<\/p>\n<p><a href=\"https:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2022\/11\/Screenshot-2022-11-26-at-3.18.55-PM.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2022\/11\/Screenshot-2022-11-26-at-3.18.55-PM.png\" alt=\"\" width=\"619\" height=\"533\" class=\"aligncenter size-full wp-image-4641\" srcset=\"https:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2022\/11\/Screenshot-2022-11-26-at-3.18.55-PM.png 619w, https:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2022\/11\/Screenshot-2022-11-26-at-3.18.55-PM-300x258.png 300w\" sizes=\"(max-width: 619px) 100vw, 619px\" \/><\/a><\/p>\n<p>We can fix this with the <code>display_rotate<\/code> parameter.<\/p>\n<ul>\n<li>`normal` &#8211; `display_rotate=0`\n<li>`right` &#8211; `display_rotate=1`\n<li>`inverted` &#8211; `display_rotate=2`\n<li>`left` &#8211; `display_rotate=3`\n<\/ul>\n<p>In my case I set <code>display_rotate=2<\/code>.<\/p>\n<p>After a reboot we&#8217;re in business!<\/p>\n<p><a href=\"https:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2022\/11\/Screenshot-2022-11-26-at-3.48.19-PM-e1669499438757.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2022\/11\/Screenshot-2022-11-26-at-3.48.19-PM-e1669499438757.png\" alt=\"\" width=\"613\" height=\"563\" class=\"aligncenter size-full wp-image-4644\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>You may have noticed that Raspberry Pi 4s are a bit hard to come by these days. The all-knowing Google even predicts you&#8217;re searching for an alternative to a Pi 4! Well, if you&#8217;re like me, you probably have some Pi 3s lying around and wonder if they&#8217;re still up to the task. They are, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3747,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22,13],"tags":[],"class_list":["post-4628","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hacking","category-raspberry-pi"],"_links":{"self":[{"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/posts\/4628"}],"collection":[{"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/comments?post=4628"}],"version-history":[{"count":18,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/posts\/4628\/revisions"}],"predecessor-version":[{"id":4946,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/posts\/4628\/revisions\/4946"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/media\/3747"}],"wp:attachment":[{"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/media?parent=4628"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/categories?post=4628"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/tags?post=4628"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}