Speed, I am Speed….

So what’s the first thing you do when you get a new microcontroller to play with?

Blink an LED, of course!

MIND_BLOWN

And for that, you toggle a GPIO…

So now the question is how fast can your MCU toggle that juicy GPIO?

Recently, NXP sent me samples of their IMXRT Series of crossover MCUs.

MIND_BLOWN

These include the MIMXRT1172,MIMXRT1166,MIMXRT595 along with a devkit for the MIMXRT1166!

MIND_BLOWN

Now If you have not been living under a rock for the past few years (or are not into embedded systems in general),

You would know that NXP launched a new series of MCUs called the I.MX RT.

These are the fastest microcontrollers available on the market as of now.

Almost all of them sport an ARM Cortex M7 at minimum (some are M33), and some also have a secondary M4 core, but the most impressive thing is that These M7s are clocked at 500 MHz, 600 MHz, and even 1 GHz!

Those are some pretty incredible clocks for a MCU!! These clocks bridge the gap between a microcontroller core such as the M7 and an entry level application processor core from ARM such as the A8.

So coming back to our topic, how fast can this beast toggle a GPIO?

Well, with a normal GPIO we get the following result.

Here’s the setup:

MIND_BLOWN

On the MIMXRT1166 (600 MHz M7 core clock).

This is with interrupts disabled so that SysTick won’t bug us, and direct register toggling of the GPIO port.

while(1)
GPIO9->DR_TOGGLE = (1 << 30);

GCC’s optimisation level was set to -O3.

The code was run from M7’s ITCM.

Probing was done on a Rigol 1054Z hacked to unlock 100 MHz bandwidth.

MIND_BLOWN

Hmmmm, 5.43 MHz.. that’s nothing special to boast about :/

Let’s try to toggle a GPIO via PWM, that’s generally the fastest way to toggle a GPIO on any MCU.

On, MIMXRT1166, the PWM peripheral’s clock is derived from the system’s IGP clock, and the maximum (legally) we can set via the PLL is to about 200Mhz.

At 200 MHz with a 50% duty cycle, the most we can achieve is 100 MHz.So does it do that??

MIND_BLOWN

Damn! That’s impressive, this even falls under the FM band, and surprisingly enough, I hooked up a piece of wire to the pin header and was able to pick up the signal on an FM radio receiver!

So, 100 MHz is fast, but we still aren’t the fastest :/

ST’s offering, the STM32H7, can clock the PWM peripheral from a 275 MHz PLL, achieving a 138 MHz speed on the GPIO.

Damn I thought we could beat ST, :’( ….

But wait! say’s NXP, there’s one last trick left.

Introducing high-speed GPIOs

High speed GPIOs are tightly coupled to the M7 core, thus can be accessed with high frequency directly from the M7 core, bypassing the Corelink Network Interconnect, thus improving latency.

MIND_BLOWN

With high-speed GPIOs, we were able to achieve about 156 MHz!

Cool right?