Windows 10: bluescreen on excessive Serial.prints

Just reporting.

IDE 2.3.4, different Projects, 2 Scenarios

1.) every second some text over a day or two => bluescreen
2.) Some init prints but the Uno oder esp32 stalls directly thereafter so the device reboots
and print its init messages again very quickly and loops endlessly.
bluescreen after less than 2 minutes maybe earlier - after some seconds.

I remember the error on the bluescreen reads : IRQL_NOT_LESS_OR_EQUAL

I think its a new problem because a half year ago or so i dont had any such problems with the ide.

edit:115kbit serial speed, 2 IDEs open, two devices attached but only one is printing/stalling

Hi @phunkz. Does the bluescreen occur if you upload this sketch to the board?:

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

void loop() {
  Serial.print("hello");
}

yes after five seconds or so.

OK, this is valuable information. Now please check to see if it occurs after you upload this sketch to the board:

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

void loop() {
  Serial.println("hello");
}

(note that I changed the Serial.print of the previous test sketch to Serial.println in this new variant)

I cant check it at the moment. I am developing other stuff and cant stop at the moment.
And everytime it hurts me while hoping that windows does not some harm to important structures.
But ive seen my "usual" stalls after println of init data as described as well.

And no - I've not seen any other stalls for a long time (some years i guess) except now when this ide prints lots of data. (No offense intended, just for description)

The reason I am asking about this is because there is a known bug that causes Arduino IDE hang when a huge quantity of data is printed to a single line in Serial Monitor, as is done by the first test sketch I provided:

This fault does not occur when when the any amount of data with reasonable line lengths are printed.

Although the bug report only mentions that the IDE becomes unresponsive, I believe that it also causes it to use an excessive amount of computing resources, and this might produce the conditions that cause the BSOD on your computer.

Even when the sketch code uses Serial.println, it is still possible for it to cause extremely long lines to be printed to Serial Monitor if the baud rate setting in Serial Monitor doesn't match the baud rate used by the sketch. In this case, the data is corrupted and so Serial Monitor doesn't recognize the line breaks in the received data so you can end up with a single long line of gibberish in Serial Monitor.

The Serial Monitor view is a tab in the bottom panel of the Arduino IDE window, and the bottom panel can also contain other tabbed views such as the "Output" view that opens whenever you compile or upload. So even when you aren't actively using Serial Monitor, you might still have it open and not notice it, and thus still be subject to the Serial Monitor bug I mentioned in my previous reply.

Hi @phunkz. I did a bit more research on the subject and I have an alternative hypothesis about the possible cause. And if this is the cause then there is a simple workaround.

I'll need some additional information in order to check my hypothesis. Please tell us which USB to serial bridge chip your Arduino board has. This is a black chip near the USB socket.

The chip will usually be identified by writing on the top. This might say something like "WCH CH340G" or "SILABS CP2102".

Examples:

WCH CH340

📷

SparkFun - CC BY-SA 4.0 (cropped)

Silicon Labs CP2102

CP2102

📷

SparkFun - CC BY-SA 4.0 (cropped)


If it isn't clear, alternatively you can provide the link to where you bought the board from and we'll see if we can determine the chip from the product listing.

Many thanks for your efforts!

The problem is there are two boards involved.

Yes i also think it could be an usb driver problem. But how to grab it?

  1. The first board is an esp 12e(or f, just unsure, but there is no profile for f in the ide) on a cheap 4x relais board. This has only a serial interface which is connected via a cheap "ebay" usb-bridge. A blue connector with some standard chip in it. I had some trouble to get it to work.

But the hello test runs on the second board.

  1. Is an aduino uno R3 with an micro-usb-port and CH340 (icant confirm if its a c or g but it look a little more like g.

These two communicate via i2c which i try to debug.

Even when the sketch code uses Serial.println, it is still possible for it to cause extremely long lines to be printed to Serial Monitor if the baud rate setting in Serial Monitor doesn't match the baud rate used by the sketch. In this case, the data is corrupted and so Serial Monitor doesn't recognize the line breaks in the received data so you can end up with a single long line of gibberish in Serial Monitor.

I know this but thats seem not the be the case.

The Serial Monitor view is a tab in the bottom panel of the Arduino IDE window, and the bottom panel can also contain other tabbed views such as the "Output" view that opens whenever you compile or upload. So even when you aren't actively using Serial Monitor, you might still have it open and not notice it, and thus still be subject to the Serial Monitor bug I mentioned in my previous reply.

At the moment all bsod happened when the ide was the active window and the serial monitor was visible. It dont know if happens it the serial monitor is (edit) hidden but i would guess so.

Your best bet might be Windows event viewer. I have no idea where in the event viewer I would search and I can't guarantee that it will reveal anything.

tried.

Now i know the exact time of the unexpected shutdown and when i stopped the crashdump.
Before the time only some unrelated warnings. Nothing regarding usb or so.

But thanks for the idea.

OK, thanks for the clarification. I'm going to ask you to provide some additional information that might help us to understand how to proceed.


:exclamation: This procedure is not intended to solve the problem. The purpose is to gather more information.


Please do this:

  1. Connect the UNO R3 board to your computer with a USB cable.
  2. Open the Windows Device Manager.
  3. Select View > Devices by type from the Device Manager menus.
  4. Open the "View" menu.
  5. If there is a to the left of the "Show hidden devices" menu item, click on "Show hidden devices" to disable it.
  6. Open the "Ports (COM & LPT)" section of the Device Manager tree.
  7. You should see a port identified as "USB-SERIAL CH340 (COMn)" under the "Ports (COM & LPT)" section (where "COMn" is some serial port e.g., COM4). Double click on that item.
    The "USB-SERIAL CH340 (COMn) Properties" dialog will open.
  8. Select the "Drivers" tab of the "USB-SERIAL CH340 (COMn) Properties" dialog.

Now please reply here on the forum thread to tell us the version number you saw after "Driver Version" field in that "USB-SERIAL CH340 (COMn) Properties" dialog.

Version: 3.9.2024.9

edit: the device is ch340 but the files on the driver details page are named 341...
CH341S64.SYS,
CH341PORTSA64.DLL,
CH341PTA64.DLL
CH341PT.DLL

We received a report that, after the recent CH340 driver update, printing large amounts of data to Serial Monitor causes a BSoD on Windows 10 machines:

You have verified that you are using the problematic driver version (3.9.2024.9). So it should be possible to work around the bug by installing an older version of the driver. I'll provide instructions you can follow to do that:

  1. Click the following link to download the previous version of the driver from the chip manufacturer's website:
    https://www.wch-ic.com/downloads/file/65.html?time=2023-03-16%2022:57:59
  2. Wait for the download to finish.
  3. Run the downloaded CH341SER.EXE file.
  4. A "User Account Control" dialog may now appear asking "Do you want to allow this app to make changes to your device?". Click the "Yes" button.
  5. A "DriverSetup(X64)" dialog will open. Click the "INSTALL" button in the dialog.
  6. Wait for the driver installation to finish, as indicated by the appearance of a "Driver install success!" dialog.
  7. Click the "OK" button in the "Driver install success!" dialog.
    The dialog will close.
  8. Click the X icon at the top right of the "DriverSetup(X64)" dialog
    The dialog will close.
  9. Close Arduino IDE if it is running.
  10. Connect the Arduino board to your computer with a USB cable.
  11. Open the Windows Device Manager.
  12. Select View > Devices by type from the Device Manager menus.
  13. Open the "View" menu.
  14. If there is a to the left of the "Show hidden devices" menu item, click on "Show hidden devices" to disable it.
  15. Open the "Ports (COM & LPT)" section of the Device Manager tree.
  16. You should see a port identified as "USB-SERIAL CH340 (COMn)" under the "Ports (COM & LPT)" section (where "COMn" is some serial port e.g., COM4). Double click on that item.
    The "USB-SERIAL CH340 (COMn) Properties" dialog will open.
  17. Select the "Driver" tab of the "USB-SERIAL CH340 (COMn) Properties" dialog.
  18. You will see a "Roll Back Driver" button in the dialog. If it is not clickable, perform the following instructions:
    1. Click the "Update driver" button.
      An "Update Drivers Device - USB-SERIAL CH340 (COMn)" dialog will open.
    2. Click on "Search automatically for drivers" in the "Update Drivers Device - USB-SERIAL CH340 (COMn)" dialog.
    3. You should now see the driver installation wizard update the driver. Wait for the update to finish, as indicated by the message "Windows has successfully updated your drivers" in the dialog.
      :exclamation: It is possible you will instead see the message "The best drivers are already installed". If so, please stop following the instructions here and reply on the forum thread to let me know. I'll provide alternative instructions you can follow.
    4. Click the "Close" button in the "Update Drivers Device - USB-SERIAL CH340 (COMn)" dialog.
      The dialog will close.
  19. Click the "Roll Back Driver" button in the "USB-SERIAL CH340 (COMn) Properties" dialog.
    The "Driver Package rollback" dialog will open.
  20. Click the radio button next to "My apps don't work with this driver" in the "Driver Package rollback" dialog .
  21. Click the "Yes" button.
    The "Driver Package rollback" dialog will close.
  22. Click the "Close" button in the "USB-SERIAL CH340 (COMn) Properties" dialog.

Now start Arduino IDE again and try the "hello" test sketch again. Hopefully this time the BSoD will not occur.

Please let us know whether that fix works for you. This information will be useful to the developers when investigating whether there a problem in the Arduino IDE Serial Monitor is a factor in this fault, and the information will allow us to more effectively support others who report being affected.

This is normal. The reason is that the driver supports both the CH340 and the CH341 and so WCH arbitrarily chose "341" to use in the filenames.

2 Likes

Nice job there with the procedure. 22 steps plus descriptions.

1 Like

It Worked!

Many, many thanks

I followed your instructions until he told me that the best drivers are already installed
Then i uninstalled the drivers using the same setup tool with its uninstall button. Which worked fine.
Then install again.
et voila!

Excessive printing of "hello" worked.
With and without line feed!

1 Like

From my experience, if you don't perform a "roll back" then Windows will later update the driver back to the problematic version once again and the problem will just come back. So keep this in mind and if the problem does come back then you can perform the instructions once again, this time making sure to follow them exactly.

Great news! Thanks for taking the time to post an update with your results. That is very valuable information.

1 Like

I will keep an eye on it.

Many thanks again.

1 Like

Addendum:

As you stated: shortly after beeing happy the failing driver has be reinstalled by windows and the Win 10 computer crashed again. But then (after reboot) it has been possible to rollback the driver. (The german option is called "Vorheriger Treiber") which seemed greyed out all the time, but now it was possible to click. Done, gave the reason and got the working driver back.

But yesterday it stalled again. After rebooting i saw the 2024 Driver but no chance to rollback. So i uninstalled it and installed the 2022 driver again. But i was suspicious and kept the driver dialog open.
I stopped working and put the pc to enery saving to resume work next day.

After waking up the driver was replaced again by the 2024 driver which the open dialog shows and rollback was possible.
I rolled back, gave the reason and got the 2022 driver back.
But...
is this an endless game? Do i get sometimes the buggy driver back with no other way then keeping the driver dialog open (which is updated while open) and an eye on it.
Can i remove it from the system finally and/or mark it as malicious?

Thanks in advance.

There's supposedly some way to prevent Win from updating drivers. Query your search-engine-of-choice for that.