Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

SteveS123's Content

There have been 21 items by SteveS123 (Search limited from 26-April 23)


By content type

See this member's

Sort by                Order  

#57712 Ethernet drops connection randomly

Posted by SteveS123 on 23 April 2014 - 05:28 PM in Netduino Plus 2 (and Netduino Plus 1)

Chris,

 

The "unblocking" solution did solve the problem when one of the ND's dropped connection.  The main ND that talks to each of the others just ignores that connection now and continues but I still have the problem where the ND's are just dropping connection and random times.

 

I'm now wondering if I'm using my "using" blocks wrong.  Each controller opens a socket and listens for requests.  The using statement is executed every time through the while loop.  

Question 1:  Should I open a socket that listens and place it before the while loop and just keep it open?

Question 2:  Should I not use the "using" each time I want to communicate to a ND?  I.E. I need to send an LED sequence to all 6 ND's then I am using 6 "using" and closing each connection in each using.  What I'm wondering is do I just open 6 sockets in my program and leave them open?

 

I hope this makes sense.

 

Steve




#57691 socket.connect freezes ND

Posted by SteveS123 on 22 April 2014 - 06:03 PM in Netduino Plus 2 (and Netduino Plus 1)

Here is a thread that has a work-around for this issue.

http://forums.netdui...socket-connect/




#57689 Hang on socket connect

Posted by SteveS123 on 22 April 2014 - 05:38 PM in Netduino Plus 2 (and Netduino Plus 1)

Thank you jrlyman3 for your work-around.  I was able to test it today and the ND that I unplugged was caught and threw an exception.  
The whole reason that I originally had this problem is because I have seven ND+2's connected on a network but they drop connection at random times.  I'm running two threads on them, one is listening for incoming ethernet requests and the other is running SPI for LED strip lights.
Do you have any idea why the uC's drop out randomly?
 
Here is the post I started but have yet to get any replies.
 
Thank you again,
Steve



#57307 socket.connect freezes ND

Posted by SteveS123 on 02 April 2014 - 08:13 PM in Netduino Plus 2 (and Netduino Plus 1)

Hi engvidal,

 

I got some partial help that is a work around from http://forums.netdui...socket-connect/

The only problem I have is being able to set the socket to "Blocking = false"; I only had luck doing that while using a breakpoint.

I've read so many forums that say this issue is fixed in ver 4.3 of the Microframework but as I can see it isn't.  It would be nice if there was a "SetTimeout" on the "Socket.Connect" that way if you don't get any response your program can close the socket and proceed on.

I've also got all of the ND's set to "KeepAlive = true" and that doesn't seem to make any difference.

 

Steve




#57285 Hang on socket connect

Posted by SteveS123 on 01 April 2014 - 10:23 PM in Netduino Plus 2 (and Netduino Plus 1)

Thank you for the reply jrlyman3.  This may sound pretty bad but where is it that I set the socket blocking to false.  I am able to stop the program with a breakpoint and edit the property "m_fBlocking" to false and this will make the code throw an exception but I am unable to set the blocking mode through code.  I tried "setSocketOptions" there are no properties there to set the blocking mode.  I tried "NoDelay" and had no luck.

 

Thanks again,

Steve




#57280 socket.connect freezes ND

Posted by SteveS123 on 01 April 2014 - 08:22 PM in Netduino Plus 2 (and Netduino Plus 1)

I have 7 ND+2's talking to each other over ethernet and it works pretty well most of the time but I occasionally get a controller drop out and not even be pingable(using DOS command prompt) for no reason.  The code is at a state where it is just waiting for incoming data so I can rule out the idea of the code causing the issue.  All seven controllers are running the same code for the most part.  I am controlling LED strands on a separate thread using SPI.  

 

My first problem is that the ND will just be unresponsive to a ping at any random time.  I have the socket option set to KeepAlive also.  (If I have all the controllers working before I leave work around 5pm and return at 8am I will usually have around three controllers unpingable, the number will change from day to day)  Is this a common issue with the ND+2?  I tried firmware 4.2 and now I'm using 4.3 and it acts the same.  The devices are all set to static and I have the router holding those addresses for the ND's

 

My second problem is when I try to do a socket.connect(RemoteEndpoint).  If the endpoint is not responsive(i.e. cable unplugged) then the program just sits there waiting and will never throw an exception or move on; I have to reboot the device to get past this error.  I've read some forums that this has been corrected on ver 4.3 but it did the same thing with ver 4.2.

 

Any help would be greatly appreciated,

Steve




#57236 Hang on socket connect

Posted by SteveS123 on 31 March 2014 - 04:14 PM in Netduino Plus 2 (and Netduino Plus 1)

I have the same problem.  Did you ever figure out a solution?  I also have seven ND+2's and they all hang when I try to do a socket.connect to a device that isn't connected to the network. The only way I am able to get out of the hang is to power cycle the device.  I also leave the ND's powered up over night and at least three of the seven will not be pingable in the morning.




#56780 No ACT light on startup

Posted by SteveS123 on 13 March 2014 - 02:46 PM in Netduino Plus 2 (and Netduino Plus 1)

Chris,

 

I have nine of them running on the same network and this is the only one that has this behavior.

 

Although, every morning when I come in all of the ND's that were connected the previous evening and are communicating will drop their connection.  I tried pinging them all this morning and all nine are not reachable.  They are all set statically in the router.  I am running two threads on each of them, one that runs the socket and the other is communicating through the SPI.  The socket receives the data and sets a global variable and the second thread changes the lighting scheme based on that variable.  Could that cause them to drop their connection?

I know this is a different topic but just thought it is worth mentioning.  I'm designing kiosks to that will be installed all around the US and am in hopes of using the ND's for the lighting control so if this problem can be corrected we will be buying a lot of devices

 

Thanks again,

Steve




#56774 No ACT light on startup

Posted by SteveS123 on 12 March 2014 - 07:33 PM in Netduino Plus 2 (and Netduino Plus 1)

Thank you Chris for your response.

 

To answer your question:

1. I plugged the ND2 in and no ACT light

2. I pressed the reset button and the ACT light shows activity.

3. I unplugged the ND2 for 5 seconds then plugged it in and no ACT but I quickly unplugged and plugged the device back in and the ACT light started flashing.     The time between unplug and plug was approx. 1 second.

4.I unplugged for 5 seconds and then plugged it back in and got no ACT light.  

 

I was able to replicate the process over and over.  It does sound like a hardware issue.

 

I'm looking forward to hearing about your research, let me know if you would like me to send this ND to you.

 

Thanks,

Steve




#56754 No ACT light on startup

Posted by SteveS123 on 11 March 2014 - 01:24 PM in Netduino Plus 2 (and Netduino Plus 1)

I have many ND+2's and there is one in particular that doesn't respond to plugging in an ethernet cable until I press the onboard button.  

This is a fresh flash of version 4.3.  I am able to execute code on the device but there is just no ethernet activity until the button is pressed.  The version 4.2 did the same thing.  

1. I'm positive the cable and switch is good.

2. I can get activity if I press the onboard button.

 

What would cause this the device to obtain an IP address only if the onboard button is pressed?

 

Thank you in advance,

Steve




#56731 Ethernet drops connection randomly

Posted by SteveS123 on 09 March 2014 - 10:03 PM in Netduino Plus 2 (and Netduino Plus 1)

I am connecting 10 ND+2 together and they all communicate with each other via Enet.  I have all of them set static.  My problem is that at random times I can't communicate with any one of the ND+2's.  The only way I can get the device to communicate is to reset the controller by unplugging it.  

 

Is there a way to prevent this?

Is there a way to open a socket connection and try to send to it but if the connection isn't available then just ignore the connection?  (I tried putting a "try-catch" in the code but the controller still hangs if there is no endpoint)

 

 

 

I'm new to sockets so if you know of a better way to do this I would greatly appreciate the advice.

 

Here is the way I'm doing the connections:

string rawData = "";
                using (Socket commSocket = socket.Accept()) 
                {
                    while (!commSocket.Poll(10, SelectMode.SelectRead)) ;
                    led.Write(true);
                    int bytesSent = commSocket.Available;
 
                    if (bytesSent > 0)
                    {
                        byte[] bytes = new byte[bytesSent];
                        int bytesReceived = commSocket.Receive(bytes, bytesSent, SocketFlags.None);
                        if (bytesReceived == bytesSent)
                        {
                            rawData = (new string(Encoding.UTF8.GetChars(bytes)));
                        }
                    }
                    char delimiter = ' ';
                    string[] words;
                    words = rawData.Split(delimiter);
                       
                            sequence = words[0];
                            red = byte.Parse(words[1]);
                            green = byte.Parse(words[2]);
                            blue = byte.Parse(words[3]);
                            LEDChain = words[4];
                            //speednMS = int.Parse(words[5]);
                            led.Write(false);
 
 try
                                {
                                    using (Socket sendSocket = new Socket(AddressFamily.InterNetwork,                    SocketType.Stream, ProtocolType.Tcp))
                                    {
                                        sendSocket.SendTimeout = 1000;
                                        sendSocket.Connect(EPCanIP);
                                        sendSocket.Send(Encoding.UTF8.GetBytes("SetColorAll");
                                        sendSocket.Close();
                                    }
                                    using (Socket sendSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
                                    {
                                        sendSocket.SendTimeout = 1000;
                                        sendSocket.Connect(EPFloorIP);
                                        sendSocket.Send(Encoding.UTF8.GetBytes("SetColorAll");
                                        sendSocket.Close();
                                    }
                                    using (Socket sendSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
                                    {
                                        sendSocket.SendTimeout = 1000;
                                        sendSocket.Connect(EPRibsIP);
                                        sendSocket.Send(Encoding.UTF8.GetBytes("SetColorAll");
                                        sendSocket.Close();
                                    }
                                    using (Socket sendSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
                                    {
                                        sendSocket.SendTimeout = 1000;
                                        sendSocket.Connect(EPRevealIP);
                                        sendSocket.Send(Encoding.UTF8.GetBytes("SetColorAll");
                                        sendSocket.Close();
                                    }
 
                                    using (Socket sendSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
                                    {
                                        sendSocket.SendTimeout = 1000;
                                        sendSocket.Connect(EPGreenScreenIP);
                                        sendSocket.Send(Encoding.UTF8.GetBytes("SetColorAll");
                                        sendSocket.Close();
                                    }
 
                                    using (Socket sendSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
                                    {
                                        sendSocket.SendTimeout = 1000;
                                        sendSocket.Connect(EPWelcomeIP);
                                        sendSocket.Send(Encoding.UTF8.GetBytes("SetColorAll");
                                        sendSocket.Close();
                                    }
                                }
                                catch (Exception)
                                {
 
                                    Debug.Print("Socket did not connect");
                                }



#56039 Update program.cs via ethernet

Posted by SteveS123 on 12 February 2014 - 08:31 PM in Netduino Plus 2 (and Netduino Plus 1)

I would like to update my ND+2 from a network connection.  I did a forum search and found an article from 2011 but didn't get any valuable information.

http://forums.netdui...thernet +upload

 

I tried to connect to my ND+2 via MFDEPLOY by setting the config to network and by setting the IP.  I tried to ping the device and it doesn't show-up in MFDEPLOY but I can ping it through a command prompt.  I can verify the ping by unplugging the ND and the ping through command prompt will fail and work when I reconnect.

 

Is there a way to send the program.cs file to the device and update it over a local network?

 

Thanks in advance,

Steve




#55881 Change clock rate in "Toolbox.NETMF.Hardware.RgbLedStrip"

Posted by SteveS123 on 05 February 2014 - 06:35 PM in Netduino Plus 2 (and Netduino Plus 1)

I'm trying the clock rate of the Toolbox.NETMF.Hardware>RgbLedStrip library but can't seem to succeed.

The library offers no access to the clock rate.

 

Steps taken so far:

1. Try to access the RgbLedStrip library.  - no access to clock settings

2. Instantiated a new spi.config and set it to SPI_Devices.SPI1.  - The changes in the new config didn't change my output.

 

The question is, how do I change the clock speed of the SPI while using the NETMF toolbox?

 

Here is the test code.

 

public class Program
    {
        private static RgbLedStrip Chain = new RgbLedStrip(RgbLedStrip.Chipsets.WS2801, 114, SPI.SPI_module.SPI1);  //45 count on FLOOR and 150 count for CAN
 
        public static void Main()
        {
            SPI.Configuration spiDevice1 = new SPI.Configuration(Pins.GPIO_PIN_D10, false, 0, 0, false, false, 100, SPI_Devices.SPI1);
            //The line above is supposed to set the SPI1 config.  I am trying to set the clock rate to 100 but there is no change in my program.
            //I even tried instantiating the "RgbLedStrip" with the above "spiDevice1" and still no change to the clock speed.
            while (true)
            {
                for (int i = 0; i < 74; i++)
                {
                    Chain.SetColor(i, 0x34BAC6, false);
                    Thread.Sleep(1);
                }
 
                for (int i = 74; i < 114; i++)
                {
                    Chain.SetColor(i, 0xFFFFFF, false);
                    Thread.Sleep(5);
                }
                Thread.Sleep(5000);
                Chain.SetColorAll(0x000000, false);
           }
       }
   }
             



#55502 SPI clock pin needs amplified

Posted by SteveS123 on 20 January 2014 - 03:46 PM in General Discussion

So after many hours of testing I figured the problem out.  I wanted to post an answer so that this thread wasn't left unanswered.

First off I am running four 5 volt 60 amp supplies and each one is supplying power to 24 strands.  All the grounds are tied together but this is where the problem is.  I am using one of the supplies to supply the 5 volt logic on my controller board and it also supplies the 5 volts to the 24 strands.  If I move the supply wire to my controller to any of the four supplies I get different affects on the LEDs.  The affects are flickers and erratic behavior.  The supplies are switching supplies and are causing me to have this issue.  I am able to control all the LEDs perfectly if I use just one supply but if you do the math it can't support the current load.  I was able to test two segments off of one supply for a short time to verify that it worked.

Second, I did put the driver chip in on my CLOCK line to help stabilize it and that did make a difference ([color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;]OPA633KP).[/color]

[color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;]To sum it up I have to get a single high output supply and the driver chip.[/color]




#55486 SPI clock pin needs amplified

Posted by SteveS123 on 19 January 2014 - 03:59 PM in General Discussion

The LEDs do flicker random colors.  If I turn on just the red LED in each strand it is a lot more stable; I can also turn on just the blue or green with the same affect.  If I mix the color(use more of the RGB LED) I load the circuit down and get the flicker.  I did put large 10 AWG wire on the ground for each set of 24 LEDs which helped.  I also built a circuit that uses an OPA633KP buffer amplifier on the clock pin which helped the clocking issue.  I do agree with you that it is a capacitance issue, how do I go about correcting that?  

 

To tell you exactly what I have I will explain.

The layout is a 16 foot diameter floor that is lit up by the LEDs.

I have 48 supports under the floor that have three strands of LEDs on each support.

My controller is on one side of the floor.

I have four 5 volt 60 amp power supplies going to the LEDs and one supply handles 1/4 of the floor.

Each strand has 45 LEDs on it so the total LEDs are 6480.

I have all the grounds tied together.

The only difference between each strand is that the supply cable for each.  Since it is in a circle I sent half the cables around one side and half around the other.  They range in length from 4' to 16'.  All the LED strands are 54".

 

Hope this helps.

Steve




#55468 SPI clock pin needs amplified

Posted by SteveS123 on 18 January 2014 - 07:40 PM in General Discussion

I am trying to drive many strands of ws2801 RGB LEDs. 

I have 96 rows of 45 LED strands.

My MOSI data is fine because I am using AND gates to control the data flow between each strand so the 74LS08 chips are working great.

The problem I'm having is that the clock pin is needed on all the strands at the same time so it is tied to each row, obviously the ND can't supply enough voltage or current for this so I'm trying to figure out how to create a driver for this.  I tried a 74LS244 which is a clock driver chip but the LEDs just flicker in a random order (not the programs intention).  I have isolated the clock pin to one strand of LEDs and was able to verify my MOSI is working through all the gates but as soon as I connect the clock pin to all the strands it fails.

So to sum it up, how do I create a clock driver to supply enough current to feed all the strands.

OP Amp?

Transistor?

 

Thank you for your help in advance,

Steve




#53849 Intermittent network error. Socket gets dropped

Posted by SteveS123 on 06 November 2013 - 05:29 PM in Netduino Plus 2 (and Netduino Plus 1)

I may be wrong but I'm guessing the ND+ should stay open for network traffic and listen on the socket.  I can flash the ND+ and try to send it a packet over the network and I will get an error that says, "no connection could be made because the target machine actively refused it".  I have to reboot the ND+ and then maybe it will accept the packet.  Then sometimes it will work for a while (hours) and then throw an error again.

 

Could the problem be because I'm multithreading?  One thread is listening for packets while the other is telling LEDs what to do through SPI.




#53834 Intermittent network error. Socket gets dropped

Posted by SteveS123 on 04 November 2013 - 11:04 PM in Netduino Plus 2 (and Netduino Plus 1)

I have been struggling with the ND+ and sockets.  I used the code from http://www.element14...uino-web-server to setup my ND+ to listen for requests on a socket and to change LEDs sequences depending on the request.  Without a lot of detail I would like to tell you the problem first since it may save a lot of reading.

The ND+ listens on a socket and works sometimes but it will always fail eventually or even right away.

[color=#ff0000;]The error I receive is "No connection could be made because the target machine actively refused it".[/color]

 

 I have used MFDeploy to setup a static IP and I even used a line in code to set the IP statically but neither seem to matter.

Like I said, sometimes it works and sometimes it doesn't.  I've been racking my brain for days.  Is the problem because I am listening on one thread and processing the result on another?  

I can ping the device with windows command prompt indefinitely while sending requests.  I can even ping the device after the network error shows up but the application on the ND+ is locked up.

 

The two files attached are:

1. The application that is on the ND+.

2. The dll that is used to talk to the ND+.

 

To use it just create a forms app and import the dll and you should be able run the program without any peripherals connected to the ND+ except power and a network cable.

 

Thank you in advance for any helpful information.

Steve

 

 public static void Main()
        {
            Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0].EnableStaticIP("10.0.0.206", "255.255.255.0", "10.0.0.1");
            Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            socket.Bind(new IPEndPoint(IPAddress.Any, 8080));
            socket.Listen(10);
 
            //thread start
            ThreadStart threadStart = new ThreadStart(workerThread);
            Thread threadWorker = new Thread(threadStart);
            threadWorker.Start();
 
            OutputPort led = new OutputPort(Pins.ONBOARD_LED, false);
           
                    while (true)
                    {
                        string rawData = "";
                        using (Socket commSocket = socket.Accept())
                        {
                            while (!commSocket.Poll(10, SelectMode.SelectRead)) ;
                            led.Write(true);
                            int bytesSent = commSocket.Available;
                         
                            if (bytesSent > 0)
                            {
                                byte[] bytes = new byte[bytesSent];
                                int bytesReceived = commSocket.Receive(bytes, bytesSent, SocketFlags.None);
                                if (bytesReceived == bytesSent)
                                {
                                    rawData = (new string(Encoding.UTF8.GetChars(bytes)));
                                }
                            }
 
                            if (rawData == "PhotoOn")
                            {
                                sequence = "DMXPhotoOn";
                                break;
                            }
 
                            else if (rawData == "PhotOff")
                            {
                                sequence = "DMXPhotoOff";
                                break;
                            }
 
                            //start of new LEDController code to seperate passed parameters
                            else if (rawData != "PhotoOff" || rawData != "PhotoOn")
                            {
                                char delimiter = ' ';
                                string[] words;
                                words = rawData.Split(delimiter);
                                sequence = words[0];
                                red = byte.Parse(words[1]);
                                green = byte.Parse(words[2]);
                                blue = byte.Parse(words[3]);
                                LEDChain = words[4];
                            }
                            led.Write(false);
                        }
                    }
        }

Attached Files




#53220 Not able to change network settings

Posted by SteveS123 on 15 October 2013 - 10:14 PM in Netduino 2 (and Netduino 1)

I am trying to set my ND+2 to have a static IP.  I have erased all programs so the board is back to its original config.  

I went to MFDeploy and selected USB, the ND+2 shows up and I hit ping.  It says "Pinging...tinyCLR" and that is it.  I know the device has an IP address because I can see it on my network an I'm also able to ping it and if I unplug it then I'm no longer able to ping it.  Just a note, I'm using DOS command prompt to ping the address.

 

My problem is that I want to change the network config so that the device is static but when I go to "network" settings and change the fields then hit "update" it says, "Unable to erase configuration sector memory".

 

I've rebooted my machine and have plugged and unplugged my usb plug and reset my switch.

 

The "Network Configuration" just seems to not be operating correctly.  I have tried this on two boards and get the same results.

 

I also followed the directions on pressing the onboard button but this just makes the onboard LED stay lit and locks the device up. 

 

Any help would be appreciated.

 

Thanks,

Steve




#53130 Multithread or interrupt

Posted by SteveS123 on 11 October 2013 - 01:16 PM in Netduino Plus 2 (and Netduino Plus 1)

Thanks Paul for your input.  I went ahead and did a multithreaded app and it works great!  The socket receives the data and updates my variable and I'm then able to send the selected sequence to my LEDs with no delay.  




#53116 Multithread or interrupt

Posted by SteveS123 on 10 October 2013 - 01:54 PM in Netduino Plus 2 (and Netduino Plus 1)

I'm trying to create a device that will accept TCP/IP input and based on that input it will tell LED strips to do a sequence.  The LED strips have individually controlled LEDs that use the WS2801 chipset.

 

My program currently listens to the socket and when it gets the data it does do an LED sequence but the problem I have is that once the sequence is done I go back to listening to the port for more data.  I want the LEDS to keep going while still listening to the socket and if there is new data it will interrupt the LED sequence and start an new one.

 

So for example, if you had two LEDs and one was flashing I want to send data to the ND2 to flash the other LED.  

 

Do I use multithreading for this or an interrupt that sees when data comes in on the socket?  Or do I have this all wrong and there is another way?

 

public class Program
    {
        private static RgbLedStrip Chain = new RgbLedStrip(RgbLedStrip.Chipsets.WS2801, 160, SPI.SPI_module.SPI1);
 
        public static void Main()
        {
            string rawData = "";
 
            while (true)  //This is the socket connection that I think should run on another thread so that the //program doesn't hang until data is received.
            {
                using (System.Net.Sockets.Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
                {
                    socket.Bind(new IPEndPoint(IPAddress.Any, 8080));
                    socket.Listen(1);
 
                    using (Socket commSocket = socket.Accept())
                    {
                        if (commSocket.Poll(1, SelectMode.SelectRead))
                        {
                            byte[] bytes = new byte[commSocket.Available];
                            int count = commSocket.Receive(bytes);
 
                            rawData = (new string(Encoding.UTF8.GetChars(bytes)));
                        }
                    }
                 
 
                    for (int Seconds = 0; Seconds < Chain.LedCount; ++Seconds) //LED sequence
                    {
                        Chain.InsertColorAtBack(0xff0000, false); Thread.Sleep(10);
                    }
                    Chain.SetColorAll(0, false);
                }
 
            }
 
        }
 
    }




home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.