Esp32-c3-mini-1 serial monitor not working

Hello,
im having some trouble when trying to use the serial monitor on my custom esp32-c3-mini-1, flashinf is working fine, but i didnt got any response in the serial monitor, i already tried every method that i could find on the internet, here is my platformio.ini file:

[env:esp32-c3-mini]
platform = espressif32
board = esp32-c3-mini
monitor_speed = 115200
framework= arduino
build_flags = 
	-DARDUINO_USB_CDC_ON_BOOT=1
	-DARDUINO_USB_MODE=1

im using a custom board file that i got from Jason2866’s response on this topic:

here is the code that i’m trying to run:

#include <Arduino.h>
void setup() {
    Serial.begin(115200); 

    Serial.println("hello world");
}

void loop() {
  Serial.println("Hello from the loop");
  delay(1000);
}

here is my custom board.json file:

{
  "build": {
    "arduino":{
      "ldscript": "esp32c3_out.ld"
    },
    "core": "esp32",
    "extra_flags": "-DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=1",
    "f_cpu": "160000000L",
    "f_flash": "80000000L",
    "flash_mode": "qio",
    "mcu": "esp32c3",
    "variant": "esp32c3"
  },
  "connectivity": [
    "wifi"
  ],
  "debug": {
    "openocd_target": "esp32c3.cfg"
  },
  "frameworks": [
    "arduino",
    "espidf"
  ],
  "name": "Espressif ESP32-C3-MINI",
  "upload": {
    "flash_size": "4MB",
    "maximum_ram_size": 327680,
    "maximum_size": 4194304,
    "require_upload_port": true,
    "speed": 460800
  },
  "url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32c3/hw-reference/esp32c3/user-guide-devkitm-1.html",
  "vendor": "Espressif"
}

finally,here is the board schematic, the esp32 mcu have a serial connection to an stm32 as well on rx0 and tx0 ports:

if anyone could help i would be so greatfull, from now, thanks for your atention.

Best wishes,

This activates Hardware CDC and changes the behavior of the Serial objects:
Serial: output is routed to the builtin USB Serial
Serial0: output is routed to UART0 (RX: 20 / TX:21)
Serial1: output is routed to UART1 (RX: 18 / TX:19)

GPIO’s taken from HardwareSerial.cpp:

UART0:

    #elif CONFIG_IDF_TARGET_ESP32C3
      #define SOC_RX0 (gpio_num_t)20

    #elif CONFIG_IDF_TARGET_ESP32C3
      #define SOC_TX0 (gpio_num_t)21

UART1:

    #elif CONFIG_IDF_TARGET_ESP32C3
      #define RX1 (gpio_num_t)18

    #elif CONFIG_IDF_TARGET_ESP32C3
      #define TX1 (gpio_num_t)19

Hey @sivar2311 thanks for the reply, it still didint work, i tried running the following code but still got nothing on the serial monitor:

#include <Arduino.h>
void setup() {
    Serial.begin(115200);
    Serial1.begin(115200); 
    Serial0.begin(115200); 
    Serial.println("hello world");
    Serial1.println("hello world from serial 1");
    Serial0.println("hello world from serial 0");
    
}

void loop() {
  Serial.println("hello from the loop");
  Serial1.println("Hello from the loop via serial 1");
  Serial0.println("Hello from the loop via serial 0");
  delay(1000);
}

i also tried only one at a time and still got nothing.
Regrads,

I’m a bit confused.
GPIO’s 20 and 21 are used by Arduino for RX0 and TX0.
According to page 11 of the ESP32-C3-Mini Datasheet, these GPIO’s are used for USB D+ and D- !?

I suspect that this is the cause and that the variant esp32c3 and the used pins_arduino.h does not match your board correctly.

I use C3 or S2 or S3 boards and USB-C and there are few things I noticed:
1- if your program runs for 1s and board goes to sleep you will not see anything because your computer will not have enough time to discover the port that ESP32 is emulating
2- if I want to see what is printed, I apply delay(5000) on boot
3- for always on programs the initial delay is also needed to see the first prints
4- I only activate Serial.begin and then Serial.print - no need to go to seria1 or 2