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.

mohammad's Content

There have been 53 items by mohammad (Search limited from 11-May 23)


By content type

See this member's


Sort by                Order  

#31633 wireless

Posted by mohammad on 05 July 2012 - 07:34 PM in Netduino 2 (and Netduino 1)

Salaam Shehab, I think this blog can be useful for you: http://mohammad.geoc...ebsite/blog.php After reading the blog, if you have any questions, do not hesitate to contact me. Cheers, Mohammad



#35133 Switch ON/OFF

Posted by mohammad on 13 September 2012 - 05:22 PM in Netduino Plus 2 (and Netduino Plus 1)

Hi Baxter and Mario, Thanks for your useful information. I am going to apply the aforementioned solutions. Cheers, Mohammad



#34837 Switch ON/OFF

Posted by mohammad on 07 September 2012 - 07:54 PM in Netduino Plus 2 (and Netduino Plus 1)

Thank you Mario. You are right, but the problem is that I already bought a lot of battery holders: https://www.sparkfun.../products/10512
Do you know how to include a switch in series to the battery?



#34824 Switch ON/OFF

Posted by mohammad on 07 September 2012 - 04:41 PM in Netduino Plus 2 (and Netduino Plus 1)

Hi all, Is there any way to turn a Netduino Plus on/off? FYI. I have a Netduino Plus which is powered by a battery. To save more energy, I sometimes need to turn off the device. Regards, Mohammad



#34825 Switch ON/OFF

Posted by mohammad on 07 September 2012 - 04:41 PM in Netduino Plus 2 (and Netduino Plus 1)

FYI. The button I am going to use for this purpose, is the default button on the board.



#32988 Some questions about Netduino Plus

Posted by mohammad on 01 August 2012 - 10:09 PM in Netduino Plus 2 (and Netduino Plus 1)

2) How can we pair 2 Netduinos by BlueSMiRF?


Thanks Chris and Baxter for your useful replies.
I found this link useful to do that:
http://phillipecanti...tooth-link.html
In addition, my own Blog completely explains how to enable Bluetooth for Netduino Plus by means of a BlueSMiRF Silver.



#31663 Some questions about Netduino Plus

Posted by mohammad on 06 July 2012 - 08:21 PM in Netduino Plus 2 (and Netduino Plus 1)

Hello all, I have a Netduino Plus with lots of questions: 1) Can my device itself understand its power type (solar, battery, plug), power input voltage, and network connection type (Wi-Fi, Ethernet, ...)? 2) How can we pair 2 Netduinos by BlueSMiRF? I really appreciate your answers. Cheers, Mohammad



#49401 Software reset

Posted by mohammad on 13 May 2013 - 11:43 PM in Netduino 2 (and Netduino 1)

Is the watchdog usable now ?

 

Actually, I have the same question for Firmware 4.2.0.0 (RC 5), since the following code doesn't work and the debugger always prints 00:00:00 for the Watchdog.Timer.

using System;using System.Net;using System.Net.Sockets;using System.Threading;using Microsoft.SPOT;using Microsoft.SPOT.Hardware;using SecretLabs.NETMF.Hardware;using SecretLabs.NETMF.Hardware.NetduinoPlus;namespace NetduinoPlusApplication1{    public class Program    {        public static void Main()        {            Debug.Print(Watchdog.Timeout.ToString());            TimeSpan t = new TimeSpan(0, 0, 1);            Watchdog.Timeout = t;            Debug.Print(Watchdog.Timeout.ToString());            Watchdog.Enabled = true;            Thread.Sleep(3000);            Debug.Print("not rebooted yet!!!");        }    }}



#49930 Software reset

Posted by mohammad on 24 May 2013 - 05:37 PM in Netduino 2 (and Netduino 1)

I'm sure you can find a watchdog IC that is available in DIP8 - just stick it down the breadboard, connect 2 wires (plus power) and you're good.

 

Thanks for your information. I will try to buy one. Since I am not expert, is there any specific name/ID for the IC your mentioned?




#49857 Software reset

Posted by mohammad on 23 May 2013 - 07:46 PM in Netduino 2 (and Netduino 1)

The code you attached before would restart the device repeatedly between 10:00 and 11:00 AM, effectively rendering it unusable during that time. Am I right?

 

Yes, you are right :), but by using the Timer class, you can implement it more effectively.

 

Personally, I think there's no such thing as a software watchdog. You can't write software to check if another piece of software has locked up. If I remember correctly it's one of those NP complete problems within the theories of complexity. :)

I partially agree with you ;), you know in multi-threading world, sometimes one thread blocks all its processes (e.g., this problem), and the problem is solved by a simple reboot. At this time, one thread can be in charge of software reboot, and the other threads are doing their tasks. If any fail or error situation occurs, the reboot thread can perform its task :)




#49737 Software reset

Posted by mohammad on 22 May 2013 - 12:06 AM in Netduino 2 (and Netduino 1)

Thanks Chris for your comment. Finally, I figured it out: http://forums.netdui...lus/#entry49735




#49437 Software reset

Posted by mohammad on 14 May 2013 - 06:41 PM in Netduino 2 (and Netduino 1)

Hi Chris,

 

Thank you so much for your response. Does the following code act like what Watchdog does?

namespace WatchdogSimulation{    public class WatchdogSimulation    {        public static void Main()        {            while (true)            {                Debug.Print(DateTime.Now.Hour.ToString());                if (DateTime.Now.Hour > 10)             //Watchdog.Timeout = 10h                    PowerState.RebootDevice(false);     //Watchdog.Enabled = true;                Thread.Sleep(300000);                   //Wait 5min            }        }    }}

The purpose of mine is to simulate the reboot button pressing every 10 hours.




#49735 Software Reboot for Netduino Plus

Posted by mohammad on 21 May 2013 - 11:58 PM in Netduino Plus 2 (and Netduino Plus 1)

Hello,

 

I had a problem for 1 month to use a Watchdog mechanism in Netduino Plus. FYI, the "Watchdog" acts as a software reboot with a predefined timer.

The watchdog functions have been already developed in C# Micro Framework, but they never work. Based on the comment I got from Chris: "No watchdog implemented in the gen1 hardware.  We're currently designing a software update for gen2 hardware which would enable it."

Finally, I created my own watchdog function which works well to reboot the Netduino after a fixed time (e.g., 5h).

public class MainFrame{        const Int32 wdDelay = 1000 * 60 * 60 * 5;   // 5h        static Timer wdtimer = new Timer(watchdog, null, wdDelay, 0);                public static void Main()        {            // Write your codes here        }        public static void watchdog(object state)        {            PowerState.RebootDevice(false);     //Watchdog.Enabled = true;        }}

I hope it helps you in your project :)




#49858 Software Reboot for Netduino Plus

Posted by mohammad on 23 May 2013 - 07:50 PM in Netduino Plus 2 (and Netduino Plus 1)

Thanks Khmesmer.

I am working with Netduino Plus (or generally microcontroller programming) since 2012. I recommend you to follow the "getting started with the nternet of Things" book, first. Then, try to implement codes and ask your questions in this forum. To be honest, this forum and its members :) helped me a lot in my projects and learning.

If you have any questions, feel free to let me know.

 

Good Luck




#48851 Socket Exception 10050 after an hour

Posted by mohammad on 29 April 2013 - 07:09 PM in Netduino Plus 2 (and Netduino Plus 1)

Hi all,

 

I have the same problem with some minor differences.

I am sending heart beats every 1min to a data service. My Netduino Plus has a Valid IP address with DHCP enabled in its network configurations. After some hours (e.g. max 56 hours, mean 32 hours in 10 experiments), the network thread stops with no exception.

I tried 10 different methods as probable solutions, but all failed:

  • Using single threading instead of multi-thread programming (asking Netduino to only process the single networking task).
  • Using C# HttpWebRequest/Response library
  • Socket Programming instead of the C# HTTP library.
  • Considering a fixed value for Thread.sleep() in the infinite loop (while true) of heart beat instead of WaitUntilNextPeriod() function which uses the CPU ticks.
  • Removing the infinite loop and trigger the heart beat function by the event driven function (based on the value received on COM port).
  • Using Debug.GC(true) at the beginning and end of each function to clean the memory.
  • Trying different heart beat frequency such as 1min, 2min, and 3min.
  • Considering Try-Catch in each function followed by relevant logs.
  • Mutex_lock and Mutex_unlock for the networking functions.
  • and so forth ....

Unfortunately, the problem exists after 2months and I couldn't find the solution yet :( Any help is appreciated a lot since this project is a part of my thesis and it should be done asap.

 

If you are interested to view my code, I attached into this message. This is the version with "Socket Programming" and "Thread.Sleep(Constant Value = 2min)" which worked longer than other versions (56 hours).

 

Cheers,

Mohammad

Attached Files




#49740 Socket Exception 10050 after an hour

Posted by mohammad on 22 May 2013 - 12:17 AM in Netduino Plus 2 (and Netduino Plus 1)

Hi all,

 

After spending 2 months on this problem, finally I could solve it. It was fixed by using a watchdog solution: http://forums.netdui...lus/#entry49735

Now, my device is working well and continuously for 10 days.

 

Good Luck




#49271 Problem using AnalogInput

Posted by mohammad on 09 May 2013 - 12:23 AM in Netduino Plus 2 (and Netduino Plus 1)

Hi FVN.Net,

 

I exactly have the same problem. Could you solve the problem? I followed this post and tried everything Kem said (Thanks Kem), but all failed.

I really appreciate if you help me solve it.

 

Thanks,

Mohammad




#34761 Network Loss Problem

Posted by mohammad on 06 September 2012 - 11:46 PM in Netduino Plus 2 (and Netduino Plus 1)

Hi Chris, Thanks for your update. So, I keep on waiting for this new firmware... Cheers, Mohammad



#33388 Network Loss Problem

Posted by mohammad on 10 August 2012 - 08:53 PM in Netduino Plus 2 (and Netduino Plus 1)

Hi all,

My program is able to connect to a remote server via a socket and it can send data across.
Upon disconnection (or if Ethernet cable is plugged in, after the device powering) I get this exception:
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in Microsoft.SPOT.Net.dll

In this case, I frequently try to re-establish the connection by creating a new socket and reinitialising it, but the program is stopped in socket.connect(...) line after plugging in the Ethernet cable.

Would you please help me solve the problem?
Here is the code I wrote:
static Socket Connect(string host, int timeout, int port_num)
        {
            Socket connection;
            IPHostEntry hostEntry = Dns.GetHostEntry(host);                // Look up host’s domain name to find IP address(es)
            IPAddress hostAddress = hostEntry.AddressList[0];              // Extract a returned address
            IPEndPoint remoteEndPoint = new IPEndPoint(hostAddress, port_num);
            
            while (true)
            {
                try
                {
                    //Connect
                    connection = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                    connection.Connect(remoteEndPoint);
                    connection.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.NoDelay, true);
                    connection.SendTimeout = timeout;
                    Debug.Print("Connection stablished");

                    break;
                }
                catch (SocketException e)
                {
                    Debug.Print("Error Code: " + e.ErrorCode);
                    Debug.GC(true);
                }
            }
            Debug.GC(true);
            return connection;
        }



#34698 Network Loss Problem

Posted by mohammad on 05 September 2012 - 09:34 PM in Netduino Plus 2 (and Netduino Plus 1)

Hi Chris and all,

No update yet? Would you please tell me how long I should wait for the fixing of the aforementioned bug?

Thank you so much,
Mohammad

Hi all,

My program is able to connect to a remote server via a socket and it can send data across.
Upon disconnection (or if Ethernet cable is plugged in, after the device powering) I get this exception:
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in Microsoft.SPOT.Net.dll

In this case, I frequently try to re-establish the connection by creating a new socket and reinitialising it, but the program is stopped in socket.connect(...) line after plugging in the Ethernet cable.

Would you please help me solve the problem?
Here is the code I wrote:

static Socket Connect(string host, int timeout, int port_num)
        {
            Socket connection;
            IPHostEntry hostEntry = Dns.GetHostEntry(host);                // Look up host’s domain name to find IP address(es)
            IPAddress hostAddress = hostEntry.AddressList[0];              // Extract a returned address
            IPEndPoint remoteEndPoint = new IPEndPoint(hostAddress, port_num);
            
            while (true)
            {
                try
                {
                    //Connect
                    connection = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                    connection.Connect(remoteEndPoint);
                    connection.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.NoDelay, true);
                    connection.SendTimeout = timeout;
                    Debug.Print("Connection stablished");

                    break;
                }
                catch (SocketException e)
                {
                    Debug.Print("Error Code: " + e.ErrorCode);
                    Debug.GC(true);
                }
            }
            Debug.GC(true);
            return connection;
        }




#33389 Netduinoplus SD card

Posted by mohammad on 10 August 2012 - 09:24 PM in Beta Firmware and Drivers

Hi rcomeau,

It was also my question, but somebody relied me that "no, 4.2 does not YET support 4G uSD".



#48444 Netduino Plus stops running after a while

Posted by mohammad on 16 April 2013 - 08:10 PM in Netduino Plus 2 (and Netduino Plus 1)

Hi there,

 

My Netduino Plus has been programmed in a way that it sends heart beat requests (every minute) frequently to a data service. Unfortunately, after 1 (or sometimes 2) day(s) it stops running with no error or no reason. Is there any limitations on the Netduino Plus hardware structure?

I tested the data service with my PC as a client (instead of Netduino Plus) to send heart beat requests, so I was convinced there is no problem on the data service.

 

FYI. It has no power limitation. I mean its power is provided by a USB cable connected to my computer.

 

Any comments, advice and solutions are more than welcome.

 

Thanks for your time and attention,

Mohammad




#48865 Netduino Plus stops running after a while

Posted by mohammad on 30 April 2013 - 12:35 AM in Netduino Plus 2 (and Netduino Plus 1)

Hi!

 

The problem could be such that it won't show as an exception but simply lock up. Could be you run out of memory in such away that there's not enough memory to even be able to fire and exception.

 

Here are a few questions for which answers might help you in trouble shooting:

 

1. Are you debugging the Netduino for the whole duration of the test?

2. Does it run for a longer time or about the same when not debugging?

3. Does it run for a longer time when not attached to USB but using an external power source?

4. What do you have to do in order for the Netduino to run again - is a soft reset enough or do you have to cycle power (i.e. USB)?

5. Can you talk to the Netduino from MFDeploy when it has stopped?

 

For this kind of long running "critical" stuff you could use a watch dog. I don't know if you can access the integrated watch dog from managed code but if not, there are watch dog modules/chips that you can connect externally. A watchdog could automatically restart your Netdunino every two hours or whatever as appropriate by power cycling (most reliable) or by issuing a reset.

 

Hi Hanzibal,

 

Thanks a lot for your valuable reply. The reason that I am replying late is becasue I was testing my Netduino+ based on your comments.

1. It is not dependent of my debugging. I have the same problem when I also run it in a non-debug environment.

2. Almost the same (the working time is not constant in both situation).

3. I didn't try.

4. Soft reset is enough.

5. I haven't tried it yet.

 

Honestly, I have no watch dog module. How does it understand when it should restart? Can I implement it in my code? Any advice would be appreciated.

 

Thanks again,

Mohammad




#49739 Netduino Plus stops running after a while

Posted by mohammad on 22 May 2013 - 12:13 AM in Netduino Plus 2 (and Netduino Plus 1)

Hi all,

 

Just to keep you updated, my problem was fixed by using a watchdog solution: http://forums.netdui...lus/#entry49735

Now, my device is working well and continuously for 10 days.

 

Thanks all specially Ziggurat29 for your valuable comments.




#48974 Netduino Plus stops running after a while

Posted by mohammad on 03 May 2013 - 06:55 AM in Netduino Plus 2 (and Netduino Plus 1)

fwiw, mohammad,  I have had a similar problem; in my case with ethernet.  an easy way to stimulate it:

 

*  have a persistent connection to my server.  this runs in a separate thread.

*  in the absence of other traffic, periodically I send heartbeat, and if connection is lost or non-responsive, it loops around to restore the connection, with appropriate backoff, etc.  this code is all thoroughly tested when running on desktop.  I can unplug cables, take interceding routers and server process up and down, and things are resilient.

*  if, however, I am running the same code on the netduino, if the server process it taken down

*  the netduino will detect it, try to reconnect (to the not-yet-back-up server process)

*  and hang forever

*  but only the thread that is handling the ethernet server connection is affected.  my other threads are lively.

*  I confirmed that, while in the fail mode with the locked ethernet thread, I can successfully issue a PowerState.RebootDevice() and at least restart the system.

 

The lockup you are experiencing seems to be similar, but I don't know what stimulates the problem in your case, so maybe it is different.  Anyway, here is what I have done to cope with it -- and mind you I haven't finished implementing yet because I'm on other things just now, so fair warning, but initial testing makes me confident that it works:

 

*  the netduino chip has a hardware watchdog, but it is not really available to us, alas.  so, in lieu of that....

*  I made a software watchdog.  (I also added a MAX824 (-compatible; I think it is actually a diodes inc chip) to my PCB, but that was last minute and I haven't written code for it)

*  the software watchdog works like this:

  *  all my various 'app services' (worker thread that do stuff, like handling the ethernet connection to my infrastructure)

  *  call a 'checkin' function with my 'watchdog service'.  that checkin() says 'reboot if you don't hear back from me in XXX ms, and oh please call this method if you reboot because someone else failed'

  *  a checkin discards any previous outstanding checkin

  *  the watchdog service periodically checks for expired checkin()s (Kentucky Fried Checkins?) and if any were found, it will issue the reboot

 

In my case, I did it this way because I already had all these app services coded, so I needed to retrofit to that impl.  They did handily have idle() methods which I could use those to do the checkin(), but the duration needed to vary because some activities would normally block for up to 3 min in some cases (like cranking up GSM).  The particulars of your design my mean you can do it more simply that I was able to do or think of.

 

hth; dave

 

 

Hello,

 

I just want to let you know that there is firmware with software watchdog added:

 

http://forums.netdui...o-plus/?p=47334

 

Maybe it will solve your problem.

 

Regards

 

 

Hello again Mohammad,
I really think you should read carefully what the other two guys just wrote, but in answer to your question, a watchdog normally listens to some kind of "alive beacon", "heartbeat" or "check-in" (like the others wrote). When the watchdog has not seen/heard the beacon for some pre-defined time (timeout), it issues a reset causing a "reboot". This way, a watchdog could keep your application from locking up.

Watchdogs are for the situations where you can't actually figure out why things eventually go wrong and so instead of trying to solve the actual issue, you simply restart the whole thing. This is a "when all else has failed" type of thing to do but sometimes it's the only thing to do. Personally, I would never trust a software watchdog, instead I want someone to "pull the plug" and then reinsert it again afterwards.

 

Hi All,

 

Thanks for your valubale comments. I am exactly doing as the same as Ziggurat29. Based on my understanding, I should reboot my Netduino after some time (e.g. 10 hours). At this time, the only thing I did was a software reboot by means of Powerstate.RebooteDevice(false). Is it right?

 

Thanks,

Mohammad





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.