<?xml-stylesheet type="text/xsl" href="https://community.element14.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>BBB - USB I/O with FTDI FT2232H</title><link>/products/devtools/single-board-computers/next-genbeaglebone/b/blog/posts/bbb---usb-i-o-with-ftdi-ft2232h</link><description>Introduction - why would you want to extend I/O over USB?The Beaglebone Black&amp;#39;s PRU allows very high speed I/O capabilities with guaranteed timing while Linux applications continue to run. As useful as this is, occasionally there may be a need to use</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: BBB - USB I/O with FTDI FT2232H</title><link>https://community.element14.com/products/devtools/single-board-computers/next-genbeaglebone/b/blog/posts/bbb---usb-i-o-with-ftdi-ft2232h</link><pubDate>Wed, 24 Oct 2018 17:23:52 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:2ebbaa5d-3a7e-4744-baa1-d950963a3a80</guid><dc:creator>ravi_butani</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Hii &lt;span&gt;[mention:b0bc65b9ecdc4307bd967592f00e340a:e9ed411860ed4f2ba0265705b8793d05]&lt;/span&gt;..&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Excellent tutorial... Just worked like a charm for synchronous FIFO implementation on FT232H by changing PID...&lt;/p&gt;&lt;p&gt;I am designing IRNSS GNSS Receiver and want to record IQ data from my DIY RF Frontend for post processing at 6MBPS rate... Seriously you saved me &lt;span&gt;[View:/resized-image/__size/16x16/__key/commentfiles/f7d226abd59f475c9d224a79e3f0ec07-2ebbaa5d-3a7e-4744-baa1-d950963a3a80/contentimage_5F00_3.png:16:16]&lt;/span&gt; its one of the critical task for my ongoing PhD...&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Thanks,&lt;/p&gt;&lt;p&gt;Ravi&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=16221&amp;AppID=80&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: BBB - USB I/O with FTDI FT2232H</title><link>https://community.element14.com/products/devtools/single-board-computers/next-genbeaglebone/b/blog/posts/bbb---usb-i-o-with-ftdi-ft2232h</link><pubDate>Mon, 15 Jul 2013 20:56:48 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:2ebbaa5d-3a7e-4744-baa1-d950963a3a80</guid><dc:creator>Former Member</dc:creator><slash:comments>1</slash:comments><description>&lt;blockquote class="jive-quote"&gt;&lt;p&gt;It appears that bytes are guaranteed to skip, and I&amp;#39;m guessing this is because there is a delay writing to the filesystem. With a very short *WR pulse (of the order of tens on nsec) the number of bytes written to file appear to be close to the expected value (assuming that the FT2232H is trying to capture at 60MHz). At any longer pulse, bytes are skipped. For further investigation!&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;That&amp;#39;s likely to be a USB limitation, remember USB 2.0 is 480Mbit/s so at it&amp;#39;s theoretical maximum, divide by 8 and you get 60MB/s. Effective throughput is much less due to protocol overheads and any other devices on the bus. Think about a keyboard that&amp;#39;s operating at 1.5Mbit/s on the same bus, how much of your theoretical 60MB/s gets lost when a single bit takes 320 times as long to send ?&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Also, when you&amp;#39;re doing this on a BBB think in terms of the overall system, can you write to the eMMC or SD card at 60MB/s, or even 30MB/s, probably not. If you&amp;#39;re using a USB hard drive then you fall foul of only having a single USB port and having to share the bandwidth.&amp;nbsp; Network perhaps ?&amp;nbsp; No as it&amp;#39;s only a 100Mbit/s network port.&amp;nbsp; So you&amp;#39;re left with writing to buffer cache which will get flushed to storage later, but if we assume 60MB/s and only 512MB RAM at least some of which is already in use you won&amp;#39;t get long before you&amp;#39;ve exhausted that resource as well.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;So the 60MHz advertised rate only works so long as you can empty, or fill the usb buffers in the 2232 fast enough, after that you either have to pause to catch up or start dropping captured samples on the floor.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;For me this detracts quite a lot from using USB connected stuff for anything serious as you basically need to put a microcontroller, fpga or similar onto the other end of the usb cable to do the interesting stuff for you. It needs enough local memory to meet whatever the requirement is since it can&amp;#39;t guarantee it can pass it back over usb quickly enough. &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;There&amp;#39;s things like the Open Bench Logic Sniffer that do exactly this, and scaled up a bit you could look at the BBB connected to your bigger PC over usb in much the same way &lt;span&gt;[View:/resized-image/__size/16x16/__key/commentfiles/f7d226abd59f475c9d224a79e3f0ec07-2ebbaa5d-3a7e-4744-baa1-d950963a3a80/contentimage_5F00_1.png:16:16]&lt;/span&gt;&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=16221&amp;AppID=80&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: BBB - USB I/O with FTDI FT2232H</title><link>https://community.element14.com/products/devtools/single-board-computers/next-genbeaglebone/b/blog/posts/bbb---usb-i-o-with-ftdi-ft2232h</link><pubDate>Mon, 15 Jul 2013 12:06:07 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:2ebbaa5d-3a7e-4744-baa1-d950963a3a80</guid><dc:creator>Former Member</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;I forgot to say, your diagram shows libftdi &amp;amp; libusbx sitting on top of a driver.&amp;nbsp; That&amp;#39;s slightly misleading. While there will be a driver of some sort for the USB host port that will be there regardless if you want to be able to talk to the usb bus.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;The diagram could give the impression that you need the ftdi_sio driver installed and libusbx then talks to that, but a big part of the point of libusbx is that you can talk to the device without requiring a driver at all and can therefore write your driver as a userspace application.&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=16221&amp;AppID=80&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: BBB - USB I/O with FTDI FT2232H</title><link>https://community.element14.com/products/devtools/single-board-computers/next-genbeaglebone/b/blog/posts/bbb---usb-i-o-with-ftdi-ft2232h</link><pubDate>Mon, 15 Jul 2013 10:33:21 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:2ebbaa5d-3a7e-4744-baa1-d950963a3a80</guid><dc:creator>Former Member</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;A couple of observations as I&amp;#39;m just delving into libftdi for a second time... Lots of the libftdi code has hard coded device id&amp;#39;s that dont cover all of the available ftdi devices. For example the &lt;em&gt;ftdi_usb_find_&lt;strong&gt;all&lt;/strong&gt;&lt;/em&gt; api function defaults to a limited subset which doesn&amp;#39;t include the device I&amp;#39;m currently using. &lt;/p&gt;&lt;p&gt;This makes it rather more interesting when none of the examples work and you don&amp;#39;t (initially) know if it&amp;#39;s the board you&amp;#39;ve just built, their code, your code or whatever.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;libconfuse isn&amp;#39;t needed for libftdi itself, only for ftdi_eeprom&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;libusbx is a fork of libusb. Whatever you think of forks, or the reasons behind this one, it&amp;#39;s worth mentioning a couple of specific things in this case.&amp;nbsp; Currently libusb and libusbx are more or less compatible from a features and api perspective, however the libusbx folks deliberately decided to make libusbx a straight drop-in replacement using the same soname and version. This has the side effect that you can&amp;#39;t install both, you have to pick a side.&amp;nbsp; That leads you to the problem of which one your distro picked and has hard-coded into various package dependencies.&lt;/p&gt;&lt;p&gt;Currently the only apparent difference for libusbx is the addition of a &amp;#39;version&amp;#39; call in the API, but as the two APIs inevitably diverge then either the drop-in replacement strategy will have to change, or you will get issues.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;The bitbang modes (with the possible exception of mpsse mode which I haven&amp;#39;t tried) are only suitable for very simple gpio usage.&amp;nbsp; Previous experience shows that your 20000 writes per second won&amp;#39;t produce a square wave and the variations won&amp;#39;t be consistent from one cycle to the next.&lt;/p&gt;&lt;p&gt;Rather than using ftdi_read_pins and such like, it&amp;#39;s possible to set the baud rate and then use ftdi_read_data to read data that&amp;#39;s supposedly clocked in at the baud rate you&amp;#39;ve set, or to use ftdi_write_data to clock out a buffer full of data.&lt;/p&gt;&lt;p&gt;Again though, it appears there&amp;#39;s variable latency somewhere and what you get on a scope isn&amp;#39;t what you expect.&lt;/p&gt;&lt;p&gt;So for simple on/off requirements it&amp;#39;s fine, or for something where you use one of your bitbang pins as a clock that the other end can sync with everything is fine. Timing sensitive stuff, not so much.&lt;/p&gt;&lt;p&gt;None of this was helped by the internal ftdi_convert_baudrate in the previous versions of libftdi I was using producing invalid divisors. I&amp;#39;ve not checked the current release, but some of my previous code has a complete re-implementation of this function as well as a way to send the divisor direct to the chip using libusb to allow me to circumvent libftdi in this area.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;When debugging anything with these, if you have a couple of spare pins available it&amp;#39;s worth configuring them as BitBang_RD# and BitBang_WR# as those give you a good reference point for the scope and show something of what the chip is doing internally.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;There&amp;#39;s now an FT232H available that&amp;#39;s basically a single channel version of the FT2232H. I&amp;#39;d always thought the 2232&amp;#39;s and 4232&amp;#39;s were overpriced and you rarely need the multiple channels. The 232H has the interesting features like the MPSSE that weren&amp;#39;t previously available on the likes of the FT232RL while managing to be cheaper than both.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;My current project using an FT230X as a USB/GPIO expander:&lt;/p&gt;&lt;p&gt;&lt;span&gt;[View:/resized-image/__size/589x428/__key/commentfiles/f7d226abd59f475c9d224a79e3f0ec07-2ebbaa5d-3a7e-4744-baa1-d950963a3a80/contentimage_5F00_175687.jpg:589:428]&lt;/span&gt;&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=16221&amp;AppID=80&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item></channel></rss>