{"id":25387,"date":"2019-01-02T09:06:10","date_gmt":"2019-01-02T17:06:10","guid":{"rendered":"https:\/\/blog.digilentinc.com\/?p=25387"},"modified":"2021-06-09T13:35:13","modified_gmt":"2021-06-09T20:35:13","slug":"when-a-digital-multimeter-and-analog-scope-are-not-enough-debugging-digital-logic","status":"publish","type":"post","link":"https:\/\/digilent.com\/blog\/when-a-digital-multimeter-and-analog-scope-are-not-enough-debugging-digital-logic\/","title":{"rendered":"When are a Digital Multimeter and Analog Scope Not Enough?"},"content":{"rendered":"<p><span style=\"font-size: 14px;\">Isn&#8217;t it great when you&#8217;re working on a making a tutorial, and in the process the whole reason for making the tutorial becomes very apparent? For instance; trying to set up a project like <\/span><a style=\"font-size: 14px;\" href=\"https:\/\/www.hackster.io\/mmigs\/monitoring-digital-circuits-with-the-digital-discovery-f1952e\">this<\/a><span style=\"font-size: 14px;\">\u00a0(a 7 segment display decoding project) where the whole point is to analyze digital logic signals, and then the setup itself needs debugging.\u00a0<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-25437\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/09\/StudioWiring.jpg\" alt=\"\" width=\"600\" height=\"448\" \/><\/p>\n<p>Rat&#8217;s nest picture from<a href=\"https:\/\/commons.wikimedia.org\/wiki\/File:StudioWiring.jpg\"> here.<\/a><\/p>\n<p>Following setup instructions can be awkward if the project presenter is really comfortable in their headspace and streamlines information that may not have been obvious to the reader. So, when following the setup in the linked project (which did turn out pretty cool), I had to modify code and circuits due to different parts availability (mostly, the project setup called for a common-cathode 7 segment display where I only had access to a common-anode 7 segment display).<\/p>\n<p>My first issue was an error in the supplied code. Nothing crazy, just a little typo from transferring code examples from a book to a compiler or project post, and forgetting to change a variable name. Moving on, code compiles, program device. Then comes the fun problem, nothing displayed on the 7 segment display.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-25409\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/09\/IMG_1099.jpg\" alt=\"\" \/><\/p>\n<p>Now, my first step in troubleshooting is typical: grab a digital multimeter. It&#8217;s usually the first testing instrument we learn to use, it&#8217;s quick, and it&#8217;s easy. Metering the output pins from the FPGA gave an unstable value of around 1V. Okay, so there&#8217;s something happening, but how the hell would I know that it&#8217;s the correct thing happening? I don&#8217;t. Secondly, there&#8217;s more than one active pin and I can&#8217;t meter them all with a DMM. Plus, there&#8217;s still nothing on my display. Checking the base to emitter voltage on the transistors showed about 600mV, so they are presumably &#8220;on&#8221; somehow. So what is happening in between? To narrow my troubleshooting scope (pun intended), I needed to isolate the problem to the code or the analog circuitry.<\/p>\n<p>To verify that I was getting logic signals from my FPGA, I needed a Logic Analyzer so I could see all of the logic step functions in real time. So, I set up my\u00a0<a href=\"https:\/\/digilent.com\/shop\/digital-discovery-portable-usb-logic-analyzer-and-digital-pattern-generator\/\">Digital Discovery,<\/a>\u00a0who&#8217;s high speed inputs allow the ability to correctly sample logic data (which becomes very important with digital signals operating at high clock speeds). Placing the digital scope on all the pins I was using on the FPGA, I verified that all pins on the FPGA were definitely sending signals. This was a great reduction in troubleshooting because I then knew the display problem was with the analog setup, and I could avoid doubting the code I was using (especially since I didn&#8217;t write it and it was supplied to be operational). I don&#8217;t know how many hours I have wasted looking through code for a problem that wasn&#8217;t there!<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-25424\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/09\/IMG_1101-e1536186799809.jpg\" alt=\"\" width=\"3024\" height=\"4032\" \/><\/p>\n<p><span style=\"font-size: 14px;\">The original project design specified little buffer\/driver circuits in series with the chip and the display as a form of power drive protection. The chip is not really built to drive higher power loads, and even though a few LEDs might not be a huge power load, the transistor buffer\/driver was implemented as a &#8220;good habit.&#8221; Fair enough. However, since there was no signal passing through with this approach, I just bypassed that part of the circuit and finally saw a display!<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-25410\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/09\/IMG_1106.jpg\" alt=\"\" width=\"4032\" height=\"3024\" \/><\/p>\n<p>But this is supposed to be a counter, with numbers displayed. Those segment arrangements don&#8217;t look like any numbers I have ever seen. So, I consult the Logic Analyzer again, but this time I&#8217;m not just verifying an output, I need to actually make sense out of the scope display.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-25434\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/09\/2018-09-04-12_57_03-Window.png\" alt=\"\" width=\"1600\" height=\"860\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/09\/2018-09-04-12_57_03-Window.png 1600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/09\/2018-09-04-12_57_03-Window-600x323.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/09\/2018-09-04-12_57_03-Window-768x413.png 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/09\/2018-09-04-12_57_03-Window-1024x550.png 1024w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/09\/2018-09-04-12_57_03-Window-800x430.png 800w\" sizes=\"auto, (max-width: 1600px) 100vw, 1600px\" \/><\/p>\n<p>Analyzing the signal busses and looking at the display, I realized that the logic signals were exactly inverted. Since the project was set up with a common-cathode display and I was using a common-anode display, the on\/off driving of the LED segments were backwards. I was seeing the shapes for the numbers from the counter in the segments that were turned off, and the segments meant to be off were the illuminated segments. Inverting the binary assignments in the code fixed the problem, and the display project was working perfectly!<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-25430\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/09\/IMG_1112.jpg\" alt=\"\" width=\"4032\" height=\"3024\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/09\/IMG_1112.jpg 4032w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/09\/IMG_1112-600x450.jpg 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/09\/IMG_1112-768x576.jpg 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/09\/IMG_1112-1024x768.jpg 1024w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/09\/IMG_1112-800x600.jpg 800w\" sizes=\"auto, (max-width: 4032px) 100vw, 4032px\" \/><\/p>\n<p>Moral of the story: use a scope, and the correct scope at that, when debugging your circuits. I should also look into my application of the buffer circuits. The original project design called for NPN BJT transistors, but to use PNPs if using a common anode display like I was, but apparently couldn&#8217;t figure out at the time. Please comment if you think you know what analog modifications need to happen for the common anode display. Thanks, and happy scoping!<\/p>\n<p><a href=\"https:\/\/www.instructables.com\/id\/Monitoring-Digital-Circuits-With-the-Digital-Disco\/\">Original Project Posting<\/a><\/p>\n<p><a href=\"https:\/\/www.hackster.io\/mmigs\/monitoring-digital-circuits-with-the-digital-discovery-f1952e\">Updated Project Posting<\/a><\/p>\n<div class='watch-action'><div class='watch-position align-left'><div class='action-like'><a class='lbg-style6 like-25387 jlk' data-task='like' data-post_id='25387' data-nonce='5286a1c13f' rel='nofollow'><img src='https:\/\/digilent.com\/blog\/wp-content\/plugins\/wti-like-post-pro\/images\/pixel.gif' title='Like' \/><span class='lc-25387 lc'>0<\/span><\/a><\/div><div class='action-unlike'><a class='unlbg-style6 unlike-25387 jlk' data-task='unlike' data-post_id='25387' data-nonce='5286a1c13f' rel='nofollow'><img src='https:\/\/digilent.com\/blog\/wp-content\/plugins\/wti-like-post-pro\/images\/pixel.gif' title='Unlike' \/><span class='unlc-25387 unlc'>0<\/span><\/a><\/div><\/div> <div class='status-25387 status align-left'>Be the 1st to vote.<\/div><\/div><div class='wti-clear'><\/div>","protected":false},"excerpt":{"rendered":"<p>Ian provides some direction on how to go about debugging digital logic.<\/p>\n","protected":false},"author":49,"featured_media":25410,"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,4312],"tags":[111,1736],"ppma_author":[4459],"class_list":["post-25387","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-debug-validation-test","category-usb-scopes-analyzers-generators","tag-analog-discovery","tag-analog-discovery-2"],"jetpack_featured_media_url":"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/09\/IMG_1106-e1539377790531.jpg","jetpack_sharing_enabled":true,"authors":[{"term_id":4459,"user_id":49,"is_guest":0,"slug":"ian","display_name":"Ian Etheridge","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/04e89e2073e59253a0b117ef28da1c647ca307c1e5f7bf024c1c3e8289c2e026?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\/25387","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\/49"}],"replies":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/comments?post=25387"}],"version-history":[{"count":0,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/25387\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/media\/25410"}],"wp:attachment":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/media?parent=25387"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/categories?post=25387"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/tags?post=25387"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=25387"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}