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.

Emilio x64

Member Since 18 Jul 2013
Offline Last Active Oct 01 2013 01:00 AM
-----

Topics I've Started

NetworkAvailabilityEventChanged event handler not working?

24 August 2013 - 02:55 AM

In doing my netduino networking code (UDP & TCP) I tried something that was suggested back in 4.2 to detect when the connection is broken due to the inherent limitations of the NETMF.

 

It was proposed to use the NetworkInformation.NetworkAvailabilityChanged event handler. Basically one defines the delegate method and in there depending on the e.IsAvailable property one would stop or resume network operations (tx/rx).

Microsoft.SPOT.Net.NetworkInformation.NetworkChange.NetworkAvailabilityChanged += new Microsoft.SPOT.Net.NetworkInformation.NetworkAvailabilityChangedEventHandler(NetworkAvailabilityChangedHandler);

I have no hardware yet so I was trying it on the emulator which is supposed to have already a "connection" to the host system. I placed a breakpoint on that event handler method but it never gets called.

private void NetworkAvailabilityChangedHandler(object sender, Microsoft.SPOT.Net.NetworkInformation.NetworkAvailabilityEventArgs e)        {            lock (this.threadLock)            {                if (e.IsAvailable)                {                    StartServices();                }                else                {                    StopServices();                }            }        }

There is no NETwork in Netduino Plus (2) ?

22 August 2013 - 02:34 PM

My netduino application *needs* to communicate with the server running on the PC to exchange information. This communication needs to be fast. I was told USB was not "possible" unless I implemented the whole USB stack which I must say is q HUGE task (I have seen some of the sources back in 2001). The usual serial communication is also not desirable because it doesn't fit into my scheme of designs.

 

So that leaves the ethernet connection. On the server side I already implemented the TCP server that listens for commands as well as the UDP that sends the "who is out there" broadcasts (unless somebody has a better idea).

 

Now, when I wanted to code my TCP & UDP parts in the .NET Microframework project using TcpClient and UdpClient I found them nowhere. Found some examples on the internet that claims it is present in the mfdpwsextensions.dll appearing under the System.Ext.Net namespace but neither adding a reference to that DLL nor the Microsoft.SPOT.Hardware.Net give me anything of use, not even the plain Socket.

 

What am I missing, can somebody help me out with this? I need them soon.


Roundtrip communication latency

16 August 2013 - 05:15 PM

I think my NETMF software is nearly on its last phases of development, I just hope it fits in Netduino Plus 2. Anyway, my NETMF application is supposed to run on the Netduino Plus 2 hardware and it would communicate with a service on the desktop to get some live information.

 

So that means the Netduino would send a request to the desktop and get some data in return. Since I haven't had the chance to try that on real hardware I would like to know what you can suggest me for this, USB or Ethernet? and what sort of roundtrip communication times I should be expecting.

 

My .NETMF state machine loop runs every 200ms and the service on the desktop would also be updating information around the same rate perhaps even a bit slower (like 1Hz).


Addressing Netduino Flash memory

14 August 2013 - 04:08 PM

I recently read that the Netduino Plus 2 (the device I have in mind and am developing for) has a certain amount of Flash Memory available for use by the application.

 

Since my application needs to persist in memory (across boot cycles) several values, I would like to know IF I can really use that flash memory and how I can access it from my NETMF application.


Timers not working right, more or less at the speed of light

08 August 2013 - 11:01 PM

In my NETMF application I make use of two types of Timers from System.Threading (is there a better one?).

 

One timer actually times the period of time a button is depressed, if it is less than 2 seconds X happens but if it is pressed for more than 2 seconds then Y happens. This is common in embedded devices.The timer is started when the NETMF application detects that the GPIO pin has gone low (active low) and it also detects when the button is released when the GPIO pin goes high. I am using I/O interrupts on both edges to detect the press/release.

 

The other timer is a loop processing timer which is used to periodically do the processing of signals and state transitions of my state machine. When a button is pressed for example a Pressed signal is put into the queue and at the next processing loop the signal is picked up from the queue and processed according to the state.

 

Now, I also found out that in NETMF Timers aren't what we are used to in the standard framework, namely that you can't start/stop them the usual way, they start as soon as they are created (unless a delay is specified) and they keep on running forever. The only way to stop it is by Disposing the timer instance and setting it to null so that it is garbage collected. I use 2000 (milliseconds) for the button press/release and originally used 200 ms for the loop processing.

 

Now, I am testing my "virtual device" and see that even if I click quickly on the button (much less than 2 seconds) the timeout signal is raised as if I had pressed the button for more than 2 seconds!!!

 

Am I missing something here? is there perhaps some NETMF setting that controls the time base of the timers? it appears to me that they are running at the speed of light and therefore what is supposed to be 2 seconds turns out to be more like 100 milliseconds!


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.