go-serial icon indicating copy to clipboard operation
go-serial copied to clipboard

Frequent reading and writing of the serial port causes a blue screen in the window

Open jinronga opened this issue 11 months ago • 3 comments

Describe the problem

Frequent reading and writing of the serial port causes a blue screen in the window 微信图片_20250114181437

To reproduce

Port interface: // Stores data received from the serial port into the provided byte array // buffer. The function returns the number of bytes read. // // The Read function blocks until (at least) one byte is received from // the serial port or an error occurs. Read(p []byte) (n int, err error)

// Send the content of the data byte array to the serial port.
// Returns the number of bytes written.
Write(p []byte) (n int, err error)

Please double-check that you have reported each of the following

before submitting the issue.

  • [X] I've provided the FULL source code that causes the problem
  • [X] I've provided all the actions required to reproduce the problem

Expected behavior

微信图片_20250114181437

Operating system and version

window11

Please describe your hardware setup

微信图片_20250114181437

Additional context

微信图片_20250114181437

Issue checklist

  • [X] I searched for previous requests in the issue tracker
  • [X] My request contains all necessary details

jinronga avatar Jan 14 '25 10:01 jinronga

Thanks for your report @jinronga!

Please provide the source code of a complete minimal Go program that produces the BSoD.

Please also tell us which version of the CH340 driver you have installed. You can find this information by the following procedure:

  1. Connect the device that produces the serial port you are using when the fault occurs to your computer.
  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 "Driver" tab of the "USB-SERIAL CH340 (COMn) Properties" dialog.

You will see the version in the "Driver Version" field of the dialog.

per1234 avatar Jan 14 '25 13:01 per1234

Hi @jinronga. We are still waiting for you to provide the information requested in my previous reply so that we can proceed with the investigation or evaluation of this bug.

per1234 avatar Mar 08 '25 14:03 per1234

The BSOD can only be caused by a bug in the kernel code (A.K.A. drivers). In the go-serial library we can only workaround the issue. As @per1234 already stated, a minimal example to reproduce the bug is essential.

cmaglie avatar Mar 18 '25 10:03 cmaglie