Exception while reading usb GPS receiver

I have been experiencing a random exception in a GPS application I am working on. The exception is within GHIElectronics.NETMF.USBHost.USBH_SerialUSB.

The applications is running on a FEZ Domino. The GPS receiver is a Pharos 500, which I purchased with Microsoft Streets and Maps 2008.

The exception occurs at random times, and by catching the expection and ignoring it processing continues normally, with what appears to be no loss of data.

It has occurred seven times in an eleven hour period. Most of the time the exceptions were two to three hours apart, but once it cccured twice within a second.

  • The application contains three class libraries(DLL) and the main program.
  • COM1 is being used to communicate to a Sparkfun serial lcd.
  • A component shield is used, with one button and two leds connected.
  • During execution, one led is toggled each time a gps sentence is received.
  • Three gps sentences arrive each second.
  • The application runs with three threads, including the main thread.
  • GC occurs occurs about once an hour. Memory usage is not growing.

The code to initialize the usb serial port follows:


private static void OnDeviceConnected(USBH_Device device)
{
	switch (device.TYPE)
	{
		default:
			//Debug.Print("Unknown device");
			USBH_Device unDevice = new USBH_Device(
					device.ID, device.INTERFACE_INDEX, USBH_DeviceType.Serial_Prolific,
					device.VENDOR_ID, device.PRODUCT_ID, device.PORT_NUMBER);

			serial = new USBH_SerialUSB(unDevice, 4800, Parity.None, 8, StopBits.One);

			processThread = new Thread(GPSProcessingThread);
			processThread.Start();
			readThread = new Thread(GPSReadThread);
			readThread.Start();
			break;
                   }
}

The code to read the usb serial port follows:


 private static void GPSReadThread()
{
	serial.ReadTimeout = 20;
	serial.Open();

	while (true)
	{
		GPSBuffer buffer = queueManager.GetFreeBuffer();
		if (buffer == null)
		{
			Debug.Print("GPS buffer shortage");
			Thread.Sleep(0);
			continue;
		}

		while (true)
		{
			try
			{
				// *** EXCEPTION OCCURS ON THE FOLLOWING INSTRUCTION
				int bytesRead = serial.Read(buffer.Buffer, 0, buffer.Length);
				if (bytesRead == 0)
					continue;
				buffer.BytesRead = bytesRead;
				break;
			}
			catch (Exception ex)
			{
				Debug.Print("==============================");
				Debug.Print(DateTime.Now.ToString());
				Debug.Print(ex.Message);
				Debug.Print(ex.StackTrace);
				if (ex.InnerException != null)
				{
					Debug.Print("Inner Exception: " + ex.InnerException.Message);
				}
			}
		}

		queueManager.QueueBuffer(buffer);
	}
}

The exception is as follows:

Exception System.Exception - 0xffffffff (5)

GHIElectronics.NETMF.USBHost.USBH_SerialUSB::Read_Helper [IP: 0000]

GHIElectronics.NETMF.USBHost.USBH_SerialUSB::Read [IP: 001a]

GPSTest.Program::GPSReadThread [IP: 004b]

A first chance exception of type ‘System.Exception’ occurred in GHIElectronics.NETMF.USBHost.dll

The Output log for the entire test period follows . The entire log was included because there sometimes seems to be a relationship between the exception and GC.


'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files\Microsoft .NET Micro Framework\v4.0\Assemblies\mscorlib.dll'
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files\Microsoft .NET Micro Framework\v4.0\Assemblies\Microsoft.SPOT.Native.dll'
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files\Microsoft .NET Micro Framework\v4.0\Assemblies\Microsoft.SPOT.Hardware.dll'
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files\GHI Electronics\GHI NETMF v4.0 SDK\Assemblies\GHIElectronics.NETMF.System.dll'
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files\GHI Electronics\GHI NETMF v4.0 SDK\Assemblies\GHIElectronics.NETMF.USBHost.dll'
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files\GHI Electronics\GHI NETMF v4.0 SDK\Assemblies\GHIElectronics.NETMF.Hardware.dll'
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'D:\FEZ_Projects\GPSTest\StringExLibrary\bin\Debug\StringExLibrary.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'D:\FEZ_Projects\GPSTest\GPSLibrary\bin\Debug\GPSLibrary.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files\Microsoft .NET Micro Framework\v4.0\Assemblies\Microsoft.SPOT.IO.dll'
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files\Microsoft .NET Micro Framework\v4.0\Assemblies\System.IO.dll'
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'D:\FEZ_Projects\GPSTest\SF_LCD_Library\bin\Debug\SF_LCD_Library.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files\GHI Electronics\GHI NETMF v4.0 SDK\Assemblies\FEZDomino_GHIElectronics.NETMF.FEZ.dll'
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files\Microsoft .NET Micro Framework\v4.0\Assemblies\Microsoft.SPOT.Hardware.SerialPort.dll'
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'D:\FEZ_Projects\GPSTest\GPSTest\bin\Debug\GPSTest.exe', Symbols loaded.
The thread 0x2 has exited with code 0 (0x0).
Start: 05/31/2010 01:50:50
GC: 3msec 29148 bytes used, 35232 bytes available
Type 0F (STRING              ):    228 bytes
Type 11 (CLASS               ):   5196 bytes
Type 12 (VALUETYPE           ):     60 bytes
Type 13 (SZARRAY             ):   2304 bytes
Type 15 (FREEBLOCK           ):  35232 bytes
Type 17 (ASSEMBLY            ):  14700 bytes
Type 18 (WEAKCLASS           ):     48 bytes
Type 1B (DELEGATE_HEAD       ):    612 bytes
Type 1C (DELEGATELIST_HEAD   ):    108 bytes
Type 1D (OBJECT_TO_EVENT     ):    264 bytes
Type 1E (BINARY_BLOB_HEAD    ):    252 bytes
Type 1F (THREAD              ):   1536 bytes
Type 20 (SUBTHREAD           ):    192 bytes
Type 21 (STACK_FRAME         ):   1752 bytes
Type 26 (WAIT_FOR_OBJECT_HEAD):     48 bytes
Type 27 (FINALIZER_HEAD      ):    216 bytes
Type 31 (IO_PORT             ):    252 bytes
Type 34 (APPDOMAIN_HEAD      ):     72 bytes
Type 36 (APPDOMAIN_ASSEMBLY  ):   1308 bytes
GC: 5msec 29148 bytes used, 35232 bytes available
Type 0F (STRING              ):    228 bytes
Type 11 (CLASS               ):   5196 bytes
Type 12 (VALUETYPE           ):     60 bytes
Type 13 (SZARRAY             ):   2304 bytes
Type 15 (FREEBLOCK           ):  35232 bytes
Type 17 (ASSEMBLY            ):  14700 bytes
Type 18 (WEAKCLASS           ):     48 bytes
Type 1B (DELEGATE_HEAD       ):    612 bytes
Type 1C (DELEGATELIST_HEAD   ):    108 bytes
Type 1D (OBJECT_TO_EVENT     ):    264 bytes
Type 1E (BINARY_BLOB_HEAD    ):    252 bytes
Type 1F (THREAD              ):   1536 bytes
Type 20 (SUBTHREAD           ):    192 bytes
Type 21 (STACK_FRAME         ):   1752 bytes
Type 26 (WAIT_FOR_OBJECT_HEAD):     48 bytes
Type 27 (FINALIZER_HEAD      ):    216 bytes
Type 31 (IO_PORT             ):    252 bytes
Type 34 (APPDOMAIN_HEAD      ):     72 bytes
Type 36 (APPDOMAIN_ASSEMBLY  ):   1308 bytes
GC: 5msec 29148 bytes used, 35232 bytes available
Type 0F (STRING              ):    228 bytes
Type 11 (CLASS               ):   5196 bytes
Type 12 (VALUETYPE           ):     60 bytes
Type 13 (SZARRAY             ):   2304 bytes
Type 15 (FREEBLOCK           ):  35232 bytes
Type 17 (ASSEMBLY            ):  14700 bytes
Type 18 (WEAKCLASS           ):     48 bytes
Type 1B (DELEGATE_HEAD       ):    612 bytes
Type 1C (DELEGATELIST_HEAD   ):    108 bytes
Type 1D (OBJECT_TO_EVENT     ):    264 bytes
Type 1E (BINARY_BLOB_HEAD    ):    252 bytes
Type 1F (THREAD              ):   1536 bytes
Type 20 (SUBTHREAD           ):    192 bytes
Type 21 (STACK_FRAME         ):   1752 bytes
Type 26 (WAIT_FOR_OBJECT_HEAD):     48 bytes
Type 27 (FINALIZER_HEAD      ):    216 bytes
Type 31 (IO_PORT             ):    252 bytes
Type 34 (APPDOMAIN_HEAD      ):     72 bytes
Type 36 (APPDOMAIN_ASSEMBLY  ):   1308 bytes
    #### Exception System.Exception - 0xffffffff (5) ####
    #### GHIElectronics.NETMF.USBHost.USBH_SerialUSB::Read_Helper [IP: 0000] ####
    #### GHIElectronics.NETMF.USBHost.USBH_SerialUSB::Read [IP: 001a] ####
    #### GPSTest.Program::GPSReadThread [IP: 004b] ####
A first chance exception of type 'System.Exception' occurred in GHIElectronics.NETMF.USBHost.dll
==============================
05/31/2010 04:11:08
Exception was thrown: System.Exception
GHIElectronics.NETMF.USBHost.USBH_SerialUSB::Read_Helper
GHIElectronics.NETMF.USBHost.USBH_SerialUSB::Read
GPSTest.Program::GPSReadThread

GC: 4msec 29256 bytes used, 35124 bytes available
Type 0F (STRING              ):    228 bytes
Type 11 (CLASS               ):   5256 bytes
Type 12 (VALUETYPE           ):     60 bytes
Type 13 (SZARRAY             ):   2352 bytes
Type 15 (FREEBLOCK           ):  35124 bytes
Type 17 (ASSEMBLY            ):  14700 bytes
Type 18 (WEAKCLASS           ):     48 bytes
Type 1B (DELEGATE_HEAD       ):    612 bytes
Type 1C (DELEGATELIST_HEAD   ):    108 bytes
Type 1D (OBJECT_TO_EVENT     ):    264 bytes
Type 1E (BINARY_BLOB_HEAD    ):    252 bytes
Type 1F (THREAD              ):   1536 bytes
Type 20 (SUBTHREAD           ):    192 bytes
Type 21 (STACK_FRAME         ):   1752 bytes
Type 26 (WAIT_FOR_OBJECT_HEAD):     48 bytes
Type 27 (FINALIZER_HEAD      ):    216 bytes
Type 31 (IO_PORT             ):    252 bytes
Type 34 (APPDOMAIN_HEAD      ):     72 bytes
Type 36 (APPDOMAIN_ASSEMBLY  ):   1308 bytes
GC: 5msec 29256 bytes used, 35124 bytes available
Type 0F (STRING              ):    228 bytes
Type 11 (CLASS               ):   5256 bytes
Type 12 (VALUETYPE           ):     60 bytes
Type 13 (SZARRAY             ):   2352 bytes
Type 15 (FREEBLOCK           ):  35124 bytes
Type 17 (ASSEMBLY            ):  14700 bytes
Type 18 (WEAKCLASS           ):     48 bytes
Type 1B (DELEGATE_HEAD       ):    612 bytes
Type 1C (DELEGATELIST_HEAD   ):    108 bytes
Type 1D (OBJECT_TO_EVENT     ):    264 bytes
Type 1E (BINARY_BLOB_HEAD    ):    252 bytes
Type 1F (THREAD              ):   1536 bytes
Type 20 (SUBTHREAD           ):    192 bytes
Type 21 (STACK_FRAME         ):   1752 bytes
Type 26 (WAIT_FOR_OBJECT_HEAD):     48 bytes
Type 27 (FINALIZER_HEAD      ):    216 bytes
Type 31 (IO_PORT             ):    252 bytes
Type 34 (APPDOMAIN_HEAD      ):     72 bytes
Type 36 (APPDOMAIN_ASSEMBLY  ):   1308 bytes
GC: 5msec 29256 bytes used, 35124 bytes available
Type 0F (STRING              ):    228 bytes
Type 11 (CLASS               ):   5256 bytes
Type 12 (VALUETYPE           ):     60 bytes
Type 13 (SZARRAY             ):   2352 bytes
Type 15 (FREEBLOCK           ):  35124 bytes
Type 17 (ASSEMBLY            ):  14700 bytes
Type 18 (WEAKCLASS           ):     48 bytes
Type 1B (DELEGATE_HEAD       ):    612 bytes
Type 1C (DELEGATELIST_HEAD   ):    108 bytes
Type 1D (OBJECT_TO_EVENT     ):    264 bytes
Type 1E (BINARY_BLOB_HEAD    ):    252 bytes
Type 1F (THREAD              ):   1536 bytes
Type 20 (SUBTHREAD           ):    192 bytes
Type 21 (STACK_FRAME         ):   1752 bytes
Type 26 (WAIT_FOR_OBJECT_HEAD):     48 bytes
Type 27 (FINALIZER_HEAD      ):    216 bytes
Type 31 (IO_PORT             ):    252 bytes
Type 34 (APPDOMAIN_HEAD      ):     72 bytes
Type 36 (APPDOMAIN_ASSEMBLY  ):   1308 bytes
    #### Exception System.Exception - 0xffffffff (5) ####
    #### GHIElectronics.NETMF.USBHost.USBH_SerialUSB::Read_Helper [IP: 0000] ####
    #### GHIElectronics.NETMF.USBHost.USBH_SerialUSB::Read [IP: 001a] ####
    #### GPSTest.Program::GPSReadThread [IP: 004b] ####
A first chance exception of type 'System.Exception' occurred in GHIElectronics.NETMF.USBHost.dll
Type 0F (STRING              ):    228 bytes
Type 11 (CLASS               ):   5316 bytes
Type 12 (VALUETYPE           ):     60 bytes
Type 13 (SZARRAY             ):   2400 bytes
Type 15 (FREEBLOCK           ):  33000 bytes
Type 17 (ASSEMBLY            ):  14700 bytes
Type 18 (WEAKCLASS           ):     48 bytes
Type 1B (DELEGATE_HEAD       ):    612 bytes
Type 1C (DELEGATELIST_HEAD   ):    108 bytes
Type 1D (OBJECT_TO_EVENT     ):    264 bytes
Type 1E (BINARY_BLOB_HEAD    ):   2064 bytes
Type 1F (THREAD              ):   1536 bytes
Type 20 (SUBTHREAD           ):    192 bytes
Type 21 (STACK_FRAME         ):   1956 bytes
Type 26 (WAIT_FOR_OBJECT_HEAD):     48 bytes
Type 27 (FINALIZER_HEAD      ):    216 bytes
Type 31 (IO_PORT             ):    252 bytes
Type 34 (APPDOMAIN_HEAD      ):     72 bytes
Type 36 (APPDOMAIN_ASSEMBLY  ):   1308 bytes
==============================
05/31/2010 06:42:57
Exception was thrown: System.Exception
GHIElectronics.NETMF.USBHost.USBH_SerialUSB::Read_Helper
GHIElectronics.NETMF.USBHost.USBH_SerialUSB::Read
GPSTest.Program::GPSReadThread

    #### Exception System.Exception - 0xffffffff (5) ####
    #### GHIElectronics.NETMF.USBHost.USBH_SerialUSB::Read_Helper [IP: 0000] ####
    #### GHIElectronics.NETMF.USBHost.USBH_SerialUSB::Read [IP: 001a] ####
    #### GPSTest.Program::GPSReadThread [IP: 004b] ####
A first chance exception of type 'System.Exception' occurred in GHIElectronics.NETMF.USBHost.dll
==============================
05/31/2010 06:44:57
Exception was thrown: System.Exception
GHIElectronics.NETMF.USBHost.USBH_SerialUSB::Read_Helper
GHIElectronics.NETMF.USBHost.USBH_SerialUSB::Read
GPSTest.Program::GPSReadThread

GC: 4msec 29256 bytes used, 35124 bytes available
Type 0F (STRING              ):    228 bytes
Type 11 (CLASS               ):   5256 bytes
Type 12 (VALUETYPE           ):     60 bytes
Type 13 (SZARRAY             ):   2352 bytes
Type 15 (FREEBLOCK           ):  35124 bytes
Type 17 (ASSEMBLY            ):  14700 bytes
Type 18 (WEAKCLASS           ):     48 bytes
Type 1B (DELEGATE_HEAD       ):    612 bytes
Type 1C (DELEGATELIST_HEAD   ):    108 bytes
Type 1D (OBJECT_TO_EVENT     ):    264 bytes
Type 1E (BINARY_BLOB_HEAD    ):    252 bytes
Type 1F (THREAD              ):   1536 bytes
Type 20 (SUBTHREAD           ):    192 bytes
Type 21 (STACK_FRAME         ):   1752 bytes
Type 26 (WAIT_FOR_OBJECT_HEAD):     48 bytes
Type 27 (FINALIZER_HEAD      ):    216 bytes
Type 31 (IO_PORT             ):    252 bytes
Type 34 (APPDOMAIN_HEAD      ):     72 bytes
Type 36 (APPDOMAIN_ASSEMBLY  ):   1308 bytes
    #### Exception System.Exception - 0xffffffff (5) ####
    #### GHIElectronics.NETMF.USBHost.USBH_SerialUSB::Read_Helper [IP: 0000] ####
    #### GHIElectronics.NETMF.USBHost.USBH_SerialUSB::Read [IP: 001a] ####
    #### GPSTest.Program::GPSReadThread [IP: 004b] ####
A first chance exception of type 'System.Exception' occurred in GHIElectronics.NETMF.USBHost.dll
Type 0F (STRING              ):    228 bytes
Type 11 (CLASS               ):   5316 bytes
Type 12 (VALUETYPE           ):     60 bytes
Type 13 (SZARRAY             ):   2400 bytes
Type 15 (FREEBLOCK           ):  33552 bytes
Type 17 (ASSEMBLY            ):  14700 bytes
Type 18 (WEAKCLASS           ):     48 bytes
Type 1B (DELEGATE_HEAD       ):    612 bytes
Type 1C (DELEGATELIST_HEAD   ):    108 bytes
Type 1D (OBJECT_TO_EVENT     ):    264 bytes
Type 1E (BINARY_BLOB_HEAD    ):   1512 bytes
Type 1F (THREAD              ):   1536 bytes
Type 20 (SUBTHREAD           ):    192 bytes
Type 21 (STACK_FRAME         ):   1956 bytes
Type 26 (WAIT_FOR_OBJECT_HEAD):     48 bytes
Type 27 (FINALIZER_HEAD      ):    216 bytes
Type 31 (IO_PORT             ):    252 bytes
Type 34 (APPDOMAIN_HEAD      ):     72 bytes
Type 36 (APPDOMAIN_ASSEMBLY  ):   1308 bytes
==============================
05/31/2010 08:04:03
Exception was thrown: System.Exception
GHIElectronics.NETMF.USBHost.USBH_SerialUSB::Read_Helper
GHIElectronics.NETMF.USBHost.USBH_SerialUSB::Read
GPSTest.Program::GPSReadThread

GC: 4msec 29256 bytes used, 35124 bytes available
Type 0F (STRING              ):    228 bytes
Type 11 (CLASS               ):   5256 bytes
Type 12 (VALUETYPE           ):     60 bytes
Type 13 (SZARRAY             ):   2352 bytes
Type 15 (FREEBLOCK           ):  35124 bytes
Type 17 (ASSEMBLY            ):  14700 bytes
Type 18 (WEAKCLASS           ):     48 bytes
Type 1B (DELEGATE_HEAD       ):    612 bytes
Type 1C (DELEGATELIST_HEAD   ):    108 bytes
Type 1D (OBJECT_TO_EVENT     ):    264 bytes
Type 1E (BINARY_BLOB_HEAD    ):    252 bytes
Type 1F (THREAD              ):   1536 bytes
Type 20 (SUBTHREAD           ):    192 bytes
Type 21 (STACK_FRAME         ):   1752 bytes
Type 26 (WAIT_FOR_OBJECT_HEAD):     48 bytes
Type 27 (FINALIZER_HEAD      ):    216 bytes
Type 31 (IO_PORT             ):    252 bytes
Type 34 (APPDOMAIN_HEAD      ):     72 bytes
Type 36 (APPDOMAIN_ASSEMBLY  ):   1308 bytes
    #### Exception System.Exception - 0xffffffff (5) ####
    #### GHIElectronics.NETMF.USBHost.USBH_SerialUSB::Read_Helper [IP: 0000] ####
    #### GHIElectronics.NETMF.USBHost.USBH_SerialUSB::Read [IP: 001a] ####
    #### GPSTest.Program::GPSReadThread [IP: 004b] ####
A first chance exception of type 'System.Exception' occurred in GHIElectronics.NETMF.USBHost.dll
==============================
05/31/2010 08:44:35
Exception was thrown: System.Exception
GHIElectronics.NETMF.USBHost.USBH_SerialUSB::Read_Helper
GHIElectronics.NETMF.USBHost.USBH_SerialUSB::Read
GPSTest.Program::GPSReadThread

    #### Exception System.Exception - 0xffffffff (5) ####
    #### GHIElectronics.NETMF.USBHost.USBH_SerialUSB::Read_Helper [IP: 0000] ####
    #### GHIElectronics.NETMF.USBHost.USBH_SerialUSB::Read [IP: 001a] ####
    #### GPSTest.Program::GPSReadThread [IP: 004b] ####
A first chance exception of type 'System.Exception' occurred in GHIElectronics.NETMF.USBHost.dll
==============================
05/31/2010 08:44:35
Exception was thrown: System.Exception
GHIElectronics.NETMF.USBHost.USBH_SerialUSB::Read_Helper
GHIElectronics.NETMF.USBHost.USBH_SerialUSB::Read
GPSTest.Program::GPSReadThread

GC: 4msec 29256 bytes used, 35124 bytes available
Type 0F (STRING              ):    228 bytes
Type 11 (CLASS               ):   5256 bytes
Type 12 (VALUETYPE           ):     60 bytes
Type 13 (SZARRAY             ):   2352 bytes
Type 15 (FREEBLOCK           ):  35124 bytes
Type 17 (ASSEMBLY            ):  14700 bytes
Type 18 (WEAKCLASS           ):     48 bytes
Type 1B (DELEGATE_HEAD       ):    612 bytes
Type 1C (DELEGATELIST_HEAD   ):    108 bytes
Type 1D (OBJECT_TO_EVENT     ):    264 bytes
Type 1E (BINARY_BLOB_HEAD    ):    252 bytes
Type 1F (THREAD              ):   1536 bytes
Type 20 (SUBTHREAD           ):    192 bytes
Type 21 (STACK_FRAME         ):   1752 bytes
Type 26 (WAIT_FOR_OBJECT_HEAD):     48 bytes
Type 27 (FINALIZER_HEAD      ):    216 bytes
Type 31 (IO_PORT             ):    252 bytes
Type 34 (APPDOMAIN_HEAD      ):     72 bytes
Type 36 (APPDOMAIN_ASSEMBLY  ):   1308 bytes
GC: 5msec 29208 bytes used, 35172 bytes available
Type 0F (STRING              ):    228 bytes
Type 11 (CLASS               ):   5256 bytes
Type 12 (VALUETYPE           ):     60 bytes
Type 13 (SZARRAY             ):   2352 bytes
Type 15 (FREEBLOCK           ):  35172 bytes
Type 17 (ASSEMBLY            ):  14700 bytes
Type 18 (WEAKCLASS           ):     48 bytes
Type 1B (DELEGATE_HEAD       ):    612 bytes
Type 1C (DELEGATELIST_HEAD   ):    108 bytes
Type 1D (OBJECT_TO_EVENT     ):    264 bytes
Type 1E (BINARY_BLOB_HEAD    ):    252 bytes
Type 1F (THREAD              ):   1536 bytes
Type 20 (SUBTHREAD           ):    192 bytes
Type 21 (STACK_FRAME         ):   1752 bytes
Type 27 (FINALIZER_HEAD      ):    216 bytes
Type 31 (IO_PORT             ):    252 bytes
Type 34 (APPDOMAIN_HEAD      ):     72 bytes
Type 36 (APPDOMAIN_ASSEMBLY  ):   1308 bytes
GC: 5msec 29208 bytes used, 35172 bytes available
Type 0F (STRING              ):    228 bytes
Type 11 (CLASS               ):   5256 bytes
Type 12 (VALUETYPE           ):     60 bytes
Type 13 (SZARRAY             ):   2352 bytes
Type 15 (FREEBLOCK           ):  35172 bytes
Type 17 (ASSEMBLY            ):  14700 bytes
Type 18 (WEAKCLASS           ):     48 bytes
Type 1B (DELEGATE_HEAD       ):    612 bytes
Type 1C (DELEGATELIST_HEAD   ):    108 bytes
Type 1D (OBJECT_TO_EVENT     ):    264 bytes
Type 1E (BINARY_BLOB_HEAD    ):    252 bytes
Type 1F (THREAD              ):   1536 bytes
Type 20 (SUBTHREAD           ):    192 bytes
Type 21 (STACK_FRAME         ):   1752 bytes
Type 27 (FINALIZER_HEAD      ):    216 bytes
Type 31 (IO_PORT             ):    252 bytes
Type 34 (APPDOMAIN_HEAD      ):     72 bytes
Type 36 (APPDOMAIN_ASSEMBLY  ):   1308 bytes
GC: 5msec 29208 bytes used, 35172 bytes available
Type 0F (STRING              ):    228 bytes
Type 11 (CLASS               ):   5256 bytes
Type 12 (VALUETYPE           ):     60 bytes
Type 13 (SZARRAY             ):   2352 bytes
Type 15 (FREEBLOCK           ):  35172 bytes
Type 17 (ASSEMBLY            ):  14700 bytes
Type 18 (WEAKCLASS           ):     48 bytes
Type 1B (DELEGATE_HEAD       ):    612 bytes
Type 1C (DELEGATELIST_HEAD   ):    108 bytes
Type 1D (OBJECT_TO_EVENT     ):    264 bytes
Type 1E (BINARY_BLOB_HEAD    ):    252 bytes
Type 1F (THREAD              ):   1536 bytes
Type 20 (SUBTHREAD           ):    192 bytes
Type 21 (STACK_FRAME         ):   1752 bytes
Type 27 (FINALIZER_HEAD      ):    216 bytes
Type 31 (IO_PORT             ):    252 bytes
Type 34 (APPDOMAIN_HEAD      ):     72 bytes
Type 36 (APPDOMAIN_ASSEMBLY  ):   1308 bytes
GC: 5msec 29208 bytes used, 35172 bytes available
Type 0F (STRING              ):    228 bytes
Type 11 (CLASS               ):   5256 bytes
Type 12 (VALUETYPE           ):     60 bytes
Type 13 (SZARRAY             ):   2352 bytes
Type 15 (FREEBLOCK           ):  35172 bytes
Type 17 (ASSEMBLY            ):  14700 bytes
Type 18 (WEAKCLASS           ):     48 bytes
Type 1B (DELEGATE_HEAD       ):    612 bytes
Type 1C (DELEGATELIST_HEAD   ):    108 bytes
Type 1D (OBJECT_TO_EVENT     ):    264 bytes
Type 1E (BINARY_BLOB_HEAD    ):    252 bytes
Type 1F (THREAD              ):   1536 bytes
Type 20 (SUBTHREAD           ):    192 bytes
Type 21 (STACK_FRAME         ):   1752 bytes
Type 27 (FINALIZER_HEAD      ):    216 bytes
Type 31 (IO_PORT             ):    252 bytes
Type 34 (APPDOMAIN_HEAD      ):     72 bytes
Type 36 (APPDOMAIN_ASSEMBLY  ):   1308 bytes

Any idea what is happening?

Do you have the latest firmware and SDK? There was an issue fixed in the recent version that had to do with the way the USB to Serial controller was detected.

Yes, I am running the latest SDK. :smiley:

The problem that was fixed in the latest SDK was related to software saying a usb device was FTDI when it actually didn’t recognize what it was. I had to fix my code when after I installed the SDK.

Is this prolific or FTDI?

Opening as USBH_DeviceType.Serial_Prolific.

No being recognized as FTDI.

When you get an exception, please print USBHostController.GetLastError().

OK. I will set it up with a USBHostController.GetLastError() in the catch code and run a test overnight.

Didn’t take too long to get an exception.

The error code was : 268435459

According to the documentation :

“Transfer error. USB packet might be dropped. Make sure you have enough power for the USB device and connections are stable.”

I am running of a Dell PC. Attached to the Domino is a serial lcd which draws 40ma @ 5V max, two leds, of which one is flashing @ 1hz, a button and aPharos 500 GPS receiver. I am running directly off the pc without a hub.

I think the max usb current draw is 400ma? I don’t know how much current the Domino will deliver via the 5V bus. I wouldn’t think I am having a power issue.

I have a 9V Dc wall plug which I could use to power the Domino if you think it might be a power issue.

Actually, I don’t have any problem with an occasional expection since the program recovers.

That sounds like a lot of stuff. Try the 9V brick.

Also, 40Ma max is probably without the backlight. I have a 20X4 LCD and it consumes a lot more than that, IIRC.

Try this simple test. Make a small program that only reds GPS data as fast as possible. Do not parse any data, just read it. Do you get an exception? Also try to to use an external power source instead of relying on the USB power. Since we are not sure, it helps to try random things

I wanted to follow up on the exception I had reported earlier.

It is difficult to test because the exception has not been happening as often as it was earlier.

I built a program with just the core of the application. It just read the serial port and does not processing. It ran for eight hours without any problems.

I had a run of the application with an external power cube, and got an error after a few hours.

I just made a run of eight hours, on usb power, with the application processing messages but not printing the message with Debug.Print() as it was before. After eight hours there was one exception.

From experience, this will be a very hard problem to characterize.

I did notice that when I pull out the gps cable while the program is running I get the same exception.

I am able to handle the cable being pulled and reinserted . The program recognizes the disconnect and then the reconnect.

I suspect there might be something flakey in the gps receiver. Does the driver do any retries on bad reads before declaring an expection?

Bottom line… I can live with the exception since I can recover. Not worth spending more time on the issue. Thanks for the assistance

The USB driver doesn’t do any retries. If it sees an error, it passes it on to you.