-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Closed
Labels
Area: LibrariesIssue is related to Library support.Issue is related to Library support.Type: For referenceCommon questions & problemsCommon questions & problemsType: QuestionOnly questionOnly question
Description
Board
ESP32 S3
Device Description
ESP32 S3 dev kit
Hardware Configuration
None
Version
latest stable Release (if not listed below)
IDE Name
Arduino
Operating System
Win 11
Flash frequency
a lot
PSRAM enabled
yes
Upload speed
a lot too
Description
The USBHID.cpp code implements an tud_hid_report_complete_cb
from which a non safe xSemaphoreGive
is beeing called, see.
Since tud_hid_report_complete_cb
is an ISR, its advisable to use xSemaphoreGiveFromISR
instead, e.g.
void tud_hid_report_complete_cb(uint8_t instance, uint8_t const* report, tud_hid_report_complete_cb_len_t len) {
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
if (tinyusb_hid_device_input_sem) {
xSemaphoreGiveFromISR(tinyusb_hid_device_input_sem, &xHigherPriorityTaskWoken);
if (xHigherPriorityTaskWoken) {
portYIELD_FROM_ISR();
}
}
}
BR
Chris
Sketch
See above
Debug Message
Sometimes I receive TUSB:error messages. Now trying to find possible reasons. This might be one.
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide
- I confirm I have checked existing issues, online documentation and Troubleshooting guide.To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
Metadata
Metadata
Assignees
Labels
Area: LibrariesIssue is related to Library support.Issue is related to Library support.Type: For referenceCommon questions & problemsCommon questions & problemsType: QuestionOnly questionOnly question
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
SuGlider commentedon Jun 2, 2025
@ChrGri @lucasssvaz - This is not called from an ISR.
tud_hid_report_complete_cb()
is called from a Task started withintud_task()
(whenUSB.begin()
is called)TinyUSB uses ISR to create events in a queue. The events are processed from a FreeRTOS Task, therefore, there should be no such issue with
xSemaphoreGiveFromISR
I have tracked down
tud_hid_report_complete_cb()
in the TinyUSB and Arduino source code.Please let me know if you disagree and the reason for it.
ChrGri commentedon Jun 6, 2025
@SuGlider Thank you very much for this investigation. If you are certain, that this is not a problem, feel free to close the issue.
BR
Christopher