Problem with: USB Joystick Data acquisition using Scope (Rigol DS1052E) - Page 1
Forum section: electronics / beginners

author: bravoelf
author_rank: Contributor
timestamp: November 01, 2014, 12:58:09 pm
content: Hello Everyone,Ok, so this is my brief description of my problem.Recently I wanted to make some measurements with my scope. )))The potential victim was found pretty quickly: it was a Jetion PC Game joystick.The initial purpose was to trace usb data that joystick sends to a PC when some of its buttons are pushed. Just wanted to see the pulses of a data signal on my scope.(Yep, I'm a curious EE student)To turn the dream into reality, I used the following items: USB Female connector(plugged to the breadboard), 5 DC power supply , the joystick itself, couple of wires and finally, a Scope.My connection scheme was pretty simple: A joystick was plugged in to female connector and so a 5 was connected to it .When I done with all the wiring, a LED on my joystick turned on, so it was in a working state.Then I tried to measure the voltages on D+/D- pins while pressing a buttons. Guess what? It didn't work. At all...Furthermore, I teared down this joystick in order to "get closer" to its controller, but was very disappointed when, the only thing I found there was one big black blob(the one, that are used often to cover chip on board).So, my biggest questions are:What did I do wrong?orIs it a joystick that actually dead?orIs it my dumb head?orIs there something else I should take into account in order to get the things work for me?orIs it possible at all to trace/acquire/measure usb data signals using a scope?Of course, any provided help(explanations/links for additional info and etc) will be highly appreciated.Thanks a lot in advance,Ivan.

author: miguelvp
author_rank: Super Contributor
timestamp: November 01, 2014, 01:53:07 pm
content: you need something to initialize the usb communication like your PC otherwise the USB slave (the joystick) is just going to just sit there doing nothing.Then on probing be careful, do not probe with your ground to the signals at all, meaning do NOT connect the ground to D+ or D- because D- is not ground.Also if you probe just D+ with ground, your probe ground clip will pick up a lot of noise so you have to use a short ground wire(like the spring ground wires that came with your probes and measure with the ground wire to negative power rail but before doing that make sure there is no voltage difference between the scope ground and the negative power of the USB connector with a digital multimeter, or with the scope using the probe on the negative usb rail without the ground clip because then it will probe with respect to the scope ground). Best way will be to remove both ground clips from both probes and use two probes to measure the signals using the math function on your scope.I hope this makes sense.

author: bravoelf
author_rank: Contributor
timestamp: November 01, 2014, 02:16:35 pm
content: A lot of sense. Thanks.I also understand that I'll need to google some usb modulation materials.Any good links, will be appreciated.

author: miguelvp
author_rank: Super Contributor
timestamp: November 01, 2014, 02:41:32 pm
content: I prepared some images for you.Here is the Setup:First probe just the ground (the scope will provide the scope ground) Then make sure the scope still shows 0 volts, this ensures the USB ground is at the same voltage as your scope ground.Of course you can do this with a DMM instead between the ground test hook and the USB ground:If there is a voltage difference, then the only way to probe will be using two probes without grounds and using the math function:If the ground is common then you can probe the data line directly with a ground wire so you don't introduce noise to the signal, for example this will measure D- (green wire):Also if the ground is common with the scope you can probe both signals using short ground wires, for example this will probe both D+ (white wire) and D- (green wire):

author: bravoelf
author_rank: Contributor
timestamp: November 01, 2014, 04:47:15 pm
content: OMG!!! You Awesome!Thanks a lot.Now, I'll talk about what I've done till this moment.1) Laptop USB ground vs Scope Ground --- checked with DMM, it's all fine, no voltage there.2) Measured D+ wire (probe to green and usb gnd to laptop gnd) --- I get a noisy picture of pulses with different amplitudes ( 3.3v and 3.6v)It looks something like that:-------------------------------| | | | | | | | | -----------------| | | | | | | | | | | | | | | | | | | | | | | | || | | | | | | | | | | | | | | | | | | | | | | | |Just to get you a general idea.Pushing the buttons makes no change to this picture. I'm pretty shure that I need to make more googling in order to get more informed about how USB's data transfer works. It is some sort of modulated signal.3) Tried a Math function (with A-B option) --- here I don't understand exactly what I'm doing. What will the difference between D+ and D- give me?Again, Thank you for the answers and your time.Ivan.

author: miguelvp
author_rank: Super Contributor
timestamp: November 01, 2014, 05:40:47 pm
content: First things first,Does the laptop sees the joystick? and in the control panel if you look at the properties of the stick can you see it update the positions?You want to establish first that the stick is working and you have a way to see feedback on the laptop.Edit: as for 3) yes, it will give you the difference in purple I think of D+ and D- if you use A-B and A is on the white wire and B on the green one

author: bravoelf
author_rank: Contributor
timestamp: November 01, 2014, 06:02:20 pm
content: I din't actually checked if my laptop sees the joystick or not (my mistake). One thing for sure, it does nothing when I plug the joystick in. -- Will check this.Second thing (and much more annoying) is that I can't get a more-less stable picture on my scope.. It "dances" all around. I mean it looks like trigger problem.I tried to play with different options in order to get it stable but with no luck.Furthermore, I tried to measure the working frequency(System Clock) on msp430 board (wrote a code for it a time ago), and as I can remember, I got nice and stable picture of the pulses onlab's scopes, but nor I do here.Think the best way for me is to take a scope to the institute and show it to Labs Engineer, I hope he will help me to solve the problem.I'll reply here, when it's done.Again thank you.Ivan.

author: miguelvp
author_rank: Super Contributor
timestamp: November 01, 2014, 06:41:37 pm
content: Just be careful, I just fried an old web cam by probing directly on the camera board and I guess my spring ground dislodged and touch something that it shouldn't have. You should be fine on the prototype board, less chances for a screw up.But until then it was probing fine with this trigger settings.Pretty much you want to trigger after a positive edge pulse is greater than 6 micro seconds then you will see the beginning of the packet. I was probing D+ for D- you want the pulse "When" to be when the negative edge pulse is greater than 6us.You can adjust the pulse trigger point if the packets in yours is less than 6 us apartAlso note the time scale, I have it set to 500ns that shows the signal with some detail.Volts per division I have it set to 1V

author: miguelvp
author_rank: Super Contributor
timestamp: November 01, 2014, 07:20:22 pm
content: As for what you are going to see once you have it all setup and you press a button is that the series of ones and zeros is different for that one packet.The USB signal should look like this:The 1st channel (Yellow) shows D+ and the other one D-More info on how it's encoded:http://en.wikipedia.org/wiki/USB#Signaling

author: bravoelf
author_rank: Contributor
timestamp: November 01, 2014, 08:53:42 pm
content: OK, I've done some RTFMand finally got those waves stable. It was difficult because of complexity of pulses. It's not just some simple CLK squarewave.Another issue, regard to "no ground" or floating measurement.Here I'm getting totally frustrated.The reason for this is that, when I'm trying to measure my msp430 System CLK(about 8kHz), with just two probes(probe A connected to CLK board output pin and probe B to the board's ground), I push AUTO button and my scope just displays me some sinusoidal waves instead (at f=50Hz) and applies those MATH things (A-B) on them.No CLK squarewave is displayed. It is kinda weird to me... Maybe it has no support for this sort of measurements?In addition, When the measurement is taken directly (I mean the canonical way with the ground) I get a little spark when connecting my scope ground to msp430 one. But there weren't any voltage differences as I mentioned before. So why do I get them?In case you need some photos I'll can make some.Sincerely,Ivan.

author: miguelvp
author_rank: Super Contributor
timestamp: November 01, 2014, 09:17:10 pm
content: The 50 Hz is probably your mains noise that is all around and any piece of wire is going to act like an antenna and picking that noise up. That's why you want to use a short ground wire.The no ground floating measurement is up to the speed of your scope to do the math function. The noise from the mains (I will think you are not in the US because of the 50Hz) might be picked up by the wire you are trying to measure. Being careful you can probe on at the pins instead to avoid that noise. But being careful because it's easy to short thing out if careless.And sparks are not good, not sure why you are getting them but that means there is a voltage difference. try with just one probe to measure what you think it's ground after you put a trigger and have it in single shot capture. Edit (after changing your time base to something other than the 500ns per division you were using for the USB, 1ms will do for the single shot)BTW back to the original thing, here are two captures, first one D+ with the settings posted above.The other D- with the settings in the picture (not from the same pulse)