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

Thread: Pool Teensy at 1kHz via USB

  1. #1
    Junior Member
    Join Date
    May 2017
    Posts
    13

    Pool Teensy at 1kHz via USB

    Hi, there are some mice that can be pooled at 1000Hz. While I do not need such a mouse, I wonder if Teensy could be pooled at such a high frequency? It would make it great for certain real time applications.

  2. #2
    Junior Member
    Join Date
    May 2017
    Posts
    13
    Hi again I have read https://www.pjrc.com/teensy/td_serial.html it seems 1ms may actually be achievable for serial transfers.

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    15,115
    The Teensy default in usb_desc.h already is an interval of 1ms.

    Code:
      #define MOUSE_INTERFACE       1       // Mouse
      #define MOUSE_ENDPOINT        5
      #define MOUSE_SIZE            8
      #define MOUSE_INTERVAL        1
    Of course it's up to the driver on your PC to actually configure the USB host side to actually implement this speed. From the device side, all Teensy (or any other device) can do is request the interval.

    I recall seeing some info, many years ago, that Windows sometimes uses slower polling. Honestly, I've never really bothered to actually test this... but it would be fairly easy to do by just sending a lot of small movement changes and timing how long it takes.

  4. #4
    Junior Member
    Join Date
    May 2017
    Posts
    13
    Is this ~1kHz pooling achievable also on Teensy LC?

  5. #5
    Senior Member defragster's Avatar
    Join Date
    Feb 2015
    Posts
    4,655
    Assuming the T_LC USB hardware support is similar on the M0+ chip - I'd expect it might work.

    How would it be tested? Perhaps manually put the mouse on a screen point - Have the Teensy issue 100 (?) right moves and 100 (?) down moves and mark where it ends when using various decreasing delays between the move commands? See how fast the delay can be before moves are lost? Do it with buttonDown in paint and draw a line? Intermix the right and down? Will that trigger mouse acceleration?

    Use delayMicroseconds() or elapsedMicroseconds() with waits 1500 down to 1000?

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    15,115
    Quote Originally Posted by monkey View Post
    Is this ~1kHz pooling achievable also on Teensy LC?
    Yes. Teensy LC has the same USB hardware and code as Teensy 3.x.

    But the CPU isn't nearly as fast, so you need to be more careful to design your code to keep up.

Posting Permissions

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