{"id":2097,"date":"2014-08-27T14:49:59","date_gmt":"2014-08-27T21:49:59","guid":{"rendered":"https:\/\/blog.digilentinc.com\/?p=2097"},"modified":"2025-07-21T09:00:06","modified_gmt":"2025-07-21T16:00:06","slug":"digilent-pmods-communication-is-key","status":"publish","type":"post","link":"https:\/\/digilent.com\/blog\/digilent-pmods-communication-is-key\/","title":{"rendered":"Digilent Pmods: Communication Is Key"},"content":{"rendered":"<p>Welcome back to the Digilent Blog!<\/p>\n<p>&nbsp;<\/p>\n<p>We are going to continue with our <a href=\"https:\/\/digilent.com\/shop\/boards-and-components\/system-board-expansion-modules\/pmods\/\">Pmod<\/a> series and talk about how you get the Pmod (peripheral module) to do what you want it to do. After all, it is not the best plan (especially in electronics) to just plug something in to a random spot and hope the device works correctly. The vast majority of the peripheral modules in the Pmod line collect or receive data (or both) and need to communicate this data with the host board. A GPS module that doesn&#8217;t send its coordinates to the host or an audio\u00a0amplifier that does not receive data from the host are not terribly useful. Successful communication is key in any relationship, electronic or otherwise.<\/p>\n<p>&nbsp;<\/p>\n<p>With the wide variety of Pmods available, there are also a number of communication styles different Pmods might use.<\/p>\n<figure id=\"attachment_2100\" aria-describedby=\"caption-attachment-2100\" style=\"width: 600px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2014\/08\/colored-spi.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-2100\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2014\/08\/colored-spi.jpg\" alt=\"Digilent's SPI Pmod Joystick\" width=\"600\" height=\"513\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2014\/08\/colored-spi.jpg 2790w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2014\/08\/colored-spi-300x256.jpg 300w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2014\/08\/colored-spi-1024x873.jpg 1024w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2014\/08\/colored-spi-600x512.jpg 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2014\/08\/colored-spi-800x683.jpg 800w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><figcaption id=\"caption-attachment-2100\" class=\"wp-caption-text\">Digilent&#8217;s SPI Pmod JoyStick (Pmod JSTK).<\/figcaption><\/figure>\n<p>SPI (serial peripheral interface) is a useful communication style originally developed by Motorola. It uses four communication pins, along with a power and\u00a0ground pin, so SPI is easily used with the 6-pin and\u00a012-pin Pmod standards. In SPI, there is generally a &#8220;master&#8221; device (the host board) and a\u00a0&#8220;slave&#8221; device (the Pmod) that communicate. To do so, the master will select one of its slaves with it&#8217;s slave select (SS) communication line to indicate\u00a0to the Pmod that it is going to communicate with it. The master and the slave will then simultaneously communicate with each other (a full-duplex operation)\u00a0on the MOSI (Master Out Slave In) and the MISO (Master In Slave Out) data lines. Both the master and the slave send one bit of information to each other\u00a0after the master sends out a clock pulse on the SCK (serial clock) line to ensure that the timing of the data transfer is correct. Once a full byte, or eight bits of\u00a0information, has\u00a0been sent to the other device, the master (based on whatever code the programmer chooses) can either communicate again with the slave device or stop its\u00a0communication with the slave device.<\/p>\n<p>&nbsp;<\/p>\n<p>With its full-duplex capability, SPI is a fast communication standard. It can also support having multiple slave devices, but additional state-space (SS) data lines would need to be added, which takes up input\/output pins on the host board that\u00a0could have been used for other operations.<\/p>\n<figure id=\"attachment_2101\" aria-describedby=\"caption-attachment-2101\" style=\"width: 600px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2014\/08\/colored-uart.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-2101\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2014\/08\/colored-uart.jpg\" alt=\"Digilent's 2 wire (receive and transmit) UART Pmod GPS\" width=\"600\" height=\"482\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2014\/08\/colored-uart.jpg 1513w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2014\/08\/colored-uart-300x240.jpg 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><figcaption id=\"caption-attachment-2101\" class=\"wp-caption-text\">Digilent&#8217;s 2-wire (receive and transmit) UART PmodGPS.<\/figcaption><\/figure>\n<p>UART stands for a &#8220;universal asynchronous receiver\/transmitter&#8221; and was developed by Gordon Bell at Digital Equipment Corporation in the 1960s. The\u00a0&#8220;universal&#8221; portion refers to\u00a0the format of the data and the speed of the transmission are configurable. UARTs are able to communicate\u00a0in several different modes: full-duplex, half-duplex (the two devices communicate with each other one at a time), or simplex (the data communication is one\u00a0way only). Because UARTs are configurable in their communication style, both the transmitting and receiving UARTs need to be configured in the exact same way\u00a0to ensure that successful communication occurs.<\/p>\n<p>&nbsp;<\/p>\n<p>UARTs are designed to communicate with other UARTs, although they generally do not directly generate the communication themselves; they only transmit and receive\u00a0the signals. The transmitting UART will receive a byte from the host board, and then, using its internal shift register, first send a &#8220;start&#8221; bit to\u00a0communicate to the receiving UART that information is about to be transferred. The byte of information is then sent one bit at a time, followed by a &#8220;stop&#8221;\u00a0bit after the expected number of bits has been recieved, letting the communication line go high. The receiving UART takes the stream of bits and uses its\u00a0<a title=\"Shift Registers\" href=\"https:\/\/digilent.com\/blog\/index.php\/shift-registers\/\" target=\"_blank\" rel=\"noopener\">SIPO shift register<\/a>\u00a0to make the data available to it&#8217;s host controller.<\/p>\n<p>&nbsp;<\/p>\n<p>For the Pmod line, there are two different variations of UART that are used. The reason for this is primarily historical&#8211;at the time that UART pin interfaces\u00a0were designed, microcontroller chips had completely separate SPI and UART interfaces that had no relation to each other. However, as newer microcontroller\u00a0chips were developed, such as some of the newer PIC32s, they had serial interfaces that could work with both SPI and UART. To accommodate for this change, the\u00a0UART interfaces on Pmods were also adjusted from the old standard so that they could easily share the same pins as the SPI pinouts.<\/p>\n<figure id=\"attachment_2098\" aria-describedby=\"caption-attachment-2098\" style=\"width: 600px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2014\/08\/colored-i2c.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-2098\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2014\/08\/colored-i2c.jpg\" alt=\"Digilent's I2C Pmod Compass\" width=\"600\" height=\"619\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2014\/08\/colored-i2c.jpg 1800w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2014\/08\/colored-i2c-290x300.jpg 290w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2014\/08\/colored-i2c-993x1024.jpg 993w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><figcaption id=\"caption-attachment-2098\" class=\"wp-caption-text\">Digilent&#8217;s I2C Pmod compass (PmodCMPS).<\/figcaption><\/figure>\n<p>I\u00b2C (generally pronounced I-squared-C) is a communication style originally developed by Phillips Semiconductor (now NXP Semiconductor). In this protocol, originally intended to be part of the &#8220;<a title=\"Digilent Pmods \u2013 an Introduction\" href=\"https:\/\/digilent.com\/blog\/index.php\/digilent-pmods-an-introduction\/\">Imod series<\/a>&#8220;, only two communication pins are used: a serial data line (SDA) which is shared by both the master and\u00a0slave devices, and an SCK, which the master controls. In the widely used 9-bit communication style of I\u00b2C, a master will pull the SDA low\u00a0as\u00a0the &#8220;START&#8221; condition to indicate that it wishes to communicate with a slave device and transmit two things&#8211;the 7-bit address of the slave it wishes to\u00a0communicate with, and then either a read or write bit to show how it wants to communicate with the Pmod. For the 9th bit, and the 9th clock signal, a slave\u00a0with the matching address will send an acknowledge (ACK) bit on the SDA line to show that it is ready to communicate. If there was no slave with the 7-bit\u00a0address, the SDA line would be pulled up high during the 9th clock cycle and the master would interpret this as a not acknowledged (NAK) signal.<\/p>\n<p>&nbsp;<\/p>\n<p>Assume\u00a0that a Pmod does send an ACK signal, 9 more bits would then be transferred; the first 8 bits will be the information that is to be communicated\u00a0either from the master or from the slave, depending if a read or write command was originally sent. If the master wants to keep sending information, it will\u00a0wait to see if an ACK from the Pmod on the 9th clock cycle, or send an ACK response to the slave if it wants to receive more information from the slave. To\u00a0end communication, the master may send a NAK signal after sending or receiving a byte of data for the 9th clock cycle. The master may then issue a &#8220;reSTART&#8221;\u00a0to start a fresh communication or should release the SDA line as its &#8220;STOP&#8221; condition.<\/p>\n<p>nbsp;<\/p>\n<p>Although this communication style is not as fast as SPI (because it only operates in half-duplex), it is far easier to create a string or &#8220;daisy-chain&#8221; of I\u00b2C\u00a0devices. This is because the Pmods that offer I\u00b2C communication styles have a 2&#215;4 pin header for I\u00b2C, allowing for two sets of I\u00b2C. Additionally, because the\u00a0communication style is set up where the master calls out a slave address as opposed to selecting a specific slave on its own line, only two input\/output\u00a0pins are ever needed for a I\u00b2C communication setup.<\/p>\n<figure id=\"attachment_2099\" aria-describedby=\"caption-attachment-2099\" style=\"width: 601px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2014\/08\/colored-io.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-2099\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2014\/08\/colored-io.jpg\" alt=\"Digilent's GPIO Pmod Button Module\" width=\"601\" height=\"362\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2014\/08\/colored-io.jpg 3089w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2014\/08\/colored-io-300x180.jpg 300w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2014\/08\/colored-io-1024x616.jpg 1024w\" sizes=\"auto, (max-width: 601px) 100vw, 601px\" \/><\/a><figcaption id=\"caption-attachment-2099\" class=\"wp-caption-text\">Digilent&#8217;s GPIO Pmod Button Module.<\/figcaption><\/figure>\n<p>And finally, Pmods also communicate with the host board through general purpose input\/output (GPIO) pins. This does not follow follow a strict set of rules\u00a0regarding how the Pmod and the host should communicate. Rather, the host is able to send high, low, pulse-width modulation (PWM), analog, audio, and\u00a0a variety of other signal types\u00a0to the Pmod at any time and have the Pmod respond (more or less) immediately. This is great if you want to get a response whenever you press a\u00a0button or flip a switch. The host could also receive the same variety of signals from the Pmod at any time, but it depends on how the code is designed to\u00a0have the host respond to or ignore the signals. Also, because we are using input\/output pins for communication, we can become rapidly limited in our\u00a0capability to operate a large amount of peripheral modules.<\/p>\n<p data-start=\"1506\" data-end=\"1572\">Example Application: if you&#8217;re designing a motion-detecting application, consider using the <a href=\"https:\/\/digilent.com\/shop\/pmod-pir-passive-infrared-motion-sensor\/\">Pmod Passive Infrared Motion Sensor<\/a>. The Pmod PIR communicates through the GPIO pins and can easily integrate with various host boards. It\u2019s designed to detect motion through passive infrared sensors, which is perfect for applications like security systems, automation, or even interactive displays.<\/p>\n<p>In setups where a direct Pmod connection isn\u2019t practical\u2014such as when using breadboards, jumper wires, or custom wiring\u2014something like the <a href=\"https:\/\/digilent.com\/shop\/pmod-con1-wire-terminal-connectors\/\">Pmod CON1 Wire Terminal Connectors<\/a> can make integration much easier. These allow secure wire connections without needing a standard Pmod header on your host board.<\/p>\n<p>And now for our bonus historic information! You may have noticed that a few of these communication styles keep the data communication line in a high, or\u00a0powered, state when they waiting for a new communication to occur. This is leftover from the telegraph era where the communication line was held in a high\u00a0voltage state when it was not being used to show that neither the line nor the transmitter were damaged.<\/p>\n<div class='watch-action'><div class='watch-position align-left'><div class='action-like'><a class='lbg-style6 like-2097 jlk' data-task='like' data-post_id='2097' data-nonce='7bbabbf9c6' rel='nofollow'><img src='https:\/\/digilent.com\/blog\/wp-content\/plugins\/wti-like-post-pro\/images\/pixel.gif' title='Like' \/><span class='lc-2097 lc'>0<\/span><\/a><\/div><div class='action-unlike'><a class='unlbg-style6 unlike-2097 jlk' data-task='unlike' data-post_id='2097' data-nonce='7bbabbf9c6' rel='nofollow'><img src='https:\/\/digilent.com\/blog\/wp-content\/plugins\/wti-like-post-pro\/images\/pixel.gif' title='Unlike' \/><span class='unlc-2097 unlc'>0<\/span><\/a><\/div><\/div> <div class='status-2097 status align-left'>Be the 1st to vote.<\/div><\/div><div class='wti-clear'><\/div>","protected":false},"excerpt":{"rendered":"<p>We are going to continue with our Pmod series and talk about how you get the Pmod (peripheral module) to do what you want it to do. After all, it is not the best plan (especially in electronics) to just plug something in to a random spot and hope the device works correctly. The vast majority of the peripheral modules in the Pmod line collect or receive data (or both) and need to communicate this data with the host board. A GPS module that doesn&#8217;t send its coordinates to the host or an audio amplifier that does not receive data from the host are not terribly useful. Successful communication is key in any relationship, electronic or otherwise.<\/p>\n","protected":false},"author":17,"featured_media":2100,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[38],"tags":[],"ppma_author":[4469],"class_list":["post-2097","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-expansion-modules"],"jetpack_featured_media_url":"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2014\/08\/colored-spi.jpg","authors":[{"term_id":4469,"user_id":17,"is_guest":0,"slug":"jamescolvin","display_name":"James Colvin","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/509febded809c5de0423909f6ae6587f?s=96&d=mm&r=g","author_category":"","user_url":"","last_name":"Colvin","last_name_2":"","first_name":"James","first_name_2":"","job_title":"Applications Engineer \/ Technical Support Engineer \/ Product Support Engineer \/ Technical Writer \/ the person to bother about T&M and JTAG when the senior design engineer is busy","description":"A local Digilent employee who is sometimes tricked into making other content besides documentation and supporting customers on the Digilent Forum, but then I get to write a little more informally so that's a plus. \r\n\r\nA sassy engineer, lover of puns and dad jokes, father and husband. \r\n\r\nI know both way too much and simultaneously almost nothing about a number of nerdy topics. If you want to hear me rant, ask me what data rate USB C operates at."}],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/2097","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\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/comments?post=2097"}],"version-history":[{"count":4,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/2097\/revisions"}],"predecessor-version":[{"id":31786,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/2097\/revisions\/31786"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/media\/2100"}],"wp:attachment":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/media?parent=2097"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/categories?post=2097"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/tags?post=2097"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=2097"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}