I'm using the S2-mini-2 connected via USB. In Arduino IDE 2.3.2 I set USB CDC On Boot to enabled. Serial.print works fine this way but I do not get any console messages (boot messages). I assume the ROM is still trying to use the UART. How can I tell it to use the CDC port?
Thnx
ESP32 S2 USB monitor console output
-
- Posts: 829
- Joined: Mon Jul 22, 2019 3:20 pm
Re: ESP32 S2 USB monitor console output
USB-CDC is a negotiated protocol. This means it takes about 50-100ms to enable the channel after the esp32 powers up. If you have a usb-cdc enabled firmware installed, it knows not to reinit the port during restarts, so you can see the boot logging. However, if the device is in a boot loop b/c there is a problem with device initialization, it is too fast for the connection to be made, so you cannot see this. As such, I don't use usb-cdc output for development work. They are great for production, where you will just need to connect the device via usb once to install firmware.
Re: ESP32 S2 USB monitor console output
I was aware of this delay and it's not so much about the boot messages per se. It's more about printf, ESP_ERROR_CHECK, ESP_LOGI, etc. So everything that would go to the console/stdout.
I found this issue: https://github.com/espressif/arduino-esp32/issues/8080
But that didn't work. I do have USB CDC On Boot enabled and using ESP32S2 Dev Module in the IDE with the following code:
[Codebox]
#include "esp_log.h"
static const char *TAG = "Test Tag";
void setup() {
Serial.begin(115200);
Serial.setDebugOutput(true);
delay(500);
}
void loop() {
Serial.println("serial print");
printf("printf\n");
ESP_LOGI(TAG, "esp_log");
log_i("log_i");
delay(500);
}
[/Codebox]
But still (with this setDebugOutput(true)) it only prints:
serial print
serial print
...
Here https://docs.espressif.com/projects/ard ... t-printing it says:
Later I learned that this is because of the "boards.txt" and the definition there of ESP32S2 Dev Module (which I am using for being close to the actual S2-mini-2 module I'm using). I also learned that the CLI can use flags. But both, editing the boards.txt or figuring out how to compile using the CLI would take me days to learn I think.
I just wonder if there isn't a more simple way to get the console output going or at least where in code this is set. The Serial.setDebugOutput(true) working would be nice. Here (https://github.com/espressif/arduino-es ... sions/7639) it says it should work. But nomm.
Thnx
I found this issue: https://github.com/espressif/arduino-esp32/issues/8080
But that didn't work. I do have USB CDC On Boot enabled and using ESP32S2 Dev Module in the IDE with the following code:
[Codebox]
#include "esp_log.h"
static const char *TAG = "Test Tag";
void setup() {
Serial.begin(115200);
Serial.setDebugOutput(true);
delay(500);
}
void loop() {
Serial.println("serial print");
printf("printf\n");
ESP_LOGI(TAG, "esp_log");
log_i("log_i");
delay(500);
}
[/Codebox]
But still (with this setDebugOutput(true)) it only prints:
serial print
serial print
...
Here https://docs.espressif.com/projects/ard ... t-printing it says:
I remember using these -D flags from when I used PIO but I don't know how to set them directly using the Arduino IDE. The "USB CDC On Boot" I can set (and that turns on the Serial.print() statements. But the "USB Mode" isn't there.If you use the USB connector, you should have that enabled (-D ARDUINO_USB_CDC_ON_BOOT=1) and set USB Mode to “Hardware CDC and JTAG” (-D ARDUINO_USB_MODE=0).
Later I learned that this is because of the "boards.txt" and the definition there of ESP32S2 Dev Module (which I am using for being close to the actual S2-mini-2 module I'm using). I also learned that the CLI can use flags. But both, editing the boards.txt or figuring out how to compile using the CLI would take me days to learn I think.
I just wonder if there isn't a more simple way to get the console output going or at least where in code this is set. The Serial.setDebugOutput(true) working would be nice. Here (https://github.com/espressif/arduino-es ... sions/7639) it says it should work. But nomm.
Thnx
-
- Posts: 829
- Joined: Mon Jul 22, 2019 3:20 pm
Re: ESP32 S2 USB monitor console output
I'd go ahead and (re)open an issue at https://github.com/espressif/arduino-esp32/issues about this.
Note that ets_printf works. The S2 was kind of a practice device for USB, so some of the stuff simply doesn't work quite the same way as it does on newer variants.
Note that ets_printf works. The S2 was kind of a practice device for USB, so some of the stuff simply doesn't work quite the same way as it does on newer variants.
Re: ESP32 S2 USB monitor console output
Okay, thank you for looking into it. I choose the S2 mini 2 because I just needed PCNT and USB support. I'll see if I can do without the console and if not I will open an issue.
Who is online
Users browsing this forum: No registered users and 57 guests