i currently experiment with the ESP32-C3.
one main focus is to use the internal USB CDC for upload and serial connection.
i just updated to Arduino ESP32 version 2.0.1
and as of the 20.01 RC1 release i do not get the USB CDC thing to work properly..
it says
so there were some changes.Improvements:
* Improved USB-CDC support for both ESP32-S2 and ESP32-C3
So maybe i just don*t know how to use / who it should work...
I tried the following:
my test sketch
Code: Select all
// ESP32-C3 Serial & CDC test
const uint8_t led_info_pin = 1;
void setup() {
pinMode(led_info_pin, OUTPUT);
digitalWrite(led_info_pin, HIGH);
digitalWrite(led_info_pin, LOW);
// initialise serial
// wait for arduino IDE to release all serial ports after upload.
delay(1000);
// initialise serial
Serial.begin(115200);
digitalWrite(led_info_pin, HIGH);
delay(500);
digitalWrite(led_info_pin, LOW);
// Wait for Serial Connection to be Opend from Host
// or timeout after 5second
uint32_t timeStamp_Start = millis();
while( (! Serial) && ( (millis() - timeStamp_Start) < 5000 ) ) {
// nothing to do
delay(1);
}
digitalWrite(led_info_pin, HIGH);
// print some general sketch info..
Serial.println();
Serial.println();
Serial.println(F("serial_test_minimal.ino"));
Serial.print(F("upload: "));
Serial.print(F(__DATE__));
Serial.print(F(" "));
Serial.print(F(__TIME__));
Serial.println();
Serial.println();
}
void loop() {
Serial.println(millis());
digitalWrite(led_info_pin, HIGH);
delay(250);
digitalWrite(led_info_pin, LOW);
delay(250);
}
ttyUSB0 is `CP2102N USB to UART Bridge Controller`
(checked by connecting one and then the other and with linux dmesg enumeration events)
the results are the following:
Code: Select all
| Test | `USB CDC on boot` | upload | serial timeout | output | output |
| :---- | ----------------: | :------ | -------------: | ------: | ------: |
| 1 | Disabled | ttyACM0 | - | ttyACM0 | empty |
| 1 | Disabled | ttyACM0 | - | ttyUSB0 | normal |
| 2 | Enabled | ttyACM0 | yes | ttyACM0 | empty |
| 2 | Enabled | ttyACM0 | yes | ttyUSB0 | startup |
| 3 | Disabled | ttyUSB0 | - | ttyACM0 | empty |
| 3 | Disabled | ttyUSB0 | - | ttyUSB0 | normal |
| 4 | Enabled | ttyUSB0 | yes | ttyACM0 | empty |
| 4 | Enabled | ttyUSB0 | yes | ttyUSB0 | startup |
(i see the reconnect of the `USB JTAG/serial debug unit` in the dmesg events)
sometimes the upload with ttyACM0 failed:
i think this was every time the last sketch had `USB CDC on boot`: EnabledA fatal error occurred: Timed out waiting for packet header
(this was easily worked around by releasing the reset button very shortly before the upload begins)
Conclusions:
- it does make about no difference how i upload that is a good thing
- the code seems to run fine in all cases.
- `USB CDC on boot`: Enabled
i do not get any Serial.println() thing to my laptop
i think i had output with Version 2.0.0
so i will downgrade tomorow and test again..
if anyone has ideas / tips / pointers to documentation
pleas let me know!
sunny greetings
stefan