arduino / arduino/ArduinoCore-samd

SAMD21 USBDeviceClass::ISRHandler() called continuously.

Open
#575 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
502
Forks
740
PR merge metrics
No merged PRs in 30d

Description

Running the MIDIUSB library on MKR1000, I discovered with a debug statement in USBDeviceClass::ISRHandler() within USBCore.cpp, the handler is called continuously.

Specifically, adding Serial1.println("Handler Called"); to the first line of ISRHandler() exposed the problem.

I did not look deeper to find the specific flag in DEVICE.INTFLAG causing the problem, and whether or not that flag is required for enumeration. However, executing this statement after enumeration seems to solve the problem.
USB->DEVICE.INTENCLR.reg = 0xFF;

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in USBCore.cpp at USBDeviceClass::ISRHandler() and reproduce the behavior with the MIDIUSB library on an MKR1000. Inspect DEVICE.INTFLAG and the effect of USB->DEVICE.INTENCLR.reg = 0xFF; done means the handler no longer runs continuously after enumeration without breaking USB enumeration.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.