PlatformIO Community

Liligo TTGO LoRa32 compiles but panics in Ubuntu, but not W10 using VSCode

My ttgo-lora-oled board compiles, but continuously reboots using Blink, PlatformIO and VSCode with Ubuntu 20.04. The Arduino IDE has no problem uploading and running Blink. I can also program the same board with VSCode and PlatformIO on a Windows 10 machine. I can also program a Nano using Ubuntu, VSCode and PlatformIO, so something seems to be going on specific to the configuration for board = ttgo-lora32-v1.

platformio.ini

[env:ttgo-lora32-v1]
platform = espressif32
board = ttgo-lora32-v1
framework = arduino
monitor_speed =115200

Compile output:

  • Executing task in folder blink_ttgo: platformio run --target upload

Processing ttgo-lora32-v1 (platform: espressif32; board: ttgo-lora32-v1; framework: arduino)

Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: Redirecting...
PLATFORM: Espressif 32 (5.1.0) > TTGO LoRa32-OLED V1
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, 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)
PACKAGES:

  • framework-arduinoespressif32 @ 3.20004.0 (2.0.4)
  • tool-esptoolpy @ 1.30300.0 (3.3.0)
  • tool-mkfatfs @ 2.0.1
  • tool-mklittlefs @ 1.203.210628 (2.3)
  • tool-mkspiffs @ 2.230.0 (2.30)
  • toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch3
    LDF: Library Dependency Finder → Library Dependency Finder (LDF) — PlatformIO latest documentation
    LDF Modes: Finder ~ chain, Compatibility ~ soft
    Found 32 compatible libraries
    Scanning dependencies…
    No dependencies
    Building in release mode
    Retrieving maximum program size .pio/build/ttgo-lora32-v1/firmware.elf
    Checking size .pio/build/ttgo-lora32-v1/firmware.elf
    Advanced Memory Usage is available via “PlatformIO Home > Project Inspect”
    RAM: [ ] 4.9% (used 16192 bytes from 327680 bytes)
    Flash: [== ] 16.9% (used 221209 bytes from 1310720 bytes)
    Configuring upload protocol…
    AVAILABLE: cmsis-dap, esp-bridge, esp-prog, espota, 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
    Looking for upload port…
    Auto-detected: /dev/ttyACM0
    Uploading .pio/build/ttgo-lora32-v1/firmware.bin
    esptool.py v3.3
    Serial port /dev/ttyACM0
    Connecting…
    Chip is ESP32-D0WDQ6-V3 (revision 3)
    Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
    Crystal is 26MHz
    MAC: 78:21:84:88:30:a4
    Uploading stub…
    Running stub…
    Stub running…
    Changing baud rate to 460800
    Changed.
    Configuring flash size…
    Flash will be erased from 0x00001000 to 0x00005fff…
    Flash will be erased from 0x00008000 to 0x00008fff…
    Flash will be erased from 0x0000e000 to 0x0000ffff…
    Flash will be erased from 0x00010000 to 0x00046fff…
    Flash params set to 0x0220
    Compressed 17408 bytes to 12093…
    Writing at 0x00001000… (100 %)
    Wrote 17408 bytes (12093 compressed) at 0x00001000 in 0.5 seconds (effective 273.7 kbit/s)…
    Hash of data verified.
    Compressed 3072 bytes to 128…
    Writing at 0x00008000… (100 %)
    Wrote 3072 bytes (128 compressed) at 0x00008000 in 0.1 seconds (effective 352.6 kbit/s)…
    Hash of data verified.
    Compressed 8192 bytes to 47…
    Writing at 0x0000e000… (100 %)
    Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.1 seconds (effective 498.7 kbit/s)…
    Hash of data verified.
    Compressed 221600 bytes to 121949…
    Writing at 0x00010000… (12 %)
    Writing at 0x0001d8e0… (25 %)
    Writing at 0x00023344… (37 %)
    Writing at 0x000286d7… (50 %)
    Writing at 0x0002d96f… (62 %)
    Writing at 0x000361f8… (75 %)
    Writing at 0x0003e26e… (87 %)
    Writing at 0x0004399f… (100 %)
    Wrote 221600 bytes (121949 compressed) at 0x00010000 in 2.9 seconds (effective 604.0 kbit/s)…
    Hash of data verified.

Leaving…
Hard resetting via RTS pin…
===================================== [SUCCESS] Took 10.32 seconds =====================================

  • Terminal will be reused by tasks, press any key to close it.

Rebooting sequence

  • Executing task in folder blink_ttgo: platformio device monitor

— Terminal on /dev/ttyACM0 | 115200 8-N-1
— Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
— More details at Redirecting...
— Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H

assert failed: do_core_init startup.c:298 (flash_ret == ESP_OK)

Backtrace:0x400832ed:0x3ffe3aa00x40087155:0x3ffe3ac0 0x4008bc65:0x3ffe3ae0 0x400d6796:0x3ffe3c10 0x40082a09:0x3ffe3c40 0x400792ba:0x3ffe3c90 |<-CORRUPTED

ELF file SHA256: 0000000000000000

Rebooting…
ets Jul 29 2019 12:21:46

rst:0xc (SW_CPU_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:13132
load:0x40080400,len:3036
entry 0x400805e4

assert failed: do_core_init startup.c:298 (flash_ret == ESP_OK)

Backtrace:0x400832ed:0x3ffe3aa00x40087155:0x3ffe3ac0 0x4008bc65:0x3ffe3ae0 0x400d6796:0x3ffe3c10 0x40082a09:0x3ffe3c40 0x400792ba:0x3ffe3c90 |<-CORRUPTED

ELF file SHA256: 0000000000000000

Rebooting…
ets Jul 29 2019 12:21:46

rst:0xc (SW_CPU_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:13132
load:0x40080400,len:3036
entry 0x400805e4

assert failed: do_core_init startup.c:298 (flash_ret == ESP_OK)

Backtrace:0x400832ed:0x3ffe3aa00x40087155:0x3ffe3ac0 0x4008bc65:0x3ffe3ae0 0x400d6796:0x3ffe3c10 0x40082a09:0x3ffe3c40 0x400792ba:0x3ffe3c90 |<-CORRUPTED

ELF file SHA256: 0000000000000000

Rebooting…

Likely you’re not telling PlatformIO the correct flash mode, type or capacity as documented.

Please provide a screenshot of the Arduino IDE → Tools menu with the settings that work for your board.

lili
Thank you for helping me. It is very much appreciated. Here is a screenshot from Ubuntu/Arduino.

Can you add

board_build.f_flash = 80000000L

to the platformio.ini and upload again?

Darn. I thought that would work, but still the same results.
lili2

When you upload with the Arduino IDE, what are the bootloader messages?

(^-- these ones)

Thanks again…Not sure if this is what you are wanting to see…

Changing baud rate to 921600
Changed.
Configuring flash size…
Flash will be erased from 0x00001000 to 0x00005fff…
Flash will be erased from 0x00008000 to 0x00008fff…
Flash will be erased from 0x0000e000 to 0x0000ffff…
Flash will be erased from 0x00010000 to 0x00045fff…
Flash params set to 0x022f
Compressed 17440 bytes to 12090…
Writing at 0x00001000… (100 %)
Wrote 17440 bytes (12090 compressed) at 0x00001000 in 0.4 seconds (effective 313.5 kbit/s)…
Hash of data verified.
Compressed 3072 bytes to 128…
Writing at 0x00008000… (100 %)
Wrote 3072 bytes (128 compressed) at 0x00008000 in 0.0 seconds (effective 672.0 kbit/s)…
Hash of data verified.
Compressed 8192 bytes to 47…
Writing at 0x0000e000… (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.1 seconds (effective 805.1 kbit/s)…
Hash of data verified.
Compressed 219392 bytes to 120810…
Writing at 0x00010000… (12 %)
Writing at 0x0001d9ec… (25 %)
Writing at 0x00022fcf… (37 %)
Writing at 0x0002827d… (50 %)
Writing at 0x0002d6e9… (62 %)
Writing at 0x00035f56… (75 %)
Writing at 0x0003e036… (87 %)
Writing at 0x000438d5… (100 %)
Wrote 219392 bytes (120810 compressed) at 0x00010000 in 2.6 seconds (effective 682.4 kbit/s)…
Hash of data verified.

I will also compile on another Windows 10 machine using VSCode/Plaformio. It works without issue.

I meant, the serial output after you have flashed the firmware.

I added a serial line to trigger the output to Blink

lili3

rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1184
load:0x40078000,len:13160
load:0x40080400,len:3036
entry 0x400805e4
Hello World

Okay so we know these setting should be good.

Comparing it to

However shows that PlatformIO with the flash frequency set to 80MHz has the exact same output.

Does it also fail in PlatformIO when you flash your print-hello code from the Arduino IDE?

Unfortunately yes, Blink (with Serial, print hello, same as Arduino IDE), fails in VSCode/PlatformIO/Ubuntu. The same code works on Windows 10, using .ini file with no “board_build.f_flash = 80000000L”

Showing failing on VSCode/PlatformIO/Ubuntu
lili4

Showing working in Windows 10
lili5

Blink code

#include <Arduino.h>
void setup() {
Serial.begin(115200);
Serial.println(“Hello World”);
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}

Summary
lili6

Then the PlatformIO core or platform versions are not the same on Linux as on Windows.

On Linux, please open a CLI and do

pio upgrade --dev
pio pkg update -g -p espressif32

Upload the project again. Does it work now?

Yes, that fixed it. Thank you very much for hanging in there with me. For others to follow my steps were:

  1. Open VSCode; Close my workspace
  2. Open PlatformIO then under Miscellaneous choose PlatformIO Core CLI
  3. pio upgrade --dev
  4. pio pkg update -g -p espressif32

lili7