{"id":806,"date":"2015-06-02T11:11:57","date_gmt":"2015-06-02T19:11:57","guid":{"rendered":"http:\/\/www.beyond-circuits.com\/wordpress\/?page_id=806"},"modified":"2016-09-23T15:18:27","modified_gmt":"2016-09-23T23:18:27","slug":"tutorial20","status":"publish","type":"page","link":"https:\/\/www.beyond-circuits.com\/wordpress\/tutorial\/tutorial20\/","title":{"rendered":"Tutorial 20: I2S Loopback"},"content":{"rendered":"<h1>I2S Loopback<\/h1>\n<p>In this tutorial, we&#8217;ll build an FPGA that loops the I2S receive data back to the I2S transmitter. Basically, an even more complicated wire. Don&#8217;t worry\u2013 in our next tutorial, we&#8217;ll be doing some processing on the data inside the FPGA.<\/p>\n<h1>Packaging the transmitter and receiver IP<\/h1>\n<p>If you still have the Vivado projects from doing the IP transmitter and receiver, you should open the receiver\u00a0up now. If not, you should create a new Vivado project containing only the I2S receiver design.<\/p>\n<p>You should see something like the following figure in your Project Manager view:<a href=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/06\/tutorial20_fig1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-807\" src=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/06\/tutorial20_fig1.png\" alt=\"tutorial20_fig1\" width=\"416\" height=\"307\" srcset=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/06\/tutorial20_fig1.png 416w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/06\/tutorial20_fig1-300x221.png 300w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/06\/tutorial20_fig1-407x300.png 407w\" sizes=\"auto, (max-width: 416px) 100vw, 416px\" \/><\/a><\/p>\n<p>Notice that the i2s_receive module is in the Design Sources section. This means that it&#8217;s part of your FPGA design. It is also in the simulation sources view as well. But there are other files there as well, which compose the other simulation files.<\/p>\n<p>Go to the <strong>Tools<\/strong> menu and select <strong>Create and Package New IP<\/strong>. Click <em><strong>Next<\/strong><\/em>, make sure the <em>Package your current project<\/em> option is selected, then click <strong><em>Next<\/em><\/strong> again. Select a location for your IP repository and click <strong><em>Next<\/em><\/strong>. You should use the same location when creating both the I2S transmitter and receive packages. A dialog box will appear,\u00a0asking for you to <strong>Confirm Copy Sources<\/strong>. This lets you know that the source files for the IP will be copied to the IP repository. Go ahead and click <em><strong>OK<\/strong><\/em>.<a href=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/06\/tutorial20_fig2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-808\" src=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/06\/tutorial20_fig2.png\" alt=\"tutorial20_fig2\" width=\"565\" height=\"143\" srcset=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/06\/tutorial20_fig2.png 565w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/06\/tutorial20_fig2-300x76.png 300w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/06\/tutorial20_fig2-500x127.png 500w\" sizes=\"auto, (max-width: 565px) 100vw, 565px\" \/><\/a><\/p>\n<p>You should now click <strong><em>Finish<\/em><\/strong> on the <strong>Create and Package New IP<\/strong> dialog.<\/p>\n<p>Vivado seems to get a little confused and tries to use the simulation test as the IP top module. I get a message which looks like this. You will not see this if your project has no simulation files.<a href=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/06\/tutorial20_fig3.png\"><img loading=\"lazy\" decoding=\"async\" class=\" size-full wp-image-809 aligncenter\" src=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/06\/tutorial20_fig3.png\" alt=\"tutorial20_fig3\" width=\"389\" height=\"257\" srcset=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/06\/tutorial20_fig3.png 389w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/06\/tutorial20_fig3-300x198.png 300w\" sizes=\"auto, (max-width: 389px) 100vw, 389px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Simply check the <strong>Specify a new top module<\/strong> option and select i2s_receive as the top module and click <strong><em>OK<\/em><\/strong>.<\/p>\n<p>You should now see the IP packager windows, like we have seen before:<a href=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/06\/tutorial20_fig4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-810\" src=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/06\/tutorial20_fig4.png\" alt=\"tutorial20_fig4\" width=\"765\" height=\"467\" srcset=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/06\/tutorial20_fig4.png 765w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/06\/tutorial20_fig4-300x183.png 300w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/06\/tutorial20_fig4-491x300.png 491w\" sizes=\"auto, (max-width: 765px) 100vw, 765px\" \/><\/a>All that we need to do is select <strong><em>File Groups<\/em><\/strong> and click the <span style=\"text-decoration: underline;\"><em>Merge changes from File Groups Wizard<\/em><\/span> link.<a href=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/06\/tutorial20_fig5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-811\" src=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/06\/tutorial20_fig5.png\" alt=\"tutorial20_fig5\" width=\"595\" height=\"308\" srcset=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/06\/tutorial20_fig5.png 595w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/06\/tutorial20_fig5-300x155.png 300w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/06\/tutorial20_fig5-500x259.png 500w\" sizes=\"auto, (max-width: 595px) 100vw, 595px\" \/><\/a>Then select the <em>Review and Package<\/em> tab and click <strong><em>Re-Package IP<\/em><\/strong>.\u00a0This will return you to your previous project.<\/p>\n<p>Repeat these steps to create an IP package for the I2S transmit design.<\/p>\n<h1>Creating the loopback design<\/h1>\n<p>Make a copy of your design from<a href=\"https:\/\/www.beyond-circuits.com\/wordpress\/tutorial\/tutorial17\/\"> tutorial 17<\/a> and open the design. We are going to modify the design to add the I2S receive and transmit blocks.<\/p>\n<p>Go ahead and add the <em>i2s_receive<\/em> and <em>i2s_transmit<\/em> IP blocks to the design. You may need to use the modify the IP portion of the Project Settings to point to your IP repository directory where you stored your <em>i2s_receive<\/em> and <em>i2s_transmit<\/em> IP blocks.<\/p>\n<p>After adding the <em>i2s_receive<\/em> and <em>i2s_transmit<\/em> blocks you need to connect the <em>adau1761_bclk<\/em> input pin to the <em>sck<\/em> ports of the two IP blocks. Also connect the <em>adau1761_lrclk<\/em> pin to the <em>ws<\/em> inputs. Connect <em>adau1761_adc_sdata<\/em> to the <em>mosi<\/em> input of the <em>i2s_receive<\/em> IP block, and the <em>adau1761_dac_sdata<\/em> output port to the miso output of the <em>i2s_transmit<\/em> block. Your final block design should look like this:<a href=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/06\/tutorial20_fig6.png\"><img loading=\"lazy\" decoding=\"async\" class=\" size-full wp-image-817 aligncenter\" src=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/06\/tutorial20_fig6.png\" alt=\"tutorial20_fig6\" width=\"1272\" height=\"690\" srcset=\"https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/06\/tutorial20_fig6.png 1272w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/06\/tutorial20_fig6-300x163.png 300w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/06\/tutorial20_fig6-1024x555.png 1024w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/06\/tutorial20_fig6-500x271.png 500w, https:\/\/www.beyond-circuits.com\/wordpress\/wp-content\/uploads\/2015\/06\/tutorial20_fig6-900x488.png 900w\" sizes=\"auto, (max-width: 1272px) 100vw, 1272px\" \/><\/a><\/p>\n<h1>Synthesis<\/h1>\n<p>Before we synthesize the design, we need to add an additional constraint. If you recall from <a href=\"https:\/\/www.beyond-circuits.com\/wordpress\/tutorial\/tutorial19\/\">tutorial 19<\/a>, the <em>sd<\/em> output was actually clocked from the falling edge of <em>sck<\/em>. Normally, when presented with a clock signal, the place and route tools try to create a balanced clock network using special clock resources in the FPGA. Part of this network is a low-latency path from the clock input pin to the clock network. Not all input pins have this ability, and only a few can\u00a0be used as a global clock. If we\u00a0try to synthesize the design as-is, we\u00a0will get an error saying that the clock input pin <em>adau1761_bclk<\/em> is not on a dedicated clock pin. We&#8217;re going to\u00a0need to override this error by using the following constraint:<\/p>\n<pre>set_property CLOCK_DEDICATED_ROUTE FALSE [get_nets adau1761_bclk_IBUF]<\/pre>\n<p>By setting this constraint, you&#8217;re basically indicating that you understand there will be some additional delay associated with not using a dedicated clock input pin. This is OK in our situation, since the clock will only be going to a single flip-flop, and if there is an extra few nanoseconds of delay on that path, it really doesn&#8217;t matter.<\/p>\n<p>After adding the constraint, you should be able to place and route the design and create a bit file. Program the FPGA as with tutorial and export the design to SDK. You can use the same software from tutorial 17 to test the design.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I2S Loopback In this tutorial, we&#8217;ll build an FPGA that loops the I2S receive data back to the I2S transmitter. Basically, an even more complicated wire. Don&#8217;t worry\u2013 in our next tutorial, we&#8217;ll be doing some processing on the data &hellip; <a href=\"https:\/\/www.beyond-circuits.com\/wordpress\/tutorial\/tutorial20\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":226,"menu_order":20,"comment_status":"open","ping_status":"open","template":"","meta":{"footnotes":""},"class_list":["post-806","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/pages\/806","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/comments?post=806"}],"version-history":[{"count":10,"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/pages\/806\/revisions"}],"predecessor-version":[{"id":1101,"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/pages\/806\/revisions\/1101"}],"up":[{"embeddable":true,"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/pages\/226"}],"wp:attachment":[{"href":"https:\/\/www.beyond-circuits.com\/wordpress\/wp-json\/wp\/v2\/media?parent=806"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}