http://forums.netdui...b-connectivity/
In order to isolate the problem, I wrote the simple program appended below to output via USB Debug and also COM2 to simulate a Debug.Print via serial. It writes the output every 10 sec.; forever. I ran two trials, one with USB and serial and one without USB:
First Case Run Conditions:
==========================
External power to Netduino Plus
MFDeploy connected to Netduino via USB (Target --> connect)
Netduino connected to PC terminal via COM2
Ethernet unplugged
Last Output before Netduino stops output on both USB and serial (needs reset to get going again)
-------------------------------------------------------------------------------------------------------
MFDeploy:
hello from (Debug.Print) --> timer:Duration 01:05:50.0006186
PC Terminal:COM9
hello from D in Main --> timer:Duration 01:05:50.0006186
hello From Print in TestClass --> timer:Duration 01:05:50.0006186
and case 2,
Second Case Run Conditions:
===========================
External power to Netduino Plus
Reset Netduino
Disconnect USB
Output from Netduino only through COM2
Last Output, still running
--------------------------
hello from D in Main --> timer:Duration 05:29:50.0011947
hello From Print in TestClass --> timer:Duration 05:29:50.0011947
So,it is seen the Netduino becomes unresponsive after about 1 hr with USB, but was still running after 5 hrs with only serial out. It seems to me that there must be some sort of bug in the USB driver and/or MFDeploy. Also, in my checking to see if the PC was suspending the USB port, I came across the power listing from the port as 280 mA. The following is abstracted from the program, USBDeview output (also, see attached USB Power.PNG),
--
--
--
Driver Filename : MFUSB_Netduino.sys
Device Class : USB
Device Mfg : Secret Labs LLC
Power : 280 mA <---------------------- NB
USB Version : 1.10
Driver Description: Netduino
Driver Version : 4.2.0.0
Instance ID : USB\VID_22B1&PID_1000\5&2e6cfaa2&0&2
I don't know if this is current drawn or the maximum to be supplied. If the latter, then this is inconsistent with what I have read elsewhere in the forum about the current supplied from the PC USB port.
Baxter
Imports Microsoft.SPOT Imports Microsoft.SPOT.Hardware Imports SecretLabs.NETMF.Hardware Imports SecretLabs.NETMF.Hardware.NetduinoPlus Imports System.IO.Ports Imports Microsoft.VisualBasic.Constants Module Module1 Dim StartTime As Date Dim timer As ExtendedTimer Public T As TestClass = New TestClass Friend D As DebugPrint = New DebugPrint("COM2") Sub Main() StartTime = DateTime.Now timer = New ExtendedTimer(New TimerCallback(AddressOf OnTimer), Nothing, 0, 10000) '10 sec Thread.Sleep(Timeout.Infinite) End Sub Public Sub OnTimer(state As Object) Dim delta As System.TimeSpan = (DateTime.Now - StartTime) 'Use regular USB Debug.print Debug.Print("hello from (Debug.Print) --> timer:Duration " & delta.ToString) 'Use COM2 DebugPrint D.Print(vbCrLf & "hello from D in Main --> timer:Duration " & delta.ToString) T.Print(vbCrLf & "hello From Print in TestClass --> timer:Duration " & delta.ToString) End Sub End Module TestClass (Separate Class in Project) ===================================== Imports Microsoft.SPOT Imports Microsoft.SPOT.Hardware Imports SecretLabs.NETMF.Hardware Imports SecretLabs.NETMF.Hardware.NetduinoPlus Class TestClass Public Sub New() End Sub Public Sub Print(ByVal str As String) D.Print(str) ' goes out SerialPort COM2 End Sub End Class DebugPrint (Separate Class in Project) ===================================== Imports Microsoft.SPOT Imports Microsoft.SPOT.Hardware Imports SecretLabs.NETMF.Hardware Imports SecretLabs.NETMF.Hardware.NetduinoPlus Imports System Class DebugPrint Implements IDisposable Private disposedValue As Boolean = False Private buff() As Byte = {} Dim Port As SerialPort Public Sub New(ByVal ComPort As String, Optional ByVal baud As Integer = 9600) Port = New SerialPort(ComPort, baud, Parity.None, 8, StopBits.One) With Port .Handshake = Handshake.None .WriteTimeout = 200 .Open() End With End Sub Public Sub Print(ByVal str As String) If (Not Port.IsOpen) Then Port.Open() buff = System.Text.Encoding.UTF8.GetBytes(str) Port.Write(buff, 0, buff.Length) End Sub Public Sub close() Me.Dispose() End Sub #Region "IDisposable Support" 'Private disposedValue As Boolean ' To detect redundant calls ' IDisposable Protected Overridable Sub Dispose(ByVal disposing As Boolean) If Not Me.disposedValue Then If disposing Then ' TODO: dispose managed state (managed objects). Port.Close() System.Threading.Thread.Sleep(250) 'give some time to close End If ' TODO: free unmanaged resources (unmanaged objects) and override Finalize() below. ' TODO: set large fields to null. End If Me.disposedValue = True End Sub ' TODO: override Finalize() only if Dispose(ByVal disposing As Boolean) above has code to free unmanaged resources. 'Protected Overrides Sub Finalize() ' ' Do not change this code. Put cleanup code in Dispose(ByVal disposing As Boolean) above. ' Dispose(False) ' MyBase.Finalize() 'End Sub ' This code added by Visual Basic to correctly implement the disposable pattern. Public Sub Dispose() Implements IDisposable.Dispose ' Do not change this code. Put cleanup code in Dispose(ByVal disposing As Boolean) above. Dispose(True) GC.SuppressFinalize(Me) End Sub #End Region End Class