[HWCDC] Fix bootloop on ESP32-C3/C6

This commit is contained in:
TD-er
2024-04-05 10:04:58 +02:00
parent 2c9d2ca5c7
commit bd03a44e27
3 changed files with 28 additions and 32 deletions
@@ -58,40 +58,46 @@ Port_ESPEasySerial_USB_HWCDC_t::Port_ESPEasySerial_USB_HWCDC_t(const ESPEasySeri
// USB.begin();
if (_hwcdc_serial != nullptr) {
_config.rxBuffSize = _hwcdc_serial->setRxBufferSize(_config.rxBuffSize);
_config.txBuffSize = _hwcdc_serial->setRxBufferSize(_config.txBuffSize);
// _hwcdc_serial->end();
// _config.rxBuffSize = _hwcdc_serial->setRxBufferSize(_config.rxBuffSize);
// _config.txBuffSize = _hwcdc_serial->setTxBufferSize(_config.txBuffSize);
// See: https://github.com/espressif/arduino-esp32/issues/9043
_hwcdc_serial->setTxTimeoutMs(0); // sets no timeout when trying to write to USB HW CDC
// _hwcdc_serial->setTxTimeoutMs(0); // sets no timeout when trying to write to USB HW CDC
_hwcdc_serial->begin();
// _hwcdc_serial->begin();
// _hwcdc_serial->onEvent(hwcdcEventCallback);
}
}
Port_ESPEasySerial_USB_HWCDC_t::~Port_ESPEasySerial_USB_HWCDC_t() {}
Port_ESPEasySerial_USB_HWCDC_t::~Port_ESPEasySerial_USB_HWCDC_t() {
if (_hwcdc_serial != nullptr) {
// _hwcdc_serial->end();
}
}
void Port_ESPEasySerial_USB_HWCDC_t::begin(unsigned long baud)
{
_config.baud = baud;
/*
if (_hwcdc_serial != nullptr) {
_config.rxBuffSize = _hwcdc_serial->setRxBufferSize(_config.rxBuffSize);
_config.txBuffSize = _hwcdc_serial->setRxBufferSize(_config.txBuffSize);
_hwcdc_serial->begin();
delay(10);
_hwcdc_serial->onEvent(hwcdcEventCallback);
delay(1);
}
*/
if (_hwcdc_serial != nullptr) {
_config.rxBuffSize = _hwcdc_serial->setRxBufferSize(_config.rxBuffSize);
_config.txBuffSize = _hwcdc_serial->setTxBufferSize(_config.txBuffSize);
_hwcdc_serial->begin();
delay(10);
// _hwcdc_serial->onEvent(hwcdcEventCallback);
delay(1);
}
}
void Port_ESPEasySerial_USB_HWCDC_t::end() {
// Disabled for now
// See: https://github.com/espressif/arduino-esp32/issues/8224
if (_hwcdc_serial != nullptr) {
_hwcdc_serial->end();
// _hwcdc_serial->end();
}
}
@@ -204,5 +210,4 @@ bool Port_ESPEasySerial_USB_HWCDC_t::setRS485Mode(int8_t rtsPin, bool enableColl
return false;
}
#endif // if USES_HWCDC
@@ -13,7 +13,7 @@
class Port_ESPEasySerial_USB_HWCDC_t : public Port_ESPEasySerial_base {
public:
Port_ESPEasySerial_USB_HWCDC_t(const ESPEasySerialConfig& config);
explicit Port_ESPEasySerial_USB_HWCDC_t(const ESPEasySerialConfig& config);
virtual ~Port_ESPEasySerial_USB_HWCDC_t();
@@ -44,11 +44,7 @@ public:
private:
# if ARDUINO_USB_CDC_ON_BOOT // Serial used for USB CDC
HWCDC *_hwcdc_serial = &Serial;
# else // if ARDUINO_USB_CDC_ON_BOOT
HWCDC *_hwcdc_serial = &USBSerial;
# endif // if ARDUINO_USB_CDC_ON_BOOT
HWCDC *_hwcdc_serial= nullptr;
};
+4 -9
View File
@@ -208,19 +208,14 @@ lib_ignore =
; ESP_IDF 5.1
[core_esp32_IDF5_1__3_0_0]
;platform = https://github.com/Jason2866/platform-espressif32.git
platform = https://github.com/tasmota/platform-espressif32/releases/download/2024.02.10/platform-espressif32.zip
;platform = https://github.com/tasmota/platform-espressif32/releases/download/2024.01.12/platform-espressif32.zip
;platform = https://github.com/tasmota/platform-espressif32/releases/download/2024.02.10/platform-espressif32.zip
;platform_packages =
platform_packages = framework-arduinoespressif32 @ https://github.com/Jason2866/esp32-arduino-lib-builder/releases/download/2036/framework-arduinoespressif32-release_v5.1-246cad0.zip
;platform_packages = framework-arduinoespressif32 @ https://github.com/Jason2866/esp32-arduino-lib-builder/releases/download/2109/framework-arduinoespressif32-release_v5.1-a28d368.zip
;platform_packages = framework-arduinoespressif32 @ https://github.com/Jason2866/esp32-arduino-lib-builder/releases/download/2119/framework-arduinoespressif32-release_v5.1-a28d368.zip
; JL1101 support, ESP32-C6 not working
;platform_packages = framework-arduinoespressif32 @ https://github.com/Jason2866/esp32-arduino-lib-builder/releases/download/2151/framework-arduinoespressif32-release_v5.1-1a0b6e0.zip
;platform_packages = framework-arduinoespressif32 @ https://github.com/Jason2866/esp32-arduino-lib-builder/releases/download/2180/framework-arduinoespressif32-all-release_v5.1-735d740.zip
;platform_packages = framework-arduinoespressif32 @ https://github.com/Jason2866/esp32-arduino-lib-builder/releases/download/2189/framework-arduinoespressif32-all-release_v5.1-be1a568.zip
; Build with HWCDC fix.
platform = https://github.com/Jason2866/platform-espressif32.git
platform_packages = framework-arduinoespressif32 @ https://github.com/Jason2866/esp32-arduino-lib-builder/releases/download/2221/framework-arduinoespressif32-all-release_v5.1-ec01775.zip
build_flags = -DESP32_STAGE
-DESP_IDF_VERSION_MAJOR=5
-DLIBRARIES_NO_LOG=1