PlatformIO Community

Serial Monitor - VSCodium - Unable To Control Baud Rate

I’ve got an esp8266 board from AI Thinker that I’m unable to set the baud rate in the serial monitor using Platformio. Seems stuck at 9600 no matter what I try. I am able to set the baud rate if I use the Arduino IDE, but I’m only doing that to prove it can be controlled.

I’ve tried the following:

  1. In platformio.ini for the project I’ve set
    monitor_speed = 115200
  2. I’ve looked for settings in VSCodium. None found.
  3. Set the baud rate in a terminal, but couldn’t figure out how to run the application after so gave up. Seems like the baud rate kept, but wasn’t able to apply it to the running serial monitor.

This is an example of one of my plafortio.ini files that changes the monitor port serial baud rate, its for the ESP32 but the 8266 should be the same (but with the environment, platform and board names changed to your setup)

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed= 115200

Is your code doing a Serial.begin(115200); ?

1 Like

Here is my .ini
[env:nodemcuv2]
platform = espressif8266
board = nodemcuv2
framework = arduino
monitor_speed = 115200
upload_speed = 921600

This is in setup:
Serial.begin(115200);

And when you click on ‘monitor’ for that environment (you only have the one configured, right? This isn’t a multi-board platformio.ini?) what are the first lines of the terminal… does it say 115200 there, or is it still saying 9600?

image

If you want to alter the baud rate once running, it’s Ctrl + T followed by b, and you’ll be prompted to enter the baud rate.

image

Afterthought: You need to click somewhere within the terminal in order to make sure it has input focus before the keyboard input will work.

1 Like

I don’t know what a multi-board platformio.ini is or how it would be configured, but I searched the attached HDDs just in case for any instances of platformio.ini files and found only those in the projects I’ve created as well as built-in examples or platformio libraries. I’m gonna go with no as the answer unless maybe it has a different file name or masked by the registry.

When I run the serial monitor I get baud of 9600 when asking for 115200 unfortunately.
cpp%20-%20Untitled%20(Workspace)%20-%20VSCodium

Interesting that when I to the recommended CTRL+T then b I can set the baud rate to 115200 and I can read the output instead of gibberish. This is a workaround and I’ll take it, but I still would like to know the solution as this is a bit irritating.

Is there only the one [env:whatever-name] block in your platformio.ini? If it has more than one… it’s multi-board, or multi-environment, and you could be using the default baud, not the one you set for [env:nodemcuv2]

Well, that is just strange… if you’ve got monitor_speed=115200 you should be good to go… for some reason it’s not being applied.

Hmmmm, I wonder, OK, I’ve had this happen to me a couple of times, I’ve had two “projects”/“folders” open (whatever you want to call a folder with code to do a certain job in), and then I confused the platformio.ini from one project with the project I was working on, so In effect I was changing the wrong baud rate, worth a double check I reckon.

1 Like

I don’t know what to tell everyone. Both the example project and the project I was working on now startup with the desired baud rate. I’ve changed no code or configuration files. The only thing that happened is some library package updates and a couple of reboots, but this computer reboots multiple times a day anyway so not sure how any of that would have any impact.

I’ve looked at git history and it shows no changes have occurred to either projects in the past few days since my last post.

I don’t know if VSCodium conducts updates on its own to itself, but that also shouldn’t be a problem or solution to this. Again, not sure what to make of this other than I’m happy it just works as it should. Thanks for anyone that looked into this and/or offered help!

2 Likes

As long as it works… that’s the important thing! :slight_smile: Would be nice to know what the culprit was in case it happens again… although if it happened again, it would probably be due to something else… Anyway… it works! :slight_smile:

1 Like