I'm using PlatformIO with Arduino framework in Visual Studio Code on Ubuntu 22.04.
I'm able to flash my ESP32-C3 module using the built-in serial/jtag module (it shows up as /dev/ttyACMx) while monitoring serial debug prints on the uart0 pins (with usb-uart adapter, appears as /dev/ttyUSBx).
However I'm unable to redirect serial prints to the USB CDC peripheral. That makes it pointless as I don't have extra pins for both USB and UART0 in my actual application.
As per
https://docs.espressif.com/projects/esp ... nsole-uart
In ESP-IDF, menuconfig has an option for selecting USB CDC for the serial console for chips with the serial/jtag peripheral.
Is there any way to select this option in the Arduino framework ?
cheers
esp32-C3 usb serial/jtag for flashing AND serial console output
Re: esp32-C3 usb serial/jtag for flashing AND serial console output
I'm using the S3, so these options may help:
in your platformio.ini:
build_flags=
-DARDUINO_USB_MODE=1
-DSERIALCONS=USBSerial
Depending on my target SERIALCONS changes, but in my code, I use SERIALCONS and place I would normally use Serial.
I'm also including these, but not sure if they are needed for you:
#include "USB.h"
#include "driver/usb_serial_jtag.h"
#include "esp_vfs_usb_serial_jtag.h"
#include "esp_vfs_dev.h"
in your platformio.ini:
build_flags=
-DARDUINO_USB_MODE=1
-DSERIALCONS=USBSerial
Depending on my target SERIALCONS changes, but in my code, I use SERIALCONS and place I would normally use Serial.
I'm also including these, but not sure if they are needed for you:
#include "USB.h"
#include "driver/usb_serial_jtag.h"
#include "esp_vfs_usb_serial_jtag.h"
#include "esp_vfs_dev.h"
-
- Posts: 831
- Joined: Mon Jul 22, 2019 3:20 pm
Re: esp32-C3 usb serial/jtag for flashing AND serial console output
You don't need all the extra, just the define flags:
Code: Select all
-DARDUINO_USB_MODE=1
-DARDUINO_USB_CDC_ON_BOOT=1
Re: esp32-C3 usb serial/jtag for flashing AND serial console output
Thanks for the response guys, this was all that was needed for the C3. My test code :You don't need all the extra, just the define flags:
CODE: SELECT ALL
-DARDUINO_USB_MODE=1
-DARDUINO_USB_CDC_ON_BOOT=1
Code: Select all
#include <Arduino.h>
uint32_t chipId = 0;
void setup() {
Serial.begin();
}
void loop() {
for(int i=0; i<17; i=i+8) {
chipId |= ((ESP.getEfuseMac() >> (40 - i)) & 0xff) << i;
}
Serial.printf("ESP32 Chip model = %s Rev %d\n", ESP.getChipModel(), ESP.getChipRevision());
Serial.printf("This chip has %d cores\n", ESP.getChipCores());
Serial.print("Chip ID: "); Serial.println(chipId);
delay(3000);
}
Who is online
Users browsing this forum: Bing [Bot] and 36 guests