RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    Retropie: how frequently a USB joystick is polled? Developing new encoder

    Scheduled Pinned Locked Moved Ideas and Development
    usb controlers
    5 Posts 2 Posters 378 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      robca
      last edited by

      I just started writing a usb joystick/spinner encoder using a Blue Pill STM32 board. The board will present itself to the system as a composite USB device, with a joystick and a mouse profile. The joystick profile will take care of scanning the joystick and buttons, and the mouse profile will send position changes based on an optical encoder output.

      I'm trying to figure out what's the ideal cycle to send USB updates to the system. With an oscilloscope I looked at the debouncing requirements for the switches, and I saw that good Happ style buttons with a decent microswitch only bounce for 2-3 msec, while cheap, crappy Sanwa style buttons sold as kits from China can easily have bounces for 50+ msec (yeas, I was really surprised by how bad those were).

      So the longer I can debounce, the better, but I also want to introduce minimal delay. I know that the commonly available DragonRise zero delay usb encoder says "zero delay", but I'm assuming it will still send data via USB at a max data rate. Ideally I'd like to get to the same level of short latency and high data rate.

      Does anyone know what data rates are common for USB joysticks and various retroarch cores?

      1 Reply Last reply Reply Quote 0
      • mituM
        mitu Global Moderator
        last edited by

        (not an expert on these things) This wiki page might be useful to understand how the polling works for mice and how you can measure the device speed (via evhz). The page talks how the mouse polling rate can be tuned, via themousepoll module parameter, and a similar parameter exists for joypads - jspoll - , so some of the methods used to tune/measure could apply to joysticks also.

        1 Reply Last reply Reply Quote 0
        • R
          robca
          last edited by

          Thanks! I did a lot of searches, but didn't think about looking for "polling", which seems to be the keyword for searches related to my issue.

          I'll look into this some more and see if I find anything worth sharing.

          1 Reply Last reply Reply Quote 0
          • R
            robca
            last edited by

            I just confirmed that evhz https://gitlab.com/iankelling/evhz also shows polling rates for joystick, no just mouse and keyboard. And, as expected, the RPi4 in default configuration is polling every 8msec, i.e. 125Hz.

            That gives me a good starting point to shoot for (pun intended)

            1 Reply Last reply Reply Quote 1
            • R
              robca
              last edited by

              Actually it turns out that evhz gets seriously confused with a HID composite device mouse+joystick sending data at high rates. sometimes I read actual values, sometimes very slow updates

              I can find many mouse rate tester apps, but nothing for USB joysticks. Does anyone know of a utility for joysticks similar to mouserate?

              1 Reply Last reply Reply Quote 0
              • First post
                Last post

              Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

              Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.