{"id":27932,"date":"2020-08-25T14:38:55","date_gmt":"2020-08-25T21:38:55","guid":{"rendered":"https:\/\/blog.digilentinc.com\/?p=27932"},"modified":"2021-06-09T12:48:51","modified_gmt":"2021-06-09T19:48:51","slug":"nes-controller-digital-discovery-waveforms","status":"publish","type":"post","link":"https:\/\/digilent.com\/blog\/nes-controller-digital-discovery-waveforms\/","title":{"rendered":"Reverse Engineering an NES Controller Using the Digital Discovery and WaveForms"},"content":{"rendered":"<p>Some time ago, we had an <a href=\"https:\/\/store.nintendo.com\/nintendo-entertainment-system-controllers.html\">old NES controller<\/a> floating around the office. It wasn&#8217;t your run-of-the-mill NES controller, though &#8211; it had been &#8220;tampered&#8221; with. Instead of the normal console connector piece, we added a <a href=\"http:\/\/www.pmod.org\">Pmod<\/a> connector, so that it could work on one of our <a href=\"https:\/\/digilent.com\/shop\/fpga-development-boards-kits-from-digilent\/\">development boards<\/a>. It stuck around for a while, was forgotten and later surfaced again when we were planning to move our office. Arthur, one of our engineers, saved this controller from its fate as a casualty of workplace transition and decided to put it to use as his own personal project.<\/p>\n<p>There was one problem though: no documentation of the Pmod pin layout for this controller survived. So Arthur was left with a controller that wouldn&#8217;t work with an NES <em>or<\/em> a development board. \u00a0Cool.<\/p>\n<p>However, with the typical innate curiosity of an engineer, he knew there was another way. He got hold of a <a href=\"https:\/\/digilent.com\/shop\/digital-discovery-portable-logic-analyzer-and-digital-pattern-generator\/?utm_source=digilent%20blog&amp;utm_medium=referral&amp;utm_campaign=digital%20discovery&amp;utm_content=nes%20controller\">Digital Discovery<\/a>,\u00a0 plugged in the controller, opened WaveForms, and got to work with the logic analyzer and pattern generator functions to see what kind of data he could get out of it. In the end, he was able to use the Digital Discovery to extract the information needed to correctly map the signals to a development board.<\/p>\n<figure id=\"attachment_27934\" aria-describedby=\"caption-attachment-27934\" style=\"width: 600px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-27934\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2020\/08\/nes2-600x359.png\" alt=\"\" width=\"600\" height=\"359\" data-wp-pid=\"27934\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2020\/08\/nes2-600x359.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2020\/08\/nes2-768x460.png 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2020\/08\/nes2-800x479.png 800w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2020\/08\/nes2.png 902w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><figcaption id=\"caption-attachment-27934\" class=\"wp-caption-text\">Without the pattern generator on. DIO25 high indicates that there is a pullup in the controller, and that its likely a controller output, while the other two pins are inputs.<\/figcaption><\/figure>\n<figure id=\"attachment_27935\" aria-describedby=\"caption-attachment-27935\" style=\"width: 600px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-27935\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2020\/08\/nes3-600x359.png\" alt=\"\" width=\"600\" height=\"359\" data-wp-pid=\"27935\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2020\/08\/nes3-600x359.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2020\/08\/nes3-768x460.png 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2020\/08\/nes3-800x479.png 800w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2020\/08\/nes3.png 902w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><figcaption id=\"caption-attachment-27935\" class=\"wp-caption-text\">Clock and latch reversed (pattern generator DIOs connected to the wrong pins)<\/figcaption><\/figure>\n<figure id=\"attachment_27936\" aria-describedby=\"caption-attachment-27936\" style=\"width: 600px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-27936\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2020\/08\/nes4-600x359.png\" alt=\"\" width=\"600\" height=\"359\" data-wp-pid=\"27936\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2020\/08\/nes4-600x359.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2020\/08\/nes4-768x460.png 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2020\/08\/nes4-800x479.png 800w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2020\/08\/nes4.png 902w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><figcaption id=\"caption-attachment-27936\" class=\"wp-caption-text\">Correct connections with unconnected power. Not visible in this image, but lots of activity on DIO26, along with various glitches in the signal.<\/figcaption><\/figure>\n<figure id=\"attachment_27937\" aria-describedby=\"caption-attachment-27937\" style=\"width: 600px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-27937\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2020\/08\/nes5-600x359.png\" alt=\"\" width=\"600\" height=\"359\" data-wp-pid=\"27937\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2020\/08\/nes5-600x359.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2020\/08\/nes5-768x460.png 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2020\/08\/nes5-800x479.png 800w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2020\/08\/nes5.png 902w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><figcaption id=\"caption-attachment-27937\" class=\"wp-caption-text\">Power is no connected, but with no buttons pressed.<\/figcaption><\/figure>\n<figure id=\"attachment_27938\" aria-describedby=\"caption-attachment-27938\" style=\"width: 600px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-27938\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2020\/08\/nes6-600x359.png\" alt=\"\" width=\"600\" height=\"359\" data-wp-pid=\"27938\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2020\/08\/nes6-600x359.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2020\/08\/nes6-768x460.png 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2020\/08\/nes6-800x479.png 800w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2020\/08\/nes6.png 902w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><figcaption id=\"caption-attachment-27938\" class=\"wp-caption-text\">Power still connected, but this time with START button pressed. Note the change on DIO25.<\/figcaption><\/figure>\n<figure id=\"attachment_27939\" aria-describedby=\"caption-attachment-27939\" style=\"width: 600px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-27939\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2020\/08\/nes7-600x359.png\" alt=\"\" width=\"600\" height=\"359\" data-wp-pid=\"27939\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2020\/08\/nes7-600x359.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2020\/08\/nes7-768x460.png 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2020\/08\/nes7-800x479.png 800w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2020\/08\/nes7.png 902w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><figcaption id=\"caption-attachment-27939\" class=\"wp-caption-text\">Now, with A + B buttons pressed simultaneously. Again, note DIO25.<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<div class='watch-action'><div class='watch-position align-left'><div class='action-like'><a class='lbg-style6 like-27932 jlk' data-task='like' data-post_id='27932' data-nonce='0f678f749c' rel='nofollow'><img src='https:\/\/digilent.com\/blog\/wp-content\/plugins\/wti-like-post-pro\/images\/pixel.gif' title='Like' \/><span class='lc-27932 lc'>0<\/span><\/a><\/div><div class='action-unlike'><a class='unlbg-style6 unlike-27932 jlk' data-task='unlike' data-post_id='27932' data-nonce='0f678f749c' rel='nofollow'><img src='https:\/\/digilent.com\/blog\/wp-content\/plugins\/wti-like-post-pro\/images\/pixel.gif' title='Unlike' \/><span class='unlc-27932 unlc'>0<\/span><\/a><\/div><\/div> <div class='status-27932 status align-left'>Be the 1st to vote.<\/div><\/div><div class='wti-clear'><\/div>","protected":false},"excerpt":{"rendered":"<p>Some time ago, we had an old NES controller floating around the office. It wasn&#8217;t your run-of-the-mill NES controller, though &#8211; it had been &#8220;tampered&#8221; with. Instead of the normal &hellip; <\/p>\n","protected":false},"author":50,"featured_media":27940,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4325,4327,4312],"tags":[452],"ppma_author":[4502],"class_list":["post-27932","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-debug-validation-test","category-projects","category-usb-scopes-analyzers-generators","tag-waveforms"],"jetpack_featured_media_url":"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2020\/08\/nes1-scaled.jpg","jetpack_sharing_enabled":true,"authors":[{"term_id":4502,"user_id":50,"is_guest":0,"slug":"davidh","display_name":"David Horn","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/917c337136844f075c76fcf4a0c3b94aa8c225366009ebf63c08fcb9ce6d0e52?s=96&d=mm&r=g","1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":""}],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/27932","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/users\/50"}],"replies":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/comments?post=27932"}],"version-history":[{"count":0,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/27932\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/media\/27940"}],"wp:attachment":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/media?parent=27932"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/categories?post=27932"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/tags?post=27932"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=27932"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}