I noticed that when closing the serial connection (Serial.End()) and then reopening it, it is no longer opened. Because I found errors in Adafruit_USBD_CDC.cpp, in the function "91: void Adafruit_USBD_CDC::end(void)" the variable "_instance" is not set to INVALID_INSTANCE; deferred, it remains when it is reopened. (line 74) set.
70: void Adafruit_USBD_CDC::begin(uint32_t baud) {
71: (void) baud;
72:
73: // already called begin()
74: if (isValid()) {
75: returns;
76: }
I changed the code so that the variable "_instance" is set to INVALID_INSTANCE, then it worked.
93: void Adafruit_USBD_CDC::end(void) {
94: // Reset configuration descriptor without Serial as CDC
95: TinyUSBDevice.clearConfiguration();
96 _instance_count = 0;
97: _instance = INVALID_INSTANCE;
98: }
Operating System
Windows 10
IDE version
Arduino
Board
Raspbery Pi Pico
BSP version
Raspbery Pi Pico
TinyUSB Library version
latest
Sketch
What happened ?
I noticed that when closing the serial connection (Serial.End()) and then reopening it, it is no longer opened. Because I found errors in Adafruit_USBD_CDC.cpp, in the function "91: void Adafruit_USBD_CDC::end(void)" the variable "_instance" is not set to INVALID_INSTANCE; deferred, it remains when it is reopened. (line 74) set.
Thank you Erhard Kaserer
How to reproduce ?
.
Debug Log
No response
Screenshots
No response