hpsaturn / esp32-wifi-cli

Basic CLI for WiFi setup over ESP32
GNU General Public License v3.0
9 stars 3 forks source link

Serial shell port #19

Closed jgauchia closed 3 weeks ago

jgauchia commented 3 weeks ago

Overview

Hi, I've a little question.

What Serial is used for local shell CLI?

In ESP32 I think is Serial, but in ESP32S3, that has 2 Serials, Serial is used by CDC Native USB Port and Serial0 to RX/TX gpio used by USB to Ttl converters.

i've a board that only has the USB to TTL Converter and with this board CLI not displayed at Serial monitor, but with another one with 2 USB ports the CLI only displayed in USB CDC.

There is some way to change or review what Serial use this library?

Thank you!

hpsaturn commented 3 weeks ago

Adding some context. In an ESP32S3 TTGO T7 board and using the Arduino Framework (v6.8.1) pre-build with PlatformIO, when you add the build flag:

-D ARDUINO_USB_CDC_ON_BOOT=1

you able to have the CLI in the CDC connector (USBC native pins of the esp32s3). When you comment it, you could have the CLI in the TX/RX pins. In this board you need a FTDI adapter like this:

photo_2024-09-06_18-03-01

jgauchia commented 3 weeks ago

Oks, your example works,

I'll try to upgrade framework and some dependencies.

Thanks

jgauchia commented 3 weeks ago

Solved!

My board has an ESP32S3 N16R8 but it only has the USB with TTL converter (GPIO RX0 and TX0). I was using the board definition esp32-s3-devkitc-1-n16r8v (The standard definition that was the closest, given that the manufacturer did not have their own) and, as you mentioned, I disabled the ARDUINO_USB_CDC_ON_BOOT in my platformio.ini environment , but in the board definition still includes it:

      "extra_flags": [
        "-DARDUINO_ESP32S3_DEV",
        "-DBOARD_HAS_PSRAM",
        "-DARDUINO_USB_MODE=1",
        "-DARDUINO_USB_CDC_ON_BOOT=1"
      ],

I have created a custom board definition without ARDUINO_USB_CDC_ON_BOOT (a copy of the original JSON board definition) and added it to the boards folder of my project.

Therefore, when selecting an existing board definition, you need to check the JSON to ensure it doesn't include ARDUINO_USB_CDC_ON_BOOT. Even if it is not specified in the project's ini file, it will still use the one from the board definition.

hpsaturn commented 3 weeks ago

Thanks for the feedback. This could help for others.