Description
Operating System
Windows 10
Arduino IDE version
Arduino IDE 2.3.5
Board
Adafruit Feather RP2040 USB A
ArduinoCore version
4.5.4
TinyUSB Library version
3.4.4
Sketch as ATTACHED TXT
Compiled Log as ATTACHED TXT
What happened ?
**BACKSTORY: **
I used to have a issue where the mouse sensitivity would drop every 5-10 minutes and it would recover after 5 seconds. I opened an issue regarding that here: https://forums.adafruit.com/viewtopic.php?t=218638. I changed some of the code so core1's loop would run without any delay and added an additional call to tud_hid_set_idle_cb(0,50) in the case that windows was thinking the mouse was sleeping.
IDE SETTINGS:
ISSUE:
Now my issue is different, after a random amount of time (sometimes 20 minutes, sometimes 1 hour) the mouse just crashes and loses all power. After a reset it works again but this is not ideal.
Possible Problems:
Due to me not wanting to use the serial port, I've tried disabling it by setting the CFG_TUD_CDC to 0, this has led to compiler errors I couldn't be asked with so I instead edited the USBD_CDC file directly:
void Adafruit_USBD_CDC::begin(uint32_t baud) {
return;
}
This perfectly stops the serial port but might cause some weird behavior.
Another possible cause is the adafruit board itself and its core1 component just not being made well to nonstop poll at 1k hz. Maybe the core is overheating and leading to undefined behavior. A similar sketch with the usb host shield + arduino leonardo leads to no such issues.
What I'm sure is NOT causing it:
The Report Descriptor Parser I'm using to allow the board to work with all mice has been very reliable and causes no issues regarding crashing
The Custom Mouse Descriptor which is 16 bit x and y instead of the default 8 was not crashing before also.
All mices tested work perfectly when directly plugged into the pc
This is not a local issue as I've tested on multiple pc's with the same firmware.
How to reproduce ?
- Go to https://github.com/touchgadget/pt_mouse
- Configure so the report packet format matches your mouse
- Use the mouse for a while and expect either a slowing down of sensitivity or a full crash
Debug Log
Due to the random nature of the problem debugging it is very time consuming and not plausible. I did find out that the sensitivity issue would appear as polling rate drop from 950 avg to a brief 600-700 hz average and recover after 5 seconds. Any suggestion on how this should be debugged is welcome.