Reputation: 2777
I wrote a small program on PlatformIO for an ESP32 with ESP-IDF framework.
Currently this is connected to my PC with USB cable. I receive lots of data from a CAN-BUS and I print this data with printf()
It seems the output with the standard baud rate 115200 is too slow. This is why I want to set this to a higher value.
I changed this in the platformio.ini without success.
monitor_speed = 115200
I searched and did not find where I can change this baud rate.
If possible my idea is to add some code, maybe just a line or two, to set the value i.e. to 230400
I mention the ESP32, PlatformIO and ESP-IDF because I am not sure where this setting is supposed to be.
Upvotes: 6
Views: 9640
Reputation: 4562
Here is how you can do this with ESP-IDF directly (VSCode ESP-IDF extension) or PlatformIO.
I tested it on a ESP32-S3.
There are two thing you want to change:
For ESP-IDF extension, go to the settings, type esp-ifd baud rate
in the search box, you will get two results: "ESP-IDF Flash Baud rate" and "ESP-IDF Monitor Baud rate". The monitor is the one you are looking for. Set it the value you want e.g. 230400.
For PlatformIO extension, you can set the monitor speed by adding/changing the monitor_speed
option in platformio.ini, e.g. monitor_speed = 230400
.
There are two ways I found.
To open a configuration editor, for ESP-IDF you can use the command ESP-IDF: SDK Configuration editor
(or the corresponding icon) or type idf.py menuconfig
(for PlatformIO pio run -t menuconfig
) in the terminal.
The configurations you want to change are:
Custom UART
.UART0
.P.S. The CONFIG_CONSOLE_UART_BAUDRATE option of the sdkconfig is no longer supported, see ESP-IDF Monitor.
The default console output is UART0
, so right at the beginning of the program add: uart_set_baudrate(UART_NUM_0, 230400)
:
#include "driver/uart.h"
void app_main()
{
uart_set_baudrate(UART_NUM_0, 230400);
// ...
}
When using this option, the serial monitor may output some garbage before the code reaches this line do to some init code logs that are sent before changing the baudrate to what the monitor is expecting.
Upvotes: 1
Reputation: 11
On VSCode: Open Settings and search vor "baud". Don' t change "Flash Baud Rate", it is "Monitor Baud Rate" you want to adjust! Screenshot
Upvotes: 1
Reputation: 126
If you are using VSC and ESP-IDF extension,
go to settings (default CTRL+,) -> Extensions -> ESP-IDF -> Flash Baud Rate
Upvotes: 5
Reputation: 2128
It is a setting of esp-idf framework. You can set the console baud rate in sdkconfig.defaults (at project root directory):
CONFIG_CONSOLE_UART_BAUDRATE=230400
You can also configure it via menuconfig (idf.py menuconfig or pio run -t menuconfig):
Upvotes: 5