PlatformIO Community

ESP32 TTGO board does not start executing the program

Hi,
I’ve got the TTGO T-Call (like in this post) and I can succesfully flash it with Arduino IDE using TTGO T1 board.
All programs flashed with Arduino IDE work good.

But when I flash the same programs with PlatformIO the program either does not start or something else happens and I have no clue how to debug into this.

Say, I flash this simple code:

#include <Arduino.h>

void setup() {
  Serial.begin(9600);
  while (!Serial) continue;

  Serial.printf("test"); 
}

void loop() {
    Serial.printf("loop"); 
    delay(1000);
}

so I’d expect the following to happen:
test
loop
loop

Instead, I get:

Writing at 0x00024000… (85 %)
Writing at 0x00028000… (100 %)
Wrote 209904 bytes (105362 compressed) at 0x00010000 in 2.5 seconds (effective 669.0 kbit/s)…
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
====================== [SUCCESS] Took 9.15 seconds ===
--- Miniterm on /dev/ttyUSB0  9600,8,N,1 ---
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---

The board does not execute the progam which I can tell by watching its serial port activity, it’s idle.

I have tried many different boards, the key fact here is that the board works on with TTGO T1 board at Arduino IDE

So you’re printf()-ing to the Serial instead of println(), and you don’t have a newline in the string to make it flush from the STDIO buffers to the hardware UART?

What does Serial.printf("loop\n"); do?

Well, the root cause of the issue was … that I have created the main.cpp file outside src/ folder and the program was compiled with original main.cpp file which remained empty :crazy_face:

I realized when I made a deliberate syntax error and saw no compiler issue…
Now everything works as expected.