Using serial comunication seems to freeze program

I have a problem with Serial communication between my laptop and nodemcuv3 that suddenly occurred. All programs I test on the nodemcu crash / freeze if they contain Serial.begin () and Serial.print (). I tried to run a simple program (see below) but it crashes / freezes immediately and the LED does not flash. I have the same problem with another nodemcuv2 but with an Arduino UNO it works without problems. I have also tested different baud rates but it makes no difference. I usually use platformio in vscode but I have also tested serial monitor in putty and it is the same problem. From the picture below it looks like the drivers are correctly installed, right?

I use this nodemcu board: https://www.electrokit.com/produkt/nodemcu-v3/ which uses CH340G drivers


image

Does anyone know what could be the issue?

Code i ran for testing:

#include <Arduino.h>

void setup() {

Serial.begin(115200);

}

void loop() {

Serial.println("test");

digitalWrite(16,HIGH);

delay(500);

digitalWrite(16,LOW);

delay(500);

}

What have you got connected to the board ?

Where did you obtain the CH340 device driver?

I have the usb connected btween my computer and the board, and the GPIO16 connected to blink the LED.

I tried to different drivers, One was named CH341SER and one was named CH340 (as in the picture of the original post) and none of them worked. The one that is currently installed i believe i got from this website

Do you have a current limiting resistor in that circuit?

Yes i do, 220 ohm

Why so many blank lines? Anyway...

[quote="fredagsmys, post:1, topic:1013260"]

void setup() {
Serial.begin(115200);
}

[/quote]

include

void setup() {
while (not Serial);
Serial.begin(115200);
}

I will try this, thanks!

I still get nothing in the serial monitor when i try it on the nodemcuv3 ):
However, when i tried the sketch i initially used on the nodemcuv2 (which uses CP2102 driver), it worked! (which it didn't previously).

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.