How to get serial console output from ESP32S3?

Hi,

I have a “LILYGO T-Dongle-S3” ESP32S3 module (“no LCD” variant). I’m able to compile basic examples using PlatformIO and the espidf framework using these platformio.ini settings:

[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = espidf

This module has a single USB port that shows up as the Espressif USB JTAG/serial device on /dev/ttyACM0 when I plug it in, and I’m able to see the console output from the various PlatformIO/espidf examples I’ve tried when I open the serial console on /dev/ttyACM0 with picocom.

However, I’m not able to get any output when trying the RIOT OS examples.

I’m able to build and upload the hello-world example. I’m using BOARD=esp32s3-devkit since that seems to be identical to the esp32-s3-devkitc-1 board that worked with PlatformIO. Here is the output from building and flashing the RIOT OS hello-world example:

edmonds@chase{0}:~/src/RIOT$ BUILD_IN_DOCKER=1 DOCKER=podman BOARD=esp32s3-devkit PORT=/dev/ttyACM0 make -C examples/hello-world clean
make: Entering directory '/home/edmonds/src/RIOT/examples/hello-world'
rm -rf /home/edmonds/src/RIOT/examples/hello-world/bin/esp32s3-devkit/pkg-build/esp32_sdk
make: Leaving directory '/home/edmonds/src/RIOT/examples/hello-world'
edmonds@chase{0}:~/src/RIOT$ BUILD_IN_DOCKER=1 DOCKER=podman BOARD=esp32s3-devkit PORT=/dev/ttyACM0 make -C examples/hello-world flash
make: Entering directory '/home/edmonds/src/RIOT/examples/hello-world'
Launching build container using image "sha256:1329f419ec1a045a5830361f288536a56a0671a3b0db216e469369b00719cdff".
podman run --rm --tty --userns keep-id -v '/usr/share/zoneinfo/America/New_York:/etc/localtime:ro' -v '/home/edmonds/src/RIOT:/data/riotbuild/riotbase:delegated' -v '/home/edmonds/.cargo/registry:/data/riotbuild/.cargo/registry:delegated' -v '/home/edmonds/.cargo/git:/data/riotbuild/.cargo/git:delegated' -e 'RIOTBASE=/data/riotbuild/riotbase' -e 'CCACHE_BASEDIR=/data/riotbuild/riotbase' -e 'BUILD_DIR=/data/riotbuild/riotbase/build' -e 'BUILD_IN_DOCKER=/data/riotbuild/riotbase/examples/hello-world/1' -e 'RIOTPROJECT=/data/riotbuild/riotbase' -e 'RIOTCPU=/data/riotbuild/riotbase/cpu' -e 'RIOTBOARD=/data/riotbuild/riotbase/boards' -e 'RIOTMAKE=/data/riotbuild/riotbase/makefiles'      -e 'BOARD=esp32s3-devkit' -e 'DISABLE_MODULE=' -e 'DEFAULT_MODULE=' -e 'FEATURES_REQUIRED=' -e 'FEATURES_BLACKLIST=' -e 'FEATURES_OPTIONAL=' -e 'USEMODULE=' -e 'USEPKG='  -w '/data/riotbuild/riotbase/examples/hello-world/' 'sha256:1329f419ec1a045a5830361f288536a56a0671a3b0db216e469369b00719cdff' make
Building application "hello-world" for "esp32s3-devkit" with CPU "esp32".

"make" -C /data/riotbuild/riotbase/pkg/esp32_sdk/
"make" -C /data/riotbuild/riotbase/boards/common/init
"make" -C /data/riotbuild/riotbase/boards/esp32s3-devkit
"make" -C /data/riotbuild/riotbase/boards/common/esp32s3
"make" -C /data/riotbuild/riotbase/boards/common/esp32x
"make" -C /data/riotbuild/riotbase/core
"make" -C /data/riotbuild/riotbase/core/lib
"make" -C /data/riotbuild/riotbase/cpu/esp32
"make" -C /data/riotbuild/riotbase/cpu/esp32/bootloader
esptool.py v3.2-dev
Merged 1 ELF section
"make" -C /data/riotbuild/riotbase/cpu/esp32/esp-idf
"make" -C /data/riotbuild/riotbase/cpu/esp32/esp-idf/common
"make" -C /data/riotbuild/riotbase/cpu/esp32/esp-idf/efuse
"make" -C /data/riotbuild/riotbase/cpu/esp32/esp-idf/gpio
"make" -C /data/riotbuild/riotbase/cpu/esp32/esp-idf-api
"make" -C /data/riotbuild/riotbase/cpu/esp32/freertos
"make" -C /data/riotbuild/riotbase/cpu/esp32/periph
"make" -C /data/riotbuild/riotbase/cpu/esp_common
"make" -C /data/riotbuild/riotbase/cpu/esp_common/esp-xtensa
"make" -C /data/riotbuild/riotbase/cpu/esp_common/freertos
"make" -C /data/riotbuild/riotbase/cpu/esp_common/periph
"make" -C /data/riotbuild/riotbase/cpu/esp_common/vendor
"make" -C /data/riotbuild/riotbase/cpu/esp_common/vendor/xtensa
"make" -C /data/riotbuild/riotbase/drivers
"make" -C /data/riotbuild/riotbase/drivers/periph_common
"make" -C /data/riotbuild/riotbase/sys
"make" -C /data/riotbuild/riotbase/sys/auto_init
"make" -C /data/riotbuild/riotbase/sys/div
"make" -C /data/riotbuild/riotbase/sys/libc
"make" -C /data/riotbuild/riotbase/sys/luid
"make" -C /data/riotbuild/riotbase/sys/newlib_syscalls_default
"make" -C /data/riotbuild/riotbase/sys/pm_layered
"make" -C /data/riotbuild/riotbase/sys/preprocessor
"make" -C /data/riotbuild/riotbase/sys/random
"make" -C /data/riotbuild/riotbase/sys/stdio
"make" -C /data/riotbuild/riotbase/sys/stdio_uart
esptool.py v3.2-dev
Merged 2 ELF sections
Parsing CSV input...
   text	   data	    bss	    dec	    hex	filename
  59358	  11200	  75406	 145964	  23a2c	/data/riotbuild/riotbase/examples/hello-world/bin/esp32s3-devkit/hello-world.elf
/home/edmonds/src/RIOT/dist/tools/esptools/esptool_v3.2.py --chip esp32s3 --port /dev/ttyACM0 --baud 460800 --before default_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size detect 0x0000 /home/edmonds/src/RIOT/examples/hello-world/bin/esp32s3-devkit/esp_bootloader/bootloader.bin 0x8000 /home/edmonds/src/RIOT/examples/hello-world/bin/esp32s3-devkit/partitions.bin 0x10000 /home/edmonds/src/RIOT/examples/hello-world/bin/esp32s3-devkit/hello-world.elf.bin
esptool.py v3.2-dev
Serial port /dev/ttyACM0
Connecting....
Chip is ESP32-S3
Features: WiFi, BLE
Crystal is 40MHz
MAC: f4:12:fa:af:6a:ec
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Auto-detected Flash size: 16MB
Flash will be erased from 0x00000000 to 0x00003fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x00010000 to 0x00029fff...
Compressed 14480 bytes to 9756...
Wrote 14480 bytes (9756 compressed) at 0x00000000 in 0.3 seconds (effective 414.3 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 85...
Wrote 3072 bytes (85 compressed) at 0x00008000 in 0.1 seconds (effective 371.3 kbit/s)...
Hash of data verified.
Compressed 105648 bytes to 45529...
Wrote 105648 bytes (45529 compressed) at 0x00010000 in 1.2 seconds (effective 729.2 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
make: Leaving directory '/home/edmonds/src/RIOT/examples/hello-world'
edmonds@chase{0}:~/src/RIOT$

Then, I unplug and re-plug the ESP32S3 from the USB port.

Then, I open picocom on /dev/ttyACM0.

Then, I run make reset from the RIOT OS source tree and watch the terminal.

edmonds@chase{0}:~/src/RIOT$ BUILD_IN_DOCKER=1 DOCKER=podman BOARD=esp32s3-devkit PORT=/dev/ttyACM0 make -C examples/hello-world reset
make: Entering directory '/home/edmonds/src/RIOT/examples/hello-world'
/home/edmonds/src/RIOT/dist/tools/esptools/espreset.py --port /dev/ttyACM0
make: Leaving directory '/home/edmonds/src/RIOT/examples/hello-world'

And I see the following output on the terminal:

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x15 (USB_UART_CHIP_RESET),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x420034af
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd0108,len:0x494
load:0x403b6000,len:0x4
load:0x403b6004,len:0x2d40
load:0x403ba000,len:0x650
entry 0x403b600c
Pro cpu up.
Single core mode

OK, so when I ran make reset I saw some output that appears to be from the boot loader, but nothing else. Where is the output from the hello-world example that is supposed to be printed?

int main(void)
{
    puts("Hello World!");

    printf("You are running RIOT on a(n) %s board.\n", RIOT_BOARD);
    printf("This board features a(n) %s CPU.\n", RIOT_CPU);

    return 0;
}

Thanks!

OK, I managed to compile with LOG_LEVEL = 5 and I see some more output that seems to be generated by RIOT OS, which seems to indicate that RIOT OS can write to the serial console and I can read it with picocom, but still no output from the hello-world program itself:

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x15 (USB_UART_CHIP_RESET),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x420035e7
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd0108,len:0x1428
load:0x403b6000,len:0x4
load:0x403b6004,len:0x37a8
load:0x403ba000,len:0x688
entry 0x403b6018
I (27) boot: ESP-IDF v4.4.1 2nd stage bootloader
I (27) boot: chip revision: 0
I (27) boot.esp32s3: Boot SPI Speed : 80MHz
I (27) boot.esp32s3: SPI Mode       : DIO
I (30) boot.esp32s3: SPI Flash Size : 2MB
I (34) boot: Enabling RNG early entropy source...
I (38) boot: Partition Table:
I (41) boot: ## Label            Usage          Type ST Offset   Length
I (47) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (54) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (60) boot:  2 factory          factory app      00 00 00010000 00019df0
I (67) boot: End of partition table
I (70) esp_image: segment 0: paddr=00010020 vaddr=3c010020 size=0213ch (  8508) map
I (79) esp_image: segment 1: paddr=00012164 vaddr=3fc88cd0 size=00d40h (  3392) load
I (86) esp_image: segment 2: paddr=00012eac vaddr=40374000 size=04cd0h ( 19664) load
I (97) esp_image: segment 3: paddr=00017b84 vaddr=50000000 size=00010h (    16) load
I (100) esp_image: segment 4: paddr=00017b9c vaddr=600fe000 size=0002ch (    44) load
I (107) esp_image: segment 5: paddr=00017bd0 vaddr=00000000 size=08448h ( 33864)
I (121) esp_image: segment 6: paddr=00020020 vaddr=42000020 size=09da4h ( 40356) map
I (131) boot: Loaded app from partition at offset 0x10000
I (131) boot: Disabling RNG early entropy source...
Pro cpu up.
Single core mode
RTC_SLOW_CLK calibration value: 4340173
In EFUSE_BLK1__DATA1_REG is used 8 bits starting with 8 bit
In EFUSE_BLK1__DATA1_REG is used 8 bits starting with 0 bit
In EFUSE_BLK1__DATA0_REG is used 8 bits starting with 24 bit
In EFUSE_BLK1__DATA0_REG is used 8 bits starting with 16 bit
In EFUSE_BLK1__DATA0_REG is used 8 bits starting with 8 bit
In EFUSE_BLK1__DATA0_REG is used 8 bits starting with 0 bit

Starting ESP32x with ID: f412faaf6aec
ESP-IDF SDK Version v4.4.1

Current clocks in Hz: CPU=80000000 APB=80000000 XTAL=40000000 SLOW=150000
PRO cpu is up (single core mode, only PRO cpu is used)
PRO cpu starts user code
Used clocks in Hz: CPU=80000000 APB=80000000 XTAL=40000000 FAST=8000000 SLOW=150000
XTAL calibration value: 4340173
Heap free: 256088 bytes

Board configuration:
	LED		pins=[ ]
	BUTTONS		pins=[ 0 ]

Starting RIOT kernel on PRO cpu

Ah, I figured it out. I needed to add USEMODULE += stdio_usb_serial_jtag to the Makefile according to this note in the API documentation: STDIO over ESP32 Debug Serial/JTAG

Glad you got it figured out. Thanks for posting the solution for others to find. Welcome to the community.