Esp32thing serial monitor broken

Hello,
I’m trying to run the espidf-hello-world example on my esp32thing board, and I’m having problems with the serial.

My monitor_speed is set to 115200 in my platfomio.ini file.

Some notes:

  • The bootloader, which runs at 115200 prints out just fine
  • I’ve tried using gnu screen, and received the same results.
  • I’ve tried erasing the flash with esptool and reprogramming
  • I’ve tried selecting a couple of other bauds, but I’m still getting gibberish.
  • I’m using the latest platformio
  • My blink example is unmodified, with the exception of platformio.ini, which is pasted below
  • Tried arduino platform WiFiScan example with same board, and serial seems to work fine.

platformio.ini

[env:esp32thing]
platform = espressif32
framework = espidf
board = esp32thing
monitor_speed = 115200

Below is an example of what the monitor outputs:

For reference, here is my compile log:

Processing esp32thing (platform: espressif32; monitor_speed: 115200; board: esp32thing; framework: espidf)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32thing.html
PLATFORM: Espressif 32 > SparkFun ESP32 Thing
HARDWARE: ESP32 240MHz 320KB RAM (4MB Flash)
DEBUG: CURRENT(esp-prog) EXTERNAL(esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(soft)
Collected 0 compatible libraries
Scanning dependencies...
No dependencies
<lambda>(["checkprogsize"], [".pioenvs/esp32thing/firmware.elf"])
MethodWrapper(["checkprogsize"], [".pioenvs/esp32thing/firmware.elf"])
Memory Usage -> http://bit.ly/pio-memory-usage
DATA:    [          ]   3.8% (used 12344 bytes from 327680 bytes)
PROGRAM: [=         ]  12.4% (used 130501 bytes from 1048576 bytes)
.pioenvs/esp32thing/firmware.elf  :
section            size         addr
.rtc.text             0   1074528256
.rtc_noinit           0   1342177280
.iram0.vectors     1024   1074266112
.iram0.text       31156   1074267136
.dram0.data        8168   1073479680
.noinit               0   1073487848
.dram0.bss         4176   1073487848
.flash.rodata     22052   1061158944
.flash.text       68101   1074593816
.comment            244            0
.xtensa.info         56            0
.debug_line       72785            0
.debug_info       89418            0
.debug_abbrev     14780            0
.debug_aranges     1400            0
.debug_str         5834            0
.debug_frame       2168            0
.debug_loc        76508            0
.debug_ranges       952            0
Total            398822
<lambda>(["upload"], [".pioenvs/esp32thing/firmware.bin"])
AVAILABLE: esp-prog, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
CURRENT: upload_protocol = esptool
MethodWrapper(["upload"], [".pioenvs/esp32thing/firmware.bin"])
Use manually specified: /dev/ttyUSB0
"/home/bkinman/.platformio/penv/bin/python2.7" "/home/bkinman/.platformio/packages/tool-esptoolpy/esptool.py" --chip esp32 --port "/dev/ttyUSB0" --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 /home/bkinman/Documents/PlatformIO/Projects/190211-094748-espidf-hello-world/.pioenvs/esp32thing/bootloader.bin 0x8000 /home/bkinman/Documents/PlatformIO/Projects/190211-094748-espidf-hello-world/.pioenvs/esp32thing/partitions.bin 0x10000 .pioenvs/esp32thing/firmware.bin
esptool.py v2.6
Serial port /dev/ttyUSB0
Connecting........_____....._
Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
MAC: 30:ae:a4:bc:01:6c
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 19632 bytes to 12007...
Writing at 0x00001000... (100 %)
Wrote 19632 bytes (12007 compressed) at 0x00001000 in 0.1 seconds (effective 1089.5 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 103...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (103 compressed) at 0x00008000 in 0.0 seconds (effective 1556.7 kbit/s)...
Hash of data verified.
Compressed 133712 bytes to 65261...
Writing at 0x00010000... (25 %)
Writing at 0x00014000... (50 %)
Writing at 0x00018000... (75 %)
Writing at 0x0001c000... (100 %)
Wrote 133712 bytes (65261 compressed) at 0x00010000 in 1.2 seconds (effective 928.6 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
========================================================================================================== [SUCCESS] Took 24.81 seconds ==========================================================================================================

There is mention here of

The Sparkfun Thing has a 26MHz crystal, while esp-idf is by default configured for an 40MHz crystal. In ‘make menuconfig’, if memory serves under components -> esp32 specific, you can change the crystal frequency.

If that is the source of your problem, I don’t know, and since I haven’t pulled my ESP32s out yet and tried them with PlatformIO, I don’t know how you go about configuring that sort of stuff… maybe you do run make menuconfig at the terminal? I’m sure someone else will jump in if you’re still stuck…

2 Likes

Thanks @pfeerick, this was the problem!
The default sdkconfig.h was incorrect.

For anybody else running into this issue, I made the following changes to sdkconfig.h:

  • Remove: #define CONFIG_ESP32_XTAL_FREQ_40 1
  • Remove: #define CONFIG_ESP32_XTAL_FREQ 40
  • Add: #define CONFIG_ESP32_XTAL_FREQ_AUTO 1
  • Add #define CONFIG_ESP32_XTAL_FREQ 0
3 Likes