@@ -39,8 +39,9 @@ static intr_handle_t intr_handle = NULL;
39
39
static SemaphoreHandle_t tx_lock = NULL ;
40
40
static volatile bool connected = false ;
41
41
42
- static volatile unsigned long lastSOF_ms;
43
- static volatile uint8_t SOF_TIMEOUT;
42
+ // SOF in ISR causes problems for uploading firmware
43
+ // static volatile unsigned long lastSOF_ms;
44
+ // static volatile uint8_t SOF_TIMEOUT;
44
45
45
46
// timeout has no effect when USB CDC is unplugged
46
47
static uint32_t tx_timeout_ms = 100 ;
@@ -147,7 +148,8 @@ static void hw_cdc_isr_handler(void *arg) {
147
148
148
149
inline bool HWCDC::isPlugged (void ) {
149
150
// SOF ISR is causing esptool to be unable to upload firmware to the board
150
- return true ;// (lastSOF_ms + SOF_TIMEOUT) >= millis();
151
+ // Timer test for SOF seems to work when uploading firmware
152
+ return usb_serial_jtag_is_connected ();// (lastSOF_ms + SOF_TIMEOUT) >= millis();
151
153
}
152
154
153
155
bool HWCDC::isCDC_Connected () {
@@ -157,11 +159,13 @@ bool HWCDC::isCDC_Connected() {
157
159
if (!isPlugged ()) {
158
160
connected = false ;
159
161
running = false ;
160
- SOF_TIMEOUT = 5 ; // SOF timeout when unplugged
162
+ // SOF in ISR causes problems for uploading firmware
163
+ // SOF_TIMEOUT = 5; // SOF timeout when unplugged
161
164
return false ;
162
- } else {
163
- SOF_TIMEOUT = 50 ; // SOF timeout when plugged
164
- }
165
+ }
166
+ // else {
167
+ // SOF_TIMEOUT = 50; // SOF timeout when plugged
168
+ // }
165
169
166
170
if (connected) {
167
171
running = false ;
@@ -249,8 +253,9 @@ static void ARDUINO_ISR_ATTR cdc0_write_char(char c) {
249
253
HWCDC::HWCDC () {
250
254
perimanSetBusDeinit (ESP32_BUS_TYPE_USB_DM, HWCDC::deinit);
251
255
perimanSetBusDeinit (ESP32_BUS_TYPE_USB_DP, HWCDC::deinit);
252
- lastSOF_ms = 0 ;
253
- SOF_TIMEOUT = 5 ;
256
+ // SOF in ISR causes problems for uploading firmware
257
+ // lastSOF_ms = 0;
258
+ // SOF_TIMEOUT = 5;
254
259
}
255
260
256
261
HWCDC::~HWCDC () {
0 commit comments