{"id":15184,"date":"2016-07-20T10:00:06","date_gmt":"2016-07-20T17:00:06","guid":{"rendered":"https:\/\/blog.digilentinc.com\/?p=15184"},"modified":"2021-06-16T14:02:05","modified_gmt":"2021-06-16T21:02:05","slug":"how-to-know-your-signal-polarity","status":"publish","type":"post","link":"https:\/\/digilent.com\/blog\/how-to-know-your-signal-polarity\/","title":{"rendered":"How to Know Your Signal Polarity"},"content":{"rendered":"<p>Recently I was converting some HDL from the <a href=\"https:\/\/digilent.com\/shop\/basys-3-artix-7-fpga-trainer-board-recommended-for-introductory-users\/\">Basys 3<\/a> to the <a href=\"https:\/\/digilent.com\/shop\/arty-board-artix-7-fpga-development-board-for-makers-and-hobbyists\/\">Arty<\/a> and ran into what seemed to be an unsolvable problem. After some testing, I found that the reset button that was used was Active High in the code I was converting. Once I knew this, the rest of the conversion went smoothly.<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-15461\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/basys_arty-1-600x449.png\" alt=\"basys_arty\" width=\"600\" height=\"449\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/basys_arty-1-600x449.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/basys_arty-1-768x574.png 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/basys_arty-1-800x598.png 800w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/basys_arty-1.png 1000w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>To avoid this hassle there are two\u00a0ways to find out the polarity of a button. The first is to look at the\u00a0schematic for the board. The are two configurations that this could have, Active Low and Active High. For Active Low the circuit looks like:<\/p>\n<figure id=\"attachment_15445\" aria-describedby=\"caption-attachment-15445\" style=\"width: 588px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-15445 size-medium\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/active_low-588x600.png\" alt=\"active_low\" width=\"588\" height=\"600\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/active_low-588x600.png 588w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/active_low.png 653w\" sizes=\"auto, (max-width: 588px) 100vw, 588px\" \/><figcaption id=\"caption-attachment-15445\" class=\"wp-caption-text\">Arty: Active Low Reset Button<\/figcaption><\/figure>\n<p>The important thing to see in this image is that one side of the button is connected directly to ground (GND).\u00a0For Active High the circuit is a little different:<\/p>\n<figure id=\"attachment_15444\" aria-describedby=\"caption-attachment-15444\" style=\"width: 600px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-15444 size-medium\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/active_high-600x315.png\" alt=\"active_high\" width=\"600\" height=\"315\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/active_high-600x315.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/active_high-768x403.png 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/active_high-1024x538.png 1024w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/active_high-351x185.png 351w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/active_high-800x420.png 800w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/active_high.png 1112w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><figcaption id=\"caption-attachment-15444\" class=\"wp-caption-text\">Arty: Active High User Buttons<\/figcaption><\/figure>\n<p>This image shows the four user buttons on the <a href=\"https:\/\/digilent.com\/shop\/arty-board-artix-7-fpga-development-board-for-makers-and-hobbyists\/\">Arty<\/a>. Notice that these are directly connected to the 3.3 volt power line (VCC3V3). Both of these images were pulled directly from the <a href=\"https:\/\/digilent.com\/shop\/arty-board-artix-7-fpga-development-board-for-makers-and-hobbyists\/\">Arty<\/a>\u00a0schematic.<\/p>\n<p>The second method is to write a test project that takes the button as an input and uses a general purpose pin as an output. In Verilog this would look something like this:<\/p>\n<blockquote><p><span style=\"color: #800080;\"><strong>module\u00a0<\/strong><span style=\"color: #000000;\">btn_test (input btn, output gpio);<br \/>\n<\/span><\/span><strong><span style=\"color: #800080;\">assign<\/span> <\/strong>gpio = btn;<br \/>\n<strong><span style=\"color: #800080;\">endmodule<\/span><\/strong>;<\/p><\/blockquote>\n<p>After generating the output, a multi-meter can be used on the output pin and the button can be pressed to find the polarity of the button.<\/p>\n<p>Also important to note is that on some of our boards the 7-segment displays are Active Low. A good way to test this is to use the button that was just tested to trigger one of the segments. This would look like the following in Verilog:<\/p>\n<blockquote><p><span style=\"color: #800080;\"><strong>module\u00a0<\/strong><span style=\"color: #000000;\"><span style=\"color: #333333;\">btn_test (input btn, output an, output [6:0] cat);<\/span><br \/>\n<\/span><\/span><strong><span style=\"color: #800080;\">assign<\/span> <\/strong><span style=\"color: #333333;\">an<strong>\u00a0<\/strong>= 1&#8217;b1;<br \/>\n<strong><span style=\"color: #800080;\">assign<\/span> <\/strong>cat = 7{btn};<\/span><br \/>\n<strong><span style=\"color: #800080;\">endmodule<\/span><\/strong>;<\/p><\/blockquote>\n<p>This small module will take the button as an input and drive all 7 cathodes based on the state of the button. One of the digits should show an eight.<\/p>\n<p>Now that you can find out the polarity of your I\/O you can go forth with converting your projects from one board to another. Have you ever experienced issues with signal polarity in the past? What other problems have you run into when working with FPGAs?<\/p>\n<div class='watch-action'><div class='watch-position align-left'><div class='action-like'><a class='lbg-style6 like-15184 jlk' data-task='like' data-post_id='15184' data-nonce='822831b204' rel='nofollow'><img src='https:\/\/digilent.com\/blog\/wp-content\/plugins\/wti-like-post-pro\/images\/pixel.gif' title='Like' \/><span class='lc-15184 lc'>0<\/span><\/a><\/div><div class='action-unlike'><a class='unlbg-style6 unlike-15184 jlk' data-task='unlike' data-post_id='15184' data-nonce='822831b204' rel='nofollow'><img src='https:\/\/digilent.com\/blog\/wp-content\/plugins\/wti-like-post-pro\/images\/pixel.gif' title='Unlike' \/><span class='unlc-15184 unlc'>0<\/span><\/a><\/div><\/div> <div class='status-15184 status align-left'>Be the 1st to vote.<\/div><\/div><div class='wti-clear'><\/div>","protected":false},"excerpt":{"rendered":"<p>Brandon guides us through how to figure out signal polarity for your FPGA.<\/p>\n","protected":false},"author":43,"featured_media":15444,"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,"footnotes":""},"categories":[35,1563],"tags":[1662],"ppma_author":[4494],"class_list":["post-15184","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-fpga","category-guide","tag-fpga"],"jetpack_featured_media_url":"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/active_high.png","authors":[{"term_id":4494,"user_id":43,"is_guest":0,"slug":"bkallaher","display_name":"Brandon Kallaher","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/b6927b72ef9c9b76b651dd857b9f26c4cca49d22768de51eaf494d3277e34c6f?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\/15184","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\/43"}],"replies":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/comments?post=15184"}],"version-history":[{"count":0,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/15184\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/media\/15444"}],"wp:attachment":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/media?parent=15184"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/categories?post=15184"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/tags?post=15184"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=15184"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}