Netduino home hardware projects downloads community

Jump to content

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

Ethernet, Real-Time Control and DotNetMF Threading

NetduinoPlus2 Threads Real-Time Ethernet

  • Please log in to reply
1 reply to this topic

#1 Howie Goodell

Howie Goodell


  • Members
  • PipPip
  • 28 posts

Posted 19 February 2013 - 09:17 PM

Hi --



Use Netduino Plus2 to make an Ethernet-to-specialized-serial interface for industrial control.  


Killer problem

Each round trip takes over 20 milliseconds; it needs to be 1-2.  



I think the delay comes because my control program is a simple loop running in one thread waiting for Ethernet data.  It sends and receives to the industrial HW on serial in ca. 1 MS; then sends results back on Ethernet.  Tracing shows the TCP/IP stack in a different thread, and I've read that each thread transition waits for a 10-millisecond clock tick.  Hence, the killer problem.


Possible solutions?

  • I don't think e.g. making my control code "event-driven" would make a difference, but I'm not an experienced C# programmer.  Any way to get either C# (or all-C++ interop code) into the same thread as the Ethernet I/O?  
  • I am recompiling the whole software just to include my tiny interop changes.  Is there some build option or high-level code switch to disable the multitasker and just have Ethernet and user code wait for each other?
  • If I ping the Netduino Plus2 before the C# program is downloaded, my laptop says it responds in less than a millisecond.  It's that performance I need: 500-1000 packets/second.  I'll happily make a little tweak, but I'll also dump  the whole .Net infrastructure (now that I can use JTAG debug); if that gets the job done quickest.  (For example, just hook the ping code -- the message size is perfect -- directly to my interop control code, and never load a C# program.  
  • Or I'll put completely different software on the board,
  • Go to different hardware.
  • ...

Argument for a tweak (if one is possible) is that bare-metal programming is perishable; in these few months I already had to rewrite my direct hardware control of the Atmel ARM UART in Netduino Plus to the the ST UART in Plus2.  The dotNetMF might be a way to future-proof the application.  However, it first has to work in the present ;-)


Suggestions anyone?



#2 NooM


    Advanced Member

  • Members
  • PipPipPip
  • 490 posts
  • LocationAustria

Posted 20 February 2013 - 08:06 AM

on .net you will never reach your goals, but as you mentioned, removing the .net stuff and coding

native will do the trick.


you can setup some of the free ide's to work with stm32.

there is some guides how todo that, but very few good tutorials for further stuff i found.

i got uart working in native, but thats it :P


st offers a "library" called cmsis, wich offers easier access to the chips features.


you still have to write a ethernet driver/tcp-ip stack than (or use lwip or simmiliar)

Also tagged with one or more of these keywords: NetduinoPlus2, Threads, Real-Time, Ethernet

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

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.