{"id":2982,"date":"2020-07-24T22:19:26","date_gmt":"2020-07-24T14:19:26","guid":{"rendered":"https:\/\/tzlee.com\/blog\/?p=2982"},"modified":"2020-07-29T02:39:26","modified_gmt":"2020-07-28T18:39:26","slug":"raspberry-pi-3-5-display-x11-configuration","status":"publish","type":"post","link":"https:\/\/tzlee.com\/blog\/2020\/07\/raspberry-pi-3-5-display-x11-configuration\/","title":{"rendered":"Raspberry Pi 3.5&#8243; Display X11 Configuration"},"content":{"rendered":"\n<p>I got a really cute <a href=\"https:\/\/sg.cytron.io\/p-3.5-inch-tft-touch-screen-for-rpi-3b-3b-plus-4b\" target=\"_blank\" rel=\"noreferrer noopener\">3.5&#8243; TFT display for my RPi from Cytron<\/a> which has an ADS7846 touchscreen controller.<\/p>\n\n\n\n<p>After installing the drivers (by following the instructions <a rel=\"noreferrer noopener\" href=\"http:\/\/www.lcdwiki.com\/3.5inch_RPi_Display\" target=\"_blank\">here<\/a>), I realised that the X\/Y axes of the touchscreen were flipped.<\/p>\n\n\n\n<p>It took me a while to figure this out, so I&#8217;m writing a blog entry as a documentation.<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>SSH has been disabled by default on a fresh RPi OS installation. To use the RPi in headless mode with SSH enabled, create an empty file in <code>\/boot\/ssh<\/code>. This can be done via another computer, e.g. on my Mac:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>touch \/Volumes\/boot\/ssh<\/code><\/pre>\n\n\n\n<p>After the RPi boots, connect it to a LAN cable, SSH to it (find its IP address via DHCP server leases table) and then run <code>raspi-config<\/code> to do some initial configuration.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>raspi-config<\/code><\/pre>\n\n\n\n<p>Now install the LCD drivers.<\/p>\n\n\n\n<p>To rotate the display so that the HDMI ports are on top. Edit  <code>\/boot\/config.txt<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dtoverlay=tft35a:rotate=270<\/code><\/pre>\n\n\n\n<p>Next, the touchscreen input will also have to be rotated accordingly. Edit <code>\/etc\/X11\/xorg.conf.d\/99-calibration.conf<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Section \"InputClass\"\n  Identifier \"calibration\"\n  MatchProduct \"ADS7846 Touchscreen\"\n  Driver \"evdev\" # Force the evdev driver\n  Option \"Calibration\" \"3936 227 268 3880\" # Default values\n  Option \"SwapAxes\" \"1\" # Required for landscape orientation \n  Option \"InvertX\" \"true\" # Required for rotate=270\n  Option \"InvertY\" \"true\" # Required for rotate=270\nEndSection<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I got a really cute 3.5&#8243; TFT display for my RPi from Cytron which has an ADS7846 touchscreen controller. After installing the drivers (by following the instructions here), I realised that the X\/Y axes of the touchscreen were flipped. It&#8230; <a class=\"more-link\" href=\"https:\/\/tzlee.com\/blog\/2020\/07\/raspberry-pi-3-5-display-x11-configuration\/\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":2,"featured_media":2983,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[8],"tags":[590,589,561,560],"class_list":["post-2982","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tech","tag-ads7846","tag-cytron","tag-raspberry-pi","tag-rpi"],"jetpack_featured_media_url":"https:\/\/tzlee.com\/blog\/wp-content\/uploads\/2020\/07\/IMG_3114.jpeg","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/tzlee.com\/blog\/wp-json\/wp\/v2\/posts\/2982","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tzlee.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tzlee.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tzlee.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/tzlee.com\/blog\/wp-json\/wp\/v2\/comments?post=2982"}],"version-history":[{"count":4,"href":"https:\/\/tzlee.com\/blog\/wp-json\/wp\/v2\/posts\/2982\/revisions"}],"predecessor-version":[{"id":3017,"href":"https:\/\/tzlee.com\/blog\/wp-json\/wp\/v2\/posts\/2982\/revisions\/3017"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tzlee.com\/blog\/wp-json\/wp\/v2\/media\/2983"}],"wp:attachment":[{"href":"https:\/\/tzlee.com\/blog\/wp-json\/wp\/v2\/media?parent=2982"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tzlee.com\/blog\/wp-json\/wp\/v2\/categories?post=2982"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tzlee.com\/blog\/wp-json\/wp\/v2\/tags?post=2982"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}