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.
Photo

Analog I/O


  • Please log in to reply
6 replies to this topic

#1 krst

krst

    New Member

  • Members
  • Pip
  • 6 posts

Posted 11 August 2010 - 07:06 AM

Hi Beeing kinda a newbie into the whole microcontroller thing, especially into .net, but still just order a netduino I do have some question about the speed of the inputs. I read in the arm chip datasheet that the analog input kan sample up to around ~300k samples/s. Do you have any test data of this to what is an expected maximum speed?! Also, real time timing? I have read about the FEZ for example that the timing is not in realtime? However I guess there is ways to go around this or? (my aim is to use a high speed linear aray, at frame rates up to 1000fps so timing would be critical) Thanks in advance!

#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 11 August 2010 - 04:49 PM

Beeing kinda a newbie into the whole microcontroller thing, especially into .net, but still just order a netduino I do have some question about the speed of the inputs. I read in the arm chip datasheet that the analog input kan sample up to around ~300k samples/s. Do you have any test data of this to what is an expected maximum speed?!


In managed code (i.e. C# .NET code), you can probably get 10,000's of samples per second. We haven't measured it, but now that you've asked I'm sure that someone in the community or here at Secret Labs will measure it to know for sure... Also, if you compile the firmware as "RTM" (without debug support) your speed goes up even more...since the .NET MF runtime doesn't have to look for the debugger.

And if you wanted to erase your Netduino and write native C++ code, you'd of course get the full # of samples/sec specified in the MCU's datasheet.

Also, real time timing? I have read about the FEZ for example that the timing is not in realtime? However I guess there is ways to go around this or? (my aim is to use a high speed linear aray, at frame rates up to 1000fps so timing would be critical)


.NET Micro Framework is a managed code runtime with garbage collection, cooperative multitasked threading, etc. So yes, it's not a realtime OS. For realtime operations, you'll want to use a second MCU or erase the Netduino and write native C++ code. Most projects just need quick processing (predictability in the order of milliseconds, not microseconds), so Netduino works well for most projects.

If you're doing really high speed stuff with very tight timing, I'd recommend using C++ natively. Or perhaps writing C++ interrupt-driven code and compile it into the Netduino firmware. That way you'd get the raw speed of C++ behind the scenes but the elegance of native code for your logic operations.

Does that give you a good start?

Chris

#3 RuggedCircuits

RuggedCircuits

    Member

  • Members
  • PipPip
  • 17 posts

Posted 11 August 2010 - 07:08 PM

If you're doing really high speed stuff with very tight timing, I'd recommend using C++ natively. Or perhaps writing C++ interrupt-driven code and compile it into the Netduino firmware. That way you'd get the raw speed of C++ behind the scenes but the elegance of native code for your logic operations.

Chris


So.....suppose one does want to write C++ native code. Can this be loaded into the Netduino using the existing tools or is a special bootloader needed? I don't suppose you can add this to your list of tutorials :)

Does "going native" preclude the use of the CLR-based development in the future?
Rugged Circuits LLC / <http://ruggedcircuits.com>

#4 krst

krst

    New Member

  • Members
  • Pip
  • 6 posts

Posted 11 August 2010 - 07:54 PM

Thanks Chris That was interesting info. I have already seen that you given some tips for how to transform the netduino for native programing in the latest patch uppdate info. My programmings skill are still far away but i guess it will not take long until some users pull this one off. I do see a future using two units where one is doing realtime calculations and aqusition and the second unit is running the .net framework for some higher level programing, maybe this board layout will come with time to! :-) I have my unit still with the post, but if not someone else does it, i will run some simple code to test the read/write speeds of the i/o ports with a oscilloscope.

#5 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 11 August 2010 - 09:04 PM

So.....suppose one does want to write C++ native code. Can this be loaded into the Netduino using the existing tools or is a special bootloader needed? I don't suppose you can add this to your list of tutorials :)


If you wrote native C++ code, you'd use .NET Micro Framework interop. And then recompile the Netduino firmware with your native code (and corresponding managed code classes) built in! Here's a good "tutorial" of sorts.
http://adeneo-embedd...-framework.html

You use MFDeploy to deploy your updated firmware. If you need to change the memory layout, erase the Netduino and deploy TinyBooter via SAM-BA. That's it!

Does "going native" preclude the use of the CLR-based development in the future?


You can mix and match. .NET Micro Framework is basically a managed code layer sitting on top of raw native code. Your application logic sits in managed code land and the low-level stuff runs in C++. It's a nice mix.

But if you want to go 100% native, you can do that too. The ERASE pad is right underneath the D0 pin :)

#6 Squintz

Squintz

    Advanced Member

  • Members
  • Pip
  • 9 posts
  • LocationMaryland

Posted 11 August 2010 - 09:44 PM

But if you want to go 100% native, you can do that too. The ERASE pad is right underneath the D0 pin :)


We want to experiment with this at harford hackerspace. Can you provide a little more insight? When you say native are you talking about assembly or is there a C++ compiler that you know will work with this chip.
Harford Hackerspace - Collaborate, Learn, Socialize! Visit us if you are in the Baltimore, MD area!

#7 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 11 August 2010 - 09:51 PM

We want to experiment with this at harford hackerspace. Can you provide a little more insight? When you say native are you talking about assembly or is there a C++ compiler that you know will work with this chip.


Assembly or C++. For C/C++, you can use GCC (which is free). You can use the free version of IAR (which we like a lot). You can also use RVDS (which isn't free).

Here are some sample native C++ projects for the AT91SAM7X512 processor, compatible with a few compilers:
http://www.atmel.com...t91sam7x-ek.zip

For most applications, a little bit of custom C++ can be compiled into the Netduino firmware. For a few applications, 100% native C++ makes a lot of sense.

Eventually, we'd like to find a way to enable the user to load native C++ interop code as a resource in their C# Netduino app.

Chris




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.