Skip to content

netduino GPIO speed test

January 22, 2011

Atari ST - Circa 1989

I wanted to figure out the kind of throughput achievable through bit-banging on GPIO pins on the netduino.

The basic idea for the test was to flip a bit as fast as possible on a single output pin connected to an LED with a ~215 ohm resistor,  measuring the frequency of the changes on an oscilloscope.

The little code snippet below is about as simple as it gets for this test.

using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;

namespace GPIOSpeedTest
{
public class Program
{
public static void Main()
{
var d0 = new OutputPort(Pins.GPIO_PIN_D0, false);

while (true)
{
d0.Write(true);
d0.Write(false);
}
}
}
}

The result turned out to be surprisingly low, clocking in @ 8.4 kHz!

8.4 kHz

8.4 kHz = 8400 bits / sec = 1050 bytes / sec.

To put things into perspective, according to the list of device bit rates on Wikipedia, 8.4 kHz lands us right around modem technology circa 1989.

Ah! To feel young again ;-)

Fortunately, extremely fast serial protocols, such SPI and I2C, are built into the ARM 7 hardware powering the netduino and are easily accessible from the .Net Micro Framework.

Cheers,

-Fabien.

About these ads

From → netduino

3 Comments
  1. Ouch … that is pretty slow, but I suspect it’s the way they’ve implemented the GPIO in the port to their HW rather than something specific to the NETMF (though it’s been a while since I’ve worked with it as well). I would have expected something faster even with the different layers you have to go through to get to the specific GPIO data register. It might be worth bringing this up with the Netduino people since there’s obviously a lot of room for improvement here.

Trackbacks & Pingbacks

  1. What Is an Arduino Shield and Why Should My Netduino Care? | Coding4Fun Articles | Channel 9

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 237 other followers

%d bloggers like this: