How fast can GPIO pins be read or written to?

Using Colibri T20 and Windows CE7.0 / Visual Studop 2008 C#, we have benchmarked the latency between GPIO pin toggles.

With Colibri Monitor 1.7 I have set all clocks to their max value (e.g. APB at 117MHz and CPU at 1GHz).

On the oscilloscope we can see that two consecutive toggles take a minimum of 5 useconds.

((byte*)pGPIORegs)[0x02C] = Convert.ToByte(“00100000”, 2); // OUTPUT 1
((byte*)pGPIORegs)[0x02C] = Convert.ToByte(“00000000”, 2); // OUTPUT 0

Why? Where is the bottleneck?

Any ideas?

We once made some measurements with writing to the GPIO registers directly as well but from native code. There we got much higher frequencies. Toggling a GPIO was bellow 1 us.

Write some native code, where you start the toggling in a thread. If this helps, you can later use PInvoke To start and stop the thread from .NET. Also try to disable DFS and increase the priority of the thread using CeSetThreadPriority.

If you need a more accurate signal with less Jitter, you may should consider using the PWM. You find more details in the PWM Lib API.