Windows 64 crash using USB serial example

Windows 64 bit crashes blue screen running the MaestroSerialExampleCWindows code

I am using the MaestroSerialExampleCWindows.sln example software to use a virtual port.
I am using window 7 64 BIT.
I have built this software with Microsoft visual studio express 2012.
I have the latest versions of the example code.
I have the latest USB driver.

I have this code sending position data to a Maestro 12 and I am reading a another serial port.
I have proven that the serial side is working and not causing this to crash

I have reduced the code so that I am only a few position messages to the Maestro per second sending messages to the virtual com port.
The Maestro control center talks to the card OK and the card is set to USB Dual port this appears to also operate with out crashing.

The modified example code has operated for sometime but eventually crashes resulting in a windows blue screen.

I have connected the USB cable directly to the PC

Given my PC set up and windows version and use of visual 2012 has any one else had issues like this.


I am sorry you are having trouble with your Maestro. A blue screen is pretty serious, and usually indicates that there is a bug in the Windows kernel or some driver running in kernel-mode. We do not provide any kernel-mode code for Windows, but our devices use usbser.sys, which is a part of Windows.

First of all, could you post a photo showing the blue screen? The error message there might contain important details.

Since you modified the example code, could you post the entire program here? You might be sending some unexpected data to the driver, triggering a bug that makes it crash.

To help debug this, you should try to make it fail frequently and reliably. If you change the code to send messages as fast as possible instead of a few times per second, does that make your computer crash sooner?

Could you explain more about your system? What is the other serial port and what is it connected to? What is the “serial side” and how did you prove it is not causing the crash?



Here is the code I am running which has reduced communications to the Maestro card.

The crash does not seem to occur with more writes to the Maestro card.

I proved the normal serial port operation was not a problem by removing all Maestro messages and just left the serial messages running for several hours and it did not crash.

[code]int main(int argc, char * argv)
HANDLE port;
HANDLE portA3100;
char * portName;
char * portNameA3100;
int baudRate;
int baudRateA3100;
BOOL success = 0;
// unsigned short target, position;
// short target, position;
short position;
static short target, oldTarget;
float ReqRateAz, ReqRateEl;
char KeyEntry = 0;

position = 0;
target = 0;
oldTarget = 0;

/* portName should be the name of the Maestro's Command Port (e.g. "COM4")
 * as shown in your computer's Device Manager.
 * Alternatively you can use \\.\USBSER000 to specify the first virtual COM
 * port that uses the usbser.sys driver.  This will usually be the Maestro's
 * command port. */
portName = "\\\\.\\USBSER000";  // Each double slash in this source code represents one slash in the actual name.
/* Choose the baud rate (bits per second).
 * If the Maestro's serial mode is USB Dual Port, this number does not matter. */
baudRate = 9600;
/* Open the Maestro's serial port. */
port = openPort(portName, baudRate);
if (port == INVALID_HANDLE_VALUE){ return -1; }

portNameA3100 = "COM8";  // Each double slash in this source code represents one slash in the actual name.
baudRateA3100 = 115200;
/* Open the A3000 serial port. */
portA3100 = openPort(portNameA3100, baudRateA3100);
if (portA3100 == INVALID_HANDLE_VALUE){ return -1; }

	if (_kbhit())
		KeyEntry = _getch();
		printf ("key pressed is %c \n",KeyEntry); 
	if (KeyEntry == 'b')
		printf ("break"); 

	if (KeyEntry == 'r')

		/* Get the current position of channel 0. */

// this was removed to reduce traffic
// success = maestroGetPosition(port, 0, &position);
// if (!success){ return -1; }
// printf(“Current position is %d.\n”, position);

		if ((ReqRateAz) < 1 && (ReqRateAz) > -1)
			target = 6160;
			target = 5000;

		int i;
		for (i = 0; i < 1000000; i++); 

		/* Set the target of channel 0. */

		if (target != oldTarget)
			oldTarget = target;
			success = maestroSetTarget(port, 0, target);
			printf("Sending to servo Setting target to %d POs from 0 = %d\n", target, target- 6160);


/* Close the serial port so other programs can use it.
 * Alternatively, you can just terminate the process (return from main). */

return 0;



I put your code inside [code] and [/code ] tags (without the space) to make it more readable, and it would be good if you did that in the future posts with code. Assuming that you did not modify the openPort, closeHandle, or maestroSetTarget functions, I do not see anything wrong with the code.

Thanks for the photo. IRP stands for “I/O Request Packet”. My understanding is that when you read or write something from a serial port, an IRP would be generated to represent that request. Of course there are other IRPs happening too. It seems like two different device drivers on your system are claiming to complete the same IRP. Microsoft has a nice description of the MULTIPLE_IRP_COMPLETE_REQUESTS error you are seeing.

Could you explain more about your system? What is COM8 and what is it connected to? What is the A3100? My searches for that term bring up two different devices.

I see that you are not actually reading or writing anything from that second port. If you remove the code for that, does the blue screen still happen?

I suspect you might have a third-party driver installed that is acting as a filter driver for the Maestro and causing problems. Could you check to see what drivers are being used for your serial ports and the Maestro? Please go to the Device Manager and select View -> Devices by Connection. This puts the Device Manager into a mode that is harder to use but reveals more about how your hardware works. If you expand enough categories you should be able to find three entries whose names start with “Pololu Mini Maestro 18-Channel USB Servo Controller”. I would like to know what drivers are being used for each of those devices, and any ancestor devices. For example, you should see a “USB Composite Device” which is the direct parent of the three Maestro devices, and it would be good to know what drivers are being used for that one. The parent of the USB Composite Device should be some kind of USB hub device, and it would be good to know what drivers that one is using too, and so on. It would also be good to do the same thing for COM8.

To see the drivers for a particular device, you can double-click on it, go to the Driver tab, and then click “Driver Details”.