Skip to content

Mouse poll rate cannot go over 500Hz on MacBook with Apple Silicon #1705

Description

@ViRb3

Operating System

MacOS 12.6/13.0, MacBook Pro 2021 M1 Max

Board

Raspberry Pi Pico, RP2040

Firmware

Modified from usb/device/dev_hid_composite

What happened ?

I am trying to simulate a mouse moving at 1000Hz poll rate with the Raspberry Pi Pico. With the default descriptors, I am getting a polling rate of 250Hz. I changed the polling interval from 5 to 1 and I got 1000Hz on my MacBook 2020 with Intel CPU, as well as my Windows laptop, but only 500Hz on my two MacBook 2021 with Apple CPU:

TUD_HID_DESCRIPTOR(ITF_NUM_HID, 0, HID_ITF_PROTOCOL_NONE, sizeof(desc_hid_report), EPNUM_HID, CFG_TUD_HID_EP_BUFSIZE, 5)

This leads me to believe that the problem is in the descriptors that TinyUSB uses by default. I verify the polling rate using this website:

With my gaming mouse, it reports 1000Hz. With my cheap mouse, it reports 100Hz. I was also able to simulate 1000Hz using CircuitPython by applying this patch:

CircuitPython code, 1000Hz:

import usb_hid

mouse = usb_hid.Device.MOUSE
mouse_move_report = bytearray(4)

mouse_move_report[1] = 1
mouse_move_report[2] = 1

while True:
    mouse.send_report(mouse_move_report)

TinyUSB code, 500Hz:

int main(void)
{
  board_init();
  tusb_init();

  while (1)
  {
    tud_task();
    // skip if hid is not ready yet
    if ( !tud_hid_ready() ) continue;
    tud_hid_mouse_report(REPORT_ID_MOUSE, 0, 1, 1, 0, 0);
  }

  return 0;
}

I figured this might be a configuration issue, so to the best of my abilities I cloned the following properties from CircuitPython:

  • HID Report Descriptor
  • USB Device Descriptor
  • Removed horizontal scroll from report (maybe extra size slows it down?)

Sadly, none of this changes anything. Here are my sources from CircuitPython:

Thanks!

How to reproduce ?

int main(void)
{
  board_init();
  tusb_init();

  while (1)
  {
    tud_task();
    // skip if hid is not ready yet
    if ( !tud_hid_ready() ) continue;
    tud_hid_mouse_report(REPORT_ID_MOUSE, 0, 1, 1, 0, 0);
  }

  return 0;
}

Test in:

Debug Log as txt file

No response

Screenshots

No response

I have checked existing issues, dicussion and documentation

  • I confirm I have checked existing issues, dicussion and documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions