Thanks for the feedback. Here is how I spent my morning.
I used one ND with COM1 hooked to COM2 and got exactly the same results. All works fine as long as I can read the data fast enough. If not, there are very unpredictable results including crashing the ND. If I use any type of handshake; all bets are off and data is lost. I will eagerly await the RC6 build and re-test.
(I have not ported this back to 4.1 to see what happens there, that would require reflashing my NDs. and I am basically lazy that way! )
Here is another very peculiar thing related to serial ports. I posted about this in an earlier thread concerning 'System.InvalidOperationException' in the 'System.IO.Ports.SerialPort.HandlePinReservations' call. I am wondering if my 4.2 implementation is FUBAR? Here is the scenario:
Running a simple test application:
using System.IO.Ports; using Microsoft.SPOT; using Microsoft.SPOT.Hardware; using SecretLabs.NETMF.Hardware.Netduino; namespace NetduinoApplication2 { public class Program { public class netduino { //Changing from const to static causes the sp.Open() method to throw a 'System.InvalidOperationException' Exception public const Cpu.Pin SomePin = Pins.GPIO_PIN_A4; //public static Cpu.Pin SomePin = Pins.GPIO_PIN_A4; public InterruptPort SomeInterrupt = new InterruptPort(SomePin, true, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeBoth); } protected static netduino MCU = new netduino(); public static void Main() { SerialPort sp = new SerialPort("COM2", 9600, Parity.None, 8, StopBits.One); sp.Open(); Debug.Print("finished OK!"); } } }
Notice the definition for SomePin. If I define SomePin as static, the debug trace looks like this on the sp.Open() call:
Step into: Stepping over non-user code 'System.IO.Ports.SerialPort.Open' Step into: Stepping over non-user code 'System.IO.Ports.SerialPort.Open' Step into: Stepping over non-user code 'System.IO.Ports.SerialPort.HandlePinReservations' Step into: Stepping over non-user code 'Microsoft.SPOT.Hardware.HardwareProvider.HwProvider.get' Step into: Stepping over non-user code 'System.IO.Ports.SerialPort.HandlePinReservations' Step into: Stepping over non-user code 'System.IO.Ports.SerialPort.HandlePinReservations' A first chance exception of type 'System.InvalidOperationException' occurred in Microsoft.SPOT.Hardware.dll Step into: Stepping over non-user code 'System.IO.Ports.SerialPort.HandlePinReservations' A first chance exception of type 'System.InvalidOperationException' occurred in Microsoft.SPOT.Hardware.SerialPort.dll An unhandled exception of type 'System.InvalidOperationException' occurred in Microsoft.SPOT.Hardware.SerialPort.dll
If I define as a const, all is good and no exception.
Not to make this even more confusing, but when I run the debugger and step through the code, when I get to the call for 'HandlePinReservations' I get a dialog box asking me to locate the following file:
C:\Documents\Secret Labs\Projects\Production\SecretLabs.NETMF.Hardware.Netduino\NetduinoHardwareProvider.cs (See attachment SourceScreen.jpg)
Any ideas on what is going on and where I might go next? The loss of data part is really the troubling part. I need to have an effective handshake so I can read and process larger chunks of data.