{"id":384,"date":"2016-06-23T18:31:01","date_gmt":"2016-06-23T22:31:01","guid":{"rendered":"http:\/\/alpharesearch.de\/?p=384"},"modified":"2016-06-23T22:30:13","modified_gmt":"2016-06-24T02:30:13","slug":"pishow-2-8-device-tree-example","status":"publish","type":"post","link":"https:\/\/alpharesearch.de\/?p=384","title":{"rendered":"Seeed \/ 52Pi PiShow 2.8 device tree overlay"},"content":{"rendered":"<p>This post is about the\u00a0<a href=\"https:\/\/www.seeedstudio.com\/item_detail.html?p_id=2516\">PiShow 2.8&#8243; Resistive Touch Display<\/a> from Seeedstudio. I found this little 65K colors and 320&#215;240 pixel touch display for $20 at one of there sales.<\/p>\n<p>The documentation on there web page is not easy to understand and everything you need is already part of the standard operating system image.<\/p>\n<p>I used some existing device tree overlay and merged them and changed the pins and adopted the settings from the seeed documentation.<\/p>\n<p>The scree is showing the picture, the touch is working with my finger and the four buttons on the side are working too. I would call this a success.<\/p>\n<p>Thanks to\u00a0<a class=\"user-mention\" href=\"https:\/\/github.com\/notro\">@notro<\/a>\u00a0for his guidance to make this example and his work in this area in general.<\/p>\n<pre><code>\/*\r\n * Device Tree overlay for pishow 2.8\r\n *\r\n *\/\r\n\r\n\/dts-v1\/;\r\n\/plugin\/;\r\n\r\n\/ {\r\n    compatible = \"brcm,bcm2835\", \"brcm,bcm2708\", \"brcm,bcm2709\";\r\n\r\n    fragment@0 {\r\n    target = &lt;&amp;spi0&gt;;\r\n    __overlay__ {\r\n        status = \"okay\";\r\n\r\n        spidev@0{\r\n        status = \"disabled\";\r\n        };\r\n\r\n        spidev@1{\r\n        status = \"disabled\";\r\n        };\r\n    };\r\n    };\r\n\r\n    fragment@1 {\r\n    target = &lt;&amp;gpio&gt;;\r\n    __overlay__ {\r\n        pishow_display_pins: pishow_display_pins {\r\n        brcm,pins = &lt;18 23 24 25&gt;;\r\n        brcm,function = &lt;1 1 1 0&gt;; \/* out out out in *\/\r\n        brcm,pull = &lt;0&gt;; \/* none *\/\r\n        };\r\n            pishow_ts_pins: pishow_ts_pins {\r\n        brcm,pins = &lt;22&gt;;\r\n        brcm,function = &lt;0&gt;; \/* in *\/\r\n        };\r\n        keypad_pins: keypad_pins {\r\n        brcm,pins = &lt;16 20 21 26&gt;;\r\n        brcm,function = &lt;0&gt;; \/* in *\/\r\n        brcm,pull = &lt;1&gt;; \/* down *\/\r\n        };\r\n    };\r\n    };\r\n\r\n    fragment@2 {\r\n    target = &lt;&amp;spi0&gt;;\r\n    __overlay__ {\r\n        \/* needed to avoid dtc warning *\/\r\n        #address-cells = &lt;1&gt;;\r\n        #size-cells = &lt;0&gt;;\r\n\r\n        pishow28: pishow28@0{\r\n        compatible = \"ilitek,ili9341\";\r\n        reg = &lt;0&gt;;\r\n        pinctrl-names = \"default\";\r\n        pinctrl-0 = &lt;&amp;pishow_display_pins&gt;,\r\n                &lt;&amp;pishow_ts_pins&gt;;\r\n\r\n        spi-max-frequency = &lt;32000000&gt;;\r\n        rotate = &lt;270&gt;;\r\n        bgr;\r\n        fps = &lt;30&gt;;\r\n        buswidth = &lt;8&gt;;\r\n        reset-gpios = &lt;&amp;gpio 23 0&gt;;\r\n        dc-gpios = &lt;&amp;gpio 24 0&gt;;\r\n        led-gpios = &lt;&amp;gpio 18 1&gt;;\r\n        debug = &lt;0&gt;;\r\n        };\r\n\r\n        pishow28_ts: pishow28_ts@1 {\r\n        compatible = \"ti,ads7846\";\r\n        reg = &lt;1&gt;;\r\n\r\n        spi-max-frequency = &lt;2000000&gt;;\r\n        interrupts = &lt;22 2&gt;; \/* high-to-low edge triggered *\/\r\n        interrupt-parent = &lt;&amp;gpio&gt;;\r\n        ti,keep-vref-on = &lt;1&gt;;\r\n        pendown-gpio = &lt;&amp;gpio 22 0&gt;;\r\n        \/* driver defaults *\/\r\n        ti,x-min = \/bits\/ 16 &lt;230&gt;;\r\n        ti,y-min = \/bits\/ 16 &lt;200&gt;;\r\n        ti,x-max = \/bits\/ 16 &lt;3900&gt;;\r\n        ti,y-max = \/bits\/ 16 &lt;3700&gt;;\r\n        ti,pressure-min = \/bits\/ 16 &lt;0&gt;;\r\n        ti,pressure-max = \/bits\/ 16 &lt;0xFFFF&gt;;\r\n        ti,x-plate-ohms = \/bits\/ 16 &lt;80&gt;;\r\n        ti,swap-xy = &lt;1&gt;;\r\n        };\r\n    };\r\n    };\r\n    fragment@3 {\r\n    target-path = \"\/soc\";\r\n    __overlay__ {\r\n        keypad: keypad {\r\n        compatible = \"gpio-keys\";\r\n        #address-cells = &lt;1&gt;;\r\n        #size-cells = &lt;0&gt;;\r\n        pinctrl-names = \"default\";\r\n        pinctrl-0 = &lt;&amp;keypad_pins&gt;;\r\n        #status = \"disabled\";\r\n        autorepeat;\r\n        button@16 {\r\n            label = \"GPIO KEY_UP\";\r\n            linux,code = &lt;103&gt;;\r\n            gpios = &lt;&amp;gpio 16 0&gt;;\r\n        };\r\n        button@26 {\r\n            label = \"GPIO KEY_DOWN\";\r\n            linux,code = &lt;108&gt;;\r\n            gpios = &lt;&amp;gpio 26 0&gt;;\r\n        };\r\n        button@20 {\r\n            label = \"GPIO KEY_LEFT\";\r\n            linux,code = &lt;105&gt;;\r\n            gpios = &lt;&amp;gpio 20 0&gt;;\r\n        };\r\n        button@21 {\r\n            label = \"GPIO KEY_RIGHT\";\r\n            linux,code = &lt;106&gt;;\r\n            gpios = &lt;&amp;gpio 21 0&gt;;\r\n        };\r\n        };\r\n    };\r\n    };\r\n    __overrides__ {\r\n    speed =   &lt;&amp;pishow28&gt;,\"spi-max-frequency:0\";\r\n    rotate =  &lt;&amp;pishow28&gt;,\"rotate:0\";\r\n    fps =     &lt;&amp;pishow28&gt;,\"fps:0\";\r\n    debug =   &lt;&amp;pishow28&gt;,\"debug:0\";\r\n    swapxy =  &lt;&amp;pishow28_ts&gt;,\"ti,swap-xy;0\";\r\n    xmin =    &lt;&amp;pishow28_ts&gt;,\"ti,x-min;0\";\r\n    ymin =    &lt;&amp;pishow28_ts&gt;,\"ti,y-min;0\";\r\n    xmax =    &lt;&amp;pishow28_ts&gt;,\"ti,x-max;0\";\r\n    ymax =    &lt;&amp;pishow28_ts&gt;,\"ti,y-max;0\";\r\n    pmin =    &lt;&amp;pishow28_ts&gt;,\"ti,pressure-min;0\";\r\n    pmax =    &lt;&amp;pishow28_ts&gt;,\"ti,pressure-max;0\";\r\n    xohms =   &lt;&amp;pishow28_ts&gt;,\"ti,x-plate-ohms;0\";\r\n    #keypad =  &lt;&amp;keypad&gt;,\"status\";\r\n    };\r\n};\r\n<\/code><\/pre>\n<p>I used <a href=\"https:\/\/github.com\/RobertCNelson\/tools\/blob\/master\/pkgs\/dtc.sh\">this script<\/a>\u00a0to install the device tree compiler dtc. After the compiler was installed this command creates the dtbo\u00a0file:<\/p>\n<pre><code>sudo dtc -@ -I dts -O dtb -o \/boot\/overlays\/pishow28.dtbo pishow28.dts<\/code><\/pre>\n<p>The last step is to add\u00a0&#8220;dtoverlay=pishow28&#8221; to the end of the\u00a0&#8220;\/boot\/config.txt&#8221; file.<\/p>\n<p>Plus the \/etc\/X11\/xorg.conf.d\/99-ads7846-cal.conf file that swaps the X and Y axis:<\/p>\n<pre><code>Section \"InputClass\"\r\n    Identifier \"Touchscreen\"\r\n    MatchProduct \"ADS7846 Touchscreen\"\r\n    Option \"InvertX\" \"1\"\r\n    Option \"InvertY\" \"1\"\r\n    Option \"SwapAxes\" \"0\"\r\n    Option \"Calibration\" \"215 3800 129 3676\"\r\nEndSection\r\n<\/code><\/pre>\n<p>I also added one\u00a0line in \/etc\/udev\/rules.d\/95-ads7846.rules file:<\/p>\n<pre>SUBSYSTEM==\"input\", KERNEL==\"event[0-9]*\", ATTRS{name}==\"ADS7846*\", SYMLINK+=\"input\/touchscreen\"<\/pre>\n<p>As an extra I\u00a0did install the <a href=\"https:\/\/github.com\/tasanakorn\/rpi-fbcp\">frame buffer copy tool <\/a>to copy the main frame buffer to the new touch display frame buffer.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post is about the\u00a0PiShow 2.8&#8243; Resistive Touch Display from Seeedstudio. I found this little 65K colors and 320&#215;240 pixel touch display for $20 at one of there sales. The documentation on there web page is not easy to understand and everything you need is already part of the standard operating system image. I used &hellip; <a href=\"https:\/\/alpharesearch.de\/?p=384\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Seeed \/ 52Pi PiShow 2.8 device tree overlay<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[1],"tags":[],"class_list":["post-384","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/alpharesearch.de\/index.php?rest_route=\/wp\/v2\/posts\/384","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alpharesearch.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alpharesearch.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alpharesearch.de\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/alpharesearch.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=384"}],"version-history":[{"count":8,"href":"https:\/\/alpharesearch.de\/index.php?rest_route=\/wp\/v2\/posts\/384\/revisions"}],"predecessor-version":[{"id":397,"href":"https:\/\/alpharesearch.de\/index.php?rest_route=\/wp\/v2\/posts\/384\/revisions\/397"}],"wp:attachment":[{"href":"https:\/\/alpharesearch.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=384"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alpharesearch.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=384"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alpharesearch.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=384"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}