GPIO Timing On The FEZ Domino

As I mentioned in a previous post, I’ve been playing with the FEZ Domino board and the RGB LCD Shield distributed by NKC Electronics. This display uses a synchronous serial protocol similar to SPI but requires a fourth wire to indicate is a byte is a command or data.

This fourth line can be implemented by setting an I/O line directly. The .NET MicroFramework provides functions to do this but in the interest of having the fastest code possible I decided to check out the GHI extensions to see if accessing the underlying controller registers directly provide any speed advantage.

The FEZ Domino is built on the LPC23XX family of ARM-based microcontrollers and a description of the registers used to manipulate the I/O lines can be found in Section 10.5, Table 133 of the LPC23XX Users Manual. To test which method is fastest I configured one of the digital lines as an output and ran three different cases. The first case used the .NET MicroFramework functions to establish a baseline. The second case wrote values directly to the LPC23XX FIOSET/FIOCLR/FIOMASK registers.  These registers correspond to the similarly named functions in the .NET MicroFramework.  The third case set the line levels by writing to the FIOPIN register. In all cases a continuous WHILE loop was set up to set the line high then immediately pull it low. A logic analyzer was used to measure amount of time the pin spent high. Results of the three cases are shown in the table below.

.NET Functions FIOSET/FIOCLR/FIOMASK FIOPIN
Time (µsec) 37 40 39

Based upon these results, it appears the amount of time it takes to manipulate the I/O lines  is practically independent of the method used. If anything, accessing the I/O registers directly appears to take longer than using the .NET functions. The similarity in times is probably because the time spent in the MicroFramework dominates the time spent accessing the I/O lines. In any case, it indicates that if you are doing direct I/O line manipulation you might as well stick with the functions provided in the framework. There is no advantage to accessing the I/O registers directly.

Advertisements

2 Comments

  1. Hammi33

    So you that you can toggle the pins no faster than 2.7 kHz (=1/(37 µsec)) ?

    • joesugar

      That’s how it appears, at least if you are manipulating the pins directly.

Tabula Candida

Doodles of a distracted historian

rtl-sdr.com

A blog about RTL-SDR (RTL2832) and cheap software defined radio

DuWayne's Place

Computers, Electronics, and Amateur Radio from KC3XM

QRP HomeBuilder - QRPHB -

Computers, Electronics, and Amateur Radio from KC3XM

Open Emitter

Computers, Electronics, and Amateur Radio from KC3XM

Ripples in the Ether

Emanations from Amateur Radio Station NT7S

m0xpd's 'Shack Nasties'

Computers, Electronics, and Amateur Radio from KC3XM

%d bloggers like this: