{"id":648,"date":"2019-03-12T18:01:58","date_gmt":"2019-03-12T18:01:58","guid":{"rendered":"http:\/\/chris-stubbs.co.uk\/wp\/?p=648"},"modified":"2019-03-12T18:01:58","modified_gmt":"2019-03-12T18:01:58","slug":"true-3-wire-spi-on-the-esp32-detaching-miso-from-the-pin-matrix","status":"publish","type":"post","link":"https:\/\/chris-stubbs.co.uk\/wp\/?p=648","title":{"rendered":"True 3 wire SPI on the ESP32 (detaching MISO from the pin matrix)"},"content":{"rendered":"\n<p>I screwed up.<\/p>\n\n\n\n<p>On my latest board using an ESP32 I connected an LED to pin 19, but it would never light up.<\/p>\n\n\n\n<p>I wasn&#8217;t using the pin for anything else, and sources online didn&#8217;t seem to indicate any problem with using it as a GPIO output. I was however using the VSPI port to connect to an ePaper display, but it was only physically connected in 3 wire mode. <\/p>\n\n\n\n<p>When the display was initialised, I could no longer control the LED.<\/p>\n\n\n\n<p>Fortunately I had read about a handy feature of the ESP32 known as the GPIO matrix. It allows the physical pins of the chip to be mapped (and importantly unmapped) from an internal signal.<\/p>\n\n\n\n<p>Poking around inside <a href=\"https:\/\/github.com\/ROBOTIS-GIT\/arduino-esp32\/blob\/5af03361775e78fc7a0721ceec198663d2f1db44\/cores\/esp32\/esp32-hal-spi.c#L32\">esp32-hal-spi.c<\/a> the signal name of &#8220;VSPIQ_OUT_IDX &#8221; can be found.<\/p>\n\n\n\n<p>A little further on an example of detatching a signal can be found <a href=\"https:\/\/github.com\/espressif\/arduino-esp32\/blob\/7df50a97d17b0953ea01cad0355410a66bd8b8b4\/cores\/esp32\/esp32-hal-spi.c#L161\">here<\/a>.<\/p>\n\n\n\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\npinMatrixInDetach(signal, false, false);\n<\/pre>\n\n\n\n<p>Meaning all we need to run to detatch the MISO of VSPI is:<\/p>\n\n\n\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\npinMatrixInDetach(VSPIQ_OUT_IDX, false, false);\n<\/pre>\n\n\n\n<p>And it works!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I screwed up. On my latest board using an ESP32 I connected an LED to pin 19, but it would never light up. I wasn&#8217;t using the pin for anything else, and sources online didn&#8217;t seem to indicate any problem &hellip; <a href=\"https:\/\/chris-stubbs.co.uk\/wp\/?p=648\">Continue reading <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_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-648","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/chris-stubbs.co.uk\/wp\/index.php?rest_route=\/wp\/v2\/posts\/648","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chris-stubbs.co.uk\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chris-stubbs.co.uk\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chris-stubbs.co.uk\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/chris-stubbs.co.uk\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=648"}],"version-history":[{"count":2,"href":"https:\/\/chris-stubbs.co.uk\/wp\/index.php?rest_route=\/wp\/v2\/posts\/648\/revisions"}],"predecessor-version":[{"id":650,"href":"https:\/\/chris-stubbs.co.uk\/wp\/index.php?rest_route=\/wp\/v2\/posts\/648\/revisions\/650"}],"wp:attachment":[{"href":"https:\/\/chris-stubbs.co.uk\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=648"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chris-stubbs.co.uk\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=648"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chris-stubbs.co.uk\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=648"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}