I searched for an answer and couldn't find one, so maybe someone knows how to solve my issue...
I haven't used my Plus 2 in awhile, so I updated the firmware to the 4.3 one that was posted. Using VS 2012, I wrote (or am writing...) a simple network pinger. It will run an indeterminate amount of times before getting the VS error "Error 1 Device not found or cannot be opened - USB:Netduino". When I check the build settings, there is no device listed under USB. Windows will register it as "unknown usb device (device descriptor request failed)" in the device manager.
Following the advice of other posts, I tried pressing the button while restarting it, and checking it with MFDeploy. MFDeploy doesn't list it. In fact the only workaround I have is to restart my computer, which is a bit inconvenient. This leads me to believe I'm actually having some bizarre driver issues I cannot figure out. Below is my code, in case it is the problem (it's only the one class):
public class Program { public static void Main() { OutputPort led = new OutputPort(Pins.ONBOARD_LED, false); InputPort butan = new InputPort(Pins.ONBOARD_BTN, true, Port.ResistorMode.Disabled); byte[] words = System.Text.Encoding.UTF8.GetBytes("check"); byte[] data = new byte[64]; data[data.Length - 1] = 0x40; Array.Copy(words, data, words.Length); byte[] ping = new byte[data.Length + 4]; ping[0] = 0x08; ping[1] = 0x00; Array.Copy(data, 0, ping, 4, data.Length); Array.Copy(chksm(ping), 0, ping, 2, 2); Socket socket = new Socket( AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.Icmp); EndPoint ep = (EndPoint)(new IPEndPoint(IPAddress.Parse("192.0.2.1"), 0)); while (!butan.Read()) { led.Write(true); socket.SendTo(ping, 0, ping.Length, SocketFlags.None, ep); Thread.Sleep(500); led.Write(false); Thread.Sleep(500); } } static byte[] chksm(byte[] data) { uint chcksm = 0; for (int i = 0; i < data.Length; i+=2) chcksm += (uint)BitConverter.ToUInt16(data, i); chcksm = (chcksm >> 16) + (chcksm & 0xffff); chcksm += (chcksm >> 16); return BitConverter.GetBytes((ushort)(~chcksm)); } }
Please advise me if there is any log outputs or anything else needed to diagnose this issue. I appreciate the help in advance
- Doug