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

netduino plus 2 execution speed expectations

speed throughput

  • Please log in to reply
8 replies to this topic

#1 Szpiro

Szpiro

    New Member

  • Members
  • Pip
  • 3 posts

Posted 18 January 2013 - 11:07 PM

The (release) code below produces 11usec pulses with a 45usec period. This implies that a simple  floating point operation take 11usec. This is incredibly slow for a Cortex F4 with 168MHz clock. Am I expecting too much from the CLR operation? :mellow:

 

Thanks,

 

Amos Szpiro

 

	public static void Main()	{		double f1, f2;		var ledPort = new OutputPort(Pins.ONBOARD_LED, false);		var tmPort = new OutputPort(Pins.GPIO_PIN_A0, false); 		while (true)		{			f1 = 1.25;			tmPort.Write(true);			f2 = 1.21 * f1;			tmPort.Write(false);			ledPort.Write(true);	// turn on LED			//Thread.Sleep(500);	  // wait 500 ms 			ledPort.Write(false);   // turn off LED			//Thread.Sleep(500);	  // wait 500 ms		}	}


#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 19 January 2013 - 03:15 PM

Hi Amos, .NET Micro Framework is interpreted, so it can take quite a few instructions to execute your managed code. That said, native functionality like SPI transfers and networking run at full native code speed. So you can do "command and control" via elegant NETMF code and then let the native code take care of the rest. Are there specific things you'd like to do with NETMF which require raw native speed from managed code? Perhaps there are some classes we could create to facilitate broad use case scenarios (like bit-banging). BTW, you can compile your own native code features directly into the firmware and call them from .NET MF. And of course you can use Netduino Plus 2 as a really nice, inexpensive, network-enabled STM32 devboard for native code development. Chris

#3 Szpiro

Szpiro

    New Member

  • Members
  • Pip
  • 3 posts

Posted 20 January 2013 - 12:30 AM

Hi Chris,

 

Thanks for the explanation.

 

The little board is of superb quality and works exactly as documented. I even updated to Firmware 4.2.2 per your instructions.

 

My current project involves a front end for an ultrasonic ranger. I want to sample the 40 KHz echo at 400 KHz, and send the data to the PC for processing. The duration of the sampler could be up to 20 MSec (about 10 feet).

 

Do you see a way of doing this under CLR?

 

 

Thanks,

 

Amos



#4 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 20 January 2013 - 11:44 AM

I don't know what kind of output your ranger has but it might interrest you to know that Netduino will buffer interrupts and time stamp them correctly, so maybe you can take advantage of this. I'm not sure you can setup an interrupt to fire on an analogue comparator condition. There are other options too.

#5 Szpiro

Szpiro

    New Member

  • Members
  • Pip
  • 3 posts

Posted 20 January 2013 - 04:46 PM

Sorry for not being clear.

 

I'm building an experimental ranger, not using one. The concept requires the ADC to sample at 400KHz into a buffer that is 16,000 bytes long,  then sending the buffer to Windows using a UART.



#6 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 20 January 2013 - 06:19 PM

I see, according to the d/s the hw itself can do max 2.4MSPS using a single AD so no problem there but I don't think 0.4MSPS is possible in managed code. In fact, I doubt you can spin 400kHz even in a tight loop, let alone on a timer interrupt. But why 10x sample rate? According to Nyqvist, a minimum 2x is required but maybe 4x would suffice in producing a good enough result, if your requirements allow it that is. It might be possible to spin 160kHz during the 20ms and the buffer could be smaller allowing faster PC transfers. Naturally, I could be wrong though. Btw, the STM32F4 is an ARM Cortex M4 implementation. @Chris: A class to manage a burst of high freq sampling into a buffer using DMA would be nice :-) or maybe there is one already?

#7 jiwonoh

jiwonoh

    Advanced Member

  • Members
  • PipPipPip
  • 42 posts

Posted 03 February 2013 - 08:34 AM

If you want to use Uart, I think you sould compile netduino source for receiving and sending data very quickly. The inner part of source, the buffer size of UART's RX/TX is set as just 256 bytes. I modified the info. for increasing buffer size, so it can include more data than before.

 

I also leading project related with fast sampling device based on NP2. I faced many problems in performance. .NET MF is not that fast as you want to do.



#8 yassine

yassine

    New Member

  • Members
  • Pip
  • 1 posts

Posted 20 July 2013 - 03:22 PM

HI

Chris Walker

how i can mak my native code i need a full speed of my netduino plus 2 for mak 64x64 LED matrix

best regard



#9 gst0098

gst0098

    New Member

  • Members
  • Pip
  • 1 posts

Posted 04 December 2013 - 10:09 AM

Hi to all, I'm new to this forum and to Netduinos in general.

 

I have a question regarding the floating point unit of the netduino 2 plus, I'm searching a fast microcontroller and i hoped that the ND2+ was the right choice as it has the floating point unit that I need. From my early tests (some trigonometric computations) I was disappointed by the performance of it, I'm aware that being interpreted code it has to be much slower than compiled code, but I found that it performs slower (and I think that it shouldn't) than a microcontroller based on atmel sam3 that has not the FP unit, but with compiled code.

At this point I have a question, does .NETMF support the floating point unit of NP2+ ?

I'm quite sure (considering the obtained performances) that it does not, and i suspect that FP operations are computed in software.

 

If so the only alternative I have is probably to go native, but I must admit that I did not check yet how to do it.

And of course I have to find the way to go native *with* the FPU, as it is not straightforward that does exists a toolchain that support it.

It would be very appreciated if someone can give hints or tutorial to follow for going native with support to FPU.

 

Best regards to all,

Giuseppe






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.