Reputation: 2762
I have a simple initialization of my Arduino sketch, which I compile and run from PlatformIO on Esp32.
void setup() {
Serial.flush();
Serial.begin(921600);
Serial.println();
Serial.println("Started");
}
the problem is that when I press "Upload and Monitor", I get a lot of garbage in the output, of which I cannot find the origin.
Note that "Started" properly shows, as I would expect, because the baud rate of the terminal and Serial are both set to 921600. I tried various baud rates, but all with the same result. Any ideas where this is coming from?
Upvotes: 0
Views: 3018
Reputation: 19
Had the same issue and solved mine by setting up a few things.
In setup I start/clear the Serial connection. I'm also explicit about using SERIAL_8N1.
void setup() {
Serial.begin(115200, SERIAL_8N1);
Serial.end();
Serial.begin(115200, SERIAL_8N1);
}
The only speed that works consistently is 115200 for me. I thought that slower speeds would work more consistently but 9600, 19200 and others still have this issue. I'm assuming it's some sort of internal ESP32 interference but not really sure.
In platformio.ini make sure to set the corresponding speed.
[env]
monitor_speed = 115200
Upvotes: 1
Reputation: 423
I have similar issue with an ESP32 board from AI Thinker. The issue is caused by the EN pin which has startup issue.
By adding a capacitor of 0.1µF or lager between EN and GND pin, it fixes cold start issue and also make the garbage from serial output disappear completely.
Boards from Espressif do not have any of these issues.
Upvotes: 2
Reputation: 4825
That's output from the bootloader which uses 115200 baud. Just ignore it.
Upvotes: 0