<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Usb on Colin O'Flynn</title><link>https://colinoflynn.com/tag/usb/</link><description>Recent content in Usb on Colin O'Flynn</description><generator>Hugo</generator><language>en-ca</language><lastBuildDate>Sat, 18 Feb 2023 02:19:27 +0000</lastBuildDate><atom:link href="https://colinoflynn.com/tag/usb/index.xml" rel="self" type="application/rss+xml"/><item><title>USB Triggering &amp; Hacking</title><link>https://colinoflynn.com/2019/09/usb-triggering-hacking/</link><pubDate>Mon, 02 Sep 2019 01:50:39 +0000</pubDate><guid>https://colinoflynn.com/2019/09/usb-triggering-hacking/</guid><description>&lt;p&gt;This blog post covers several topics that I should have made independent posts about&amp;hellip; but anyway. Here we are. It&amp;rsquo;s September and I should have done this months ago.&lt;/p&gt;
&lt;h2 id="trezor--usb-hacking-updates-black-hat--woot"&gt;Trezor / USB Hacking Updates (Black Hat + WOOT)&lt;/h2&gt;
&lt;p&gt;I had an earlier blog post with details of the Trezor attack. It turns out this is more generic type of attack than I realized, so I extended this work into a WOOT paper as well. Quickly I thought I should update on that&amp;hellip;&lt;/p&gt;</description></item><item><title>ESC SV 2015 - USSSSSB: Talking USB From Python</title><link>https://colinoflynn.com/2015/06/esc-sv-2015-usssssb-talking-usb-from-python/</link><pubDate>Tue, 09 Jun 2015 01:51:57 +0000</pubDate><guid>https://colinoflynn.com/2015/06/esc-sv-2015-usssssb-talking-usb-from-python/</guid><description>&lt;p&gt;At ESC 2015 SV I gave a talk on using USB From Python,&lt;a href="http://www.embeddedconf.com/silicon_valley/scheduler/session/usssssb-talking-usb-from-python"&gt; see the talk description here&lt;/a&gt;. This blog post is serving as a placeholder to allow me to update links to software used during the live demo.&lt;/p&gt;
&lt;p&gt;For SuperCon 2015, there is a &lt;a href="https://hackaday.io/project/8251-usssssb-talking-usb-from-python-supercon-2015"&gt;Project Page&lt;/a&gt; with these details too. You can also ask questions on the project page.&lt;br /&gt;
&lt;h3&gt;Download Slides&lt;/h3&gt;&lt;br /&gt;
There is two versions of the slides. Use the SuperCon slides, but I left a copy of the ESC ones here in case you wanted the original for some reason.&lt;/p&gt;</description></item><item><title>USB Inrush Testing</title><link>https://colinoflynn.com/2015/03/usb-inrush-testing/</link><pubDate>Mon, 02 Mar 2015 23:51:31 +0000</pubDate><guid>https://colinoflynn.com/2015/03/usb-inrush-testing/</guid><description>&lt;p&gt;The USB spec has limits on the &amp;lsquo;inrush current&amp;rsquo;, which is designed to prevent you from having 2000uF of capacitance that must be suddenly charged when your board is plugged into the USB port.
The limit works out to around &lt;a href="http://www.testusb.com/inrush_issue.htm"&gt;10uF of capacitance&lt;/a&gt; . Your board might have much much more - so you&amp;rsquo;ll have to switch portions of your board on later with FETs as a soft-start.
For the ChipWhisperer-Lite, I naturally switch the FPGA + analog circuitry as to meet the 2.5 mA suspend current. Thus I only have to ensure the 3.3V supply for the SAM3U2C meets the inrush limits, which is a fairly easy task. This blog post describes how I did this testing.
The official &lt;a href="http://www.usb.org/developers/docs/wireless_documents/USB-IFTestProc1_3.pdf"&gt;USB Test Specs&lt;/a&gt; for inrush current testing describe the use of the Tektronix TCP202 which is $2000, and I don&amp;rsquo;t think I&amp;rsquo;d use again a lot. Thus I&amp;rsquo;m describing my cheaper/easier method.
First, I used a &lt;a href="http://store.newae.com/differential-probe-assembled-tested/"&gt;differential probe&lt;/a&gt; (part of the ChipWhisperer project, so you can see schematics) to measure the current across a 0.22 ohm shunt resistor. The value was selected as I happened to have one around&amp;hellip; you might want a smaller value (0.1 ohm say) even, as the voltage drop across this will reduce the voltage to your device. The differential probe has enough gain to give your scope a fairly clean signal. This shows my test board, where the differential probe is plugged into a simple 2-pin header:
&lt;a href="https://colinoflynn.com/wp-content/uploads/2015/03/P1080537.jpg"&gt;&lt;img src="https://colinoflynn.com/wp-content/uploads/2015/03/P1080537.jpg" alt="P1080537"&gt;&lt;/a&gt;
From the bottom, you can see where I cut the USB shield to bring the +5V line through the shunt:
&lt;a href="https://colinoflynn.com/wp-content/uploads/2015/03/P1080538.jpg"&gt;&lt;img src="https://colinoflynn.com/wp-content/uploads/2015/03/P1080538.jpg" alt="P1080538"&gt;&lt;/a&gt;
To calibrate the shunt + gain from the diff-probe, I just used some test loads, where I measure the current flowing through them with a DMM. You can then figure out the equation for converting the scope measurement to a current in amps.
&lt;a href="https://colinoflynn.com/wp-content/uploads/2015/03/P1080539.jpg"&gt;&lt;img src="https://colinoflynn.com/wp-content/uploads/2015/03/P1080539.jpg" alt="P1080539"&gt;&lt;/a&gt;
Finally, we plug in our actual board. Here I&amp;rsquo;ve plugged in the ChipWhisperer-Lite prototype. The following figure shows the measurement after I&amp;rsquo;ve used a math channel in PicoScope to convert the voltage to a current measurement, and I&amp;rsquo;ve annotated where some of these spikes come from:&lt;a href="https://colinoflynn.com/wp-content/uploads/2015/03/usb_power.png"&gt;&lt;img src="https://colinoflynn.com/wp-content/uploads/2015/03/usb_power.png" alt="usb_power"&gt;&lt;/a&gt;
Saving the data, we can run through the &lt;a href="http://www.usb.org/developers/tools/usb20_tools/USBET20_1_20_00_Installer.zip"&gt;USB Electrical Analysis Tool 2.0&lt;/a&gt; to get a test result. The USB-IF tool assumes your scope saves the files with time in seconds and current in amps. The PicoScope .csv files have time in miliseconds, so you need to import the file into Excel, divide the column by 1000, and save the file again. Finally you should get something like this:
&lt;a href="https://colinoflynn.com/wp-content/uploads/2015/03/compliance_results.png"&gt;&lt;img src="https://colinoflynn.com/wp-content/uploads/2015/03/compliance_results.png" alt="compliance_results"&gt;&lt;/a&gt;
Note the inrush charge is &amp;gt; 50mC, but there is an automatic waiver for anything &amp;lt; 150 mC. While the system would be OK due to the waiver, I would prefer to avoid exceeding the 50 mC limit. In this case there&amp;rsquo;s an easy solution - I can delay the USB enumeration slightly from processor power-on, which limits the inrush to only the charging of the capacitors (which is done by ~15mS). This results in about 47 mC. This means I&amp;rsquo;ve got about 100 mC of headroom before I exceed the official limits!
This extra headroom is needed in case of differences due to my use of the shunt for example.
In addition, I should be adjusting the soft-start FET gate resistor to reduce the size of that huge soft-start spike. Ideally the capacitor charging shouldn&amp;rsquo;t draw more than the 500mA I claim when I enumerate, so that&amp;rsquo;s a little out of spec as-is! If I don&amp;rsquo;t want to change hardware I could consider using PWM on the FET gate even&amp;hellip;&lt;/p&gt;</description></item><item><title>Making a USB-HID Keyboard Encoder Board for PicoScope</title><link>https://colinoflynn.com/2014/01/making-a-usb-hid-keyboard-encoder-board-for-picoscope/</link><pubDate>Sun, 05 Jan 2014 01:46:00 +0000</pubDate><guid>https://colinoflynn.com/2014/01/making-a-usb-hid-keyboard-encoder-board-for-picoscope/</guid><description>&lt;p&gt;Ever wanted to control something from a knobby-looking USB peripheral? In this example I wanted to control the PicoScope software from a bunch of encoders mounted on a USB peripheral:&lt;br /&gt;
&lt;img class="regImage pluginImg93" src="https://colinoflynn.com/oldsite/tiki-download_file.php?fileId=93&amp;amp;display" alt="Image" width="500" height="231" /&gt;&lt;/p&gt;
&lt;p&gt;</description></item><item><title>Quit wasting time debugging USB: Using TotalPhase Triggers</title><link>https://colinoflynn.com/2013/04/quit-wasting-time-debugging-usb-using-totalphase-triggers/</link><pubDate>Mon, 29 Apr 2013 01:52:00 +0000</pubDate><guid>https://colinoflynn.com/2013/04/quit-wasting-time-debugging-usb-using-totalphase-triggers/</guid><description>&lt;p&gt;&lt;img src="https://colinoflynn.com/oldsite/tiki-download_file.php?fileId=81&amp;amp;display" alt="Image"&gt;
This blog post might seem commercial&amp;hellip; but I have no connection to TotalPhase. I&amp;rsquo;ve used their Beagle 480 USB analyser for some time, and before that have used a variety of other solutions (mostly SW-based), so have some idea what other options are out there.
It&amp;rsquo;s worth noting that they seem to give free updates forever. When I first used the Beagle 480 it could dissect mass storage &amp;amp; HID I think. Since then they&amp;rsquo;ve added almost every class possible&amp;hellip; hell you can even do stuff like sniff a USB-Ethernet device, and pass the frames to Wireshark for IP-layer decoding. Total Phase has added tons of features in the last 4-5 years I&amp;rsquo;ve used this device, and they&amp;rsquo;ve all been freely available and usable with my device.
So why do I think other debuggers are a waste of time? Simply: the ability to trigger in/out of the device. Check out this video for more:
&lt;a href="http://www.youtube.com/watch?v=XX4rV1UmcIU&amp;amp;hd=1"&gt;&lt;img src="https://colinoflynn.com/oldsite/tiki-download_file.php?fileId=77&amp;amp;display" alt="Image"&gt;&lt;/a&gt;
 
I also wrote about some of this in an article in Circuit Cellar, see &lt;a href="http://www.cc-webshop.com/241-August-2010-Advanced-USB-Design-Debugging-SA-2010-241-020.htm"&gt;The CC Webstore&lt;/a&gt; if you want to check that out, but the part I talk about debugging with the 480 is only a few paragraphs.
Basically you can do stuff like the following:&lt;/p&gt;</description></item><item><title>Split Ground Plane: Example of failing high-speed signals</title><link>https://colinoflynn.com/2013/04/split-ground-plane-example-of-failing-high-speed-signals/</link><pubDate>Sat, 06 Apr 2013 01:16:00 +0000</pubDate><guid>https://colinoflynn.com/2013/04/split-ground-plane-example-of-failing-high-speed-signals/</guid><description>&lt;p&gt;&lt;img src="https://colinoflynn.com/oldsiteasd/tiki-download_file.php?fileId=76&amp;amp;display&amp;amp;max=600" alt="Image"&gt;
I&amp;rsquo;ve got a SASEBO-W board, which has a FPGA &amp;amp; a FT2232H for high-speed USB comms. I was seeing errors on the high-speed USB device, and couldn&amp;rsquo;t figure out why:
&lt;img src="https://colinoflynn.com/oldsiteasd/tiki-download_file.php?fileId=70&amp;amp;display&amp;amp;x=600&amp;amp;y=156" alt="Image"&gt;&lt;/p&gt;
&lt;h1 id="power-split"&gt;Power Split&lt;/h1&gt;
&lt;p&gt;The SASEBO-W is a multi-purpose board including a Xilinx LX150 Spartan 6 FPGA and a FTDI FT2232H USB interface. One use of the board is for measuring the power consumption of the FPGA and using that power consumption to perform power analysis attacks. I believe for this reason the ground planes are split, to facilitate making those measurements.
This split plane is joined through a common-mode choke. To use the high-speed USB interface it requires passing signals across a split in the plane – something very undesirable. The following figure shows what the ground currents for these signals would be. The signals are running on a 60 MHz clock if using the fastest available FT2232H mode.
&lt;img src="https://colinoflynn.com/oldsiteasd/tiki-download_file.php?fileId=71&amp;amp;display&amp;amp;x=600&amp;amp;y=655" alt="Image"&gt;
A measurement of the potential difference between the two planes (done at CN3) shows the following figure. This is due to the 60 MHz clock being driven from the FT2232H to the FPGA, there was no data being transferred in this image.
&lt;img src="https://colinoflynn.com/oldsiteasd/tiki-download_file.php?fileId=72&amp;amp;display" alt="Image"&gt;
Note that the FPGA I/O interface is 2.5V, meaning that signals being sent from the FPGA to the FT2232H will already have a reduced amplitude compared to the 3.3V I/O voltage. There should be enough headroom in practice such this interface works OK, and the FPGA has 3.3V tolerant I/Os.
The following figure shows a data bus line measured at the FT2232H in blue, the horizontal markers are set at 2.0V and 0.8V respectively, which are the limits for logic High/Low at the FT2232H. Note that due to this ground noise the signal is degraded to the point of crossing this threshold!
&lt;img src="https://colinoflynn.com/oldsiteasd/tiki-download_file.php?fileId=73&amp;amp;display" alt="Image"&gt;
If we mount a jumper on CN3 this shorts the two ground planes together. This isn’t an ideal low-impedance path, but it will make an improvement. In the above figure the yellow line is with this jumper mounted.
The following figure shows the voltage difference between the two planes with such a jumper mounted. Compare to the earlier figure where the peak-to-peak voltage was almost 500mV!
&lt;img src="https://colinoflynn.com/oldsiteasd/tiki-download_file.php?fileId=74&amp;amp;display" alt="Image"&gt;
Monitoring both the ground difference and bus lines show when the line switch there is still some extra noise contributed – the green line below (NB: note scale differs from above figure) shows a still fair amount of bounce during the transition, but in practice the USB communication seems reliable between the FT2232H and the FPGA.
&lt;img src="https://colinoflynn.com/oldsiteasd/tiki-download_file.php?fileId=75&amp;amp;display" alt="Image"&gt;
So, that&amp;rsquo;s why you cannot cross high-speed traces across split planes!&lt;/p&gt;</description></item><item><title>Making AT90USBKEY Run on 5V (Easy Way)</title><link>https://colinoflynn.com/2011/08/making-at90usbkey-run-on-5v-easy-way/</link><pubDate>Sat, 20 Aug 2011 14:01:00 +0000</pubDate><guid>https://colinoflynn.com/2011/08/making-at90usbkey-run-on-5v-easy-way/</guid><description>&lt;p&gt;I needed to use my AT90USBKEY at higher than 3.3V for ADC input purposes. It&amp;rsquo;s not documented in the manual, but the schematic shows they anticipated this. You can easily convert the AT90USBKEY to run on 5V with a few changes. The changes needed are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Remove resistor R20 (0-ohm resistor)&lt;/li&gt;
&lt;li&gt;Remove resistor R16 (0-ohm resistor)&lt;/li&gt;
&lt;li&gt;Place a 0-ohm resistor on pads at R21 (move R16 or R20)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That&amp;rsquo;s it! The DataFLASH chip&amp;rsquo;s VCC needs to be in the 2.5-3.6V range, but with those changes it is &lt;em&gt;still powered by the 3.3V regulator&lt;/em&gt;. Thus you don&amp;rsquo;t need to remove the DataFLASH chips. The DataFLASH devices have 5V tolerant I/O, so even though your MCU is running at 5V, it won&amp;rsquo;t fry the DataFLASH. Note the logic high levels of the DataFLASH may not be sufficient to actually work with the MCU, since it&amp;rsquo;s logic high will only be using 3.3V logic.&lt;/p&gt;</description></item></channel></rss>