Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 6 of 6

Thread: teensy 2 joystick stopped working

  1. #1

    teensy 2 joystick stopped working

    i had a basic joystick sketch working but now the device is not seen at all by windows. the gamepad configuration utility identifies the teensy joystick but shows nothing on the test page. previously this did work. is there some procedure for uninstalling drivers that might be corrupted or anything else i should try? also does not work with my programs that access a joystick which did work a short while ago.

    while i am asking, i am also have serious jitter in the analog read. i am analog reading a voltage output by a hall effect sensor. it is rock steady measured on a multimeter or oscope but the voltage is jumping all over the place as shown by a serial print of the analog read value. when the joystick was working and using this analog read value to send a joystick value it also jittered (or course, it was using the same value) i read somewhere a hint at some input smoothing in one of the examples or somewhere else but can not find it now. before writing my own smoothing i would like to try something ready made if i can find it. preferably the jitter problem can be solved so this is not necessary. i have tried an external reference using a 3 volt lithium battery and this does not seem to help. in the arduino code i specified analogReference(EXTERNAL); and connected the 3 volt reference to the ref in pin. anything wrong with this?

    any other ideas on the joystick problem or the analog read jitter?

  2. #2
    i tried the teensy on another computer as a usb joystick and it works fine. this is an xp computer that has never seen the teensy before. it found it and installed drivers and worked immediately. what could have happened to my computer on which it stopped working? how an i remove all relevant drivers and start over?

  3. #3
    2012-12-xx:

    We had this same joystick-not-detected-properly problem. Worked on machine A (Windows 7) just fine. Then after some changes to the joystick code (ie: in the arduino environment) on machine B, when later plugged into machine A, in the joy.cpl control panel (what spencoid describes as the gamepad config util), teensy was recognized only as a generic joystick with no test panel. But plug the Teensy into machine C, that had never seen it before, and presto, it works fine.

    Here's what we did to fix it on Machine A.

    Like spencoid we thought that we should tell Windows on machine A to forget its stored USB registration info. We used a program called USBDeview (google it; free) to do the job. Probably this info is in the registry and could be edited using regedit, but USBDeview made things easy.

    With Teensy unplugged....

    To make changes to the registered USB device info, you have to launch USBDeview as admin (right-click > Run as admin). View the list of USB items. The important columns are Description, Device Type, Vendor Id and Product Id. (You can sort on Vendor Id and Product Id to make the next steps easier). You are looking for items with VendorId = 16c0 and ProductId = 0482. Right-click > Uninstall. The items should disappear from the list. (For reference, www.linux-usb.org/usb.ids shows a list of vendor/device Ids.)

    OK, now when you plug Teensy back in, Windows will attempt to install a device driver. At this point we're not sure the exact sequence of what happens, and we actually went through the plug-unplug ritual twice. One time through, we allowed Windows to search the net for drivers (not sure why it wanted to) and the other time not. At any rate, after not much fiddling, (and it might just have been to let the new setting percolate through, perhaps a logout/login would have done the trick), the Teensy showed up in joy.cpl as Teensy Keyboard+Mouse+Joystick, with a test panel. and all worked fine.

    Hope that helps. My feeling is that this should all "just work", but apparently there are changes you can make to the arduino code that confuse Windows if Windows thinks that this is the same device it saw previously.

    -- Update 2013-03-09 --
    It turns out that we had not solved the problem as decisively as I thought. At some point after the above notes, we rebooted the above Machine A, and it again went through the process of attempting to load drivers keyboard, mouse, joystick, which during the process the dialog displays as Teensy drivers, but then almost immediately change to show as Microsoft drivers. Running joy.cpl shows Teensy keyboard/mouse/joystick on the Game Controllers list, but then Properties shows no control panel.

    We tried deleting ALL the mouse, keyboard, joystick or HID devices using USBDeview, on the basis that maybe some other driver was somehow pre-empting Teensy's. After reconnecting the Teensy, we got the same result as just described. So, overall, no solution. Machine A just seems incapable of accepting Teensy as a kbd/mouse/joystick device, though it's almost certain this is just some silly driver configuration problem. Frustrating!

    -- Graham
    Last edited by gwideman; 03-10-2013 at 04:33 AM. Reason: Updated info

  4. #4
    @spencoid: Regarding the jitter: Here are some notes that may help.

    First, with 10k pot hooked up to +5V and Gnd, with the wiper connected to a Teensy analog input, we saw only a tiny amount of jitter, or no jitter when watching the analog values in joy.cpl. There will inevitably be some jitter, as an analog voltage may be right on the boundary between two A-to-D quantization values, and the A-D converter may well vacillate between them.

    That said, the joy.cpl program can alarm you by showing what appears to be very large jitter of say 25% of full scale. This happens because the display shows the value after it's been scaled according to the endpoints that it has been shown in the calibration process. If you've not run the joy.cal's cal process (or can't because you can't manually sweep the sensors over their range), the joy.cpl sometimes/often starts by assuming it needs to maximally amplify the input signal. So, if you happen to have an input signal that is in the mid voltage range, and is jittering a little, that will appear to be giant jitter.

    You would encounter a similar effect if your input sensor delivers only a limited range of voltages, and to compensate you have the arduino code multiply by a large factor. But assuming that's not the problem...

    In your case, you say you actually had the arduino send the A-D values via serial to your arduino "terminal", and these showed large amount of jitter. And this appeared to contradict what you could see on a scope (looking with a meter is probably not useful for seeing jitter unless it's very slow).

    So you probably would need to experiment a little more to determine whether there's something mysteriously affecting the input signal, only when read by Teensy, or is there something mysterious internal to the Teensy that's causing erratic measurement. You already explored changing the reference voltage, but I'd bet it's not that, since we get good results with the built-in reference.

    I'd strongly recommend temporarily replacing your Hall effect sensor with a 10k pot with endpoints connected to +5V and ground. If that input results in stable values delivered downstream to the PC (via serial or joystick channels) then this strongly suggests the issue is in the hall effect apparatus. (And if this doesn't deliver stable values... then I'm out of ideas!)

    If the pot delivers stable numbers, it's time to look at what may be going wrong with the hall-effect sensor. Without any details, among the problems to consider are:

    -- Does the hall effect sensor share a ground with some other external apparatus. This could result in a ground loop, with 60 Hz noise ending up at the input. This is is a known problem with trying to do A-D within a USB-connected device.

    -- Is the hall-effect sensor sitting in a fluctuating magnetic field. (Eg: near a power transformer, motor, or a wall wart?).

    -- Does the hall effect sensor have a reasonably low output impedance (say less than 1k ohm), sufficient to avoid picking up "AC hum".

    Note that some of these input problems can be affected, made better or worse, just be connecting test gear such as the oscilloscope.

    Hope this is of some help.

    -- Graham

  5. #5
    thanks for all the suggestions re the jitter problem. at this point, i forget all i might have tried but using the teensy 2 with external power to the hall effect sensor and an external voltage (shunt type) reference worked very well. 5 volts is at the low end of the recommended power supply voltage for the hall effect sensor and my guess is that the usb voltage is not stable enough? anyway, the problem is solved and the teensy works perfectly for this project as long as i use an external v ref and external power to the sensor. and, yes, a pot connected to the analog input of the teensy was completely stable. the only jitter i get now seems to be due to rounding about the measurement point.

  6. #6
    More on the joystick displaying blank in joy.cpl here: http://forum.pjrc.com/threads/23566-...0911#post30911

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •