Test maximal GPIO output performance by toggling a GPIO output pin as fast as possible.

This mbed program creates a thread with Realtime Priority to do nothing but to toggle a GPIO output as fast as possible.

Measurements are performed on a NUCLEO-F767ZI board https://os.mbed.com/platforms/ST-Nucleo-F767ZI/.

  • STM32F767ZIT6 @ 216 MHz
  • Duration of high or low phases: 4 nsec - 10 nsec (resulting is something from 50 MHz to 125 MHz)
Revision:
0:f122acadb07b
diff -r 000000000000 -r f122acadb07b main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon May 13 12:28:40 2019 +0000
@@ -0,0 +1,35 @@
+/*
+   Test GPIO-output toggle time
+
+   Hardware: NUCLEO-F767ZI
+     STM32F767ZIT6 @ 216 MHz
+   Libraries:
+     mbed-os-5.12.3
+   Measured gpio_out frequency
+   * total period: 8 nsec - 20 nsec (125 MHz - 50 MHz)
+*/
+
+#include "mbed.h"
+
+DigitalOut gpio_out(PC_8);
+
+void run()
+{
+    while (true) {
+        gpio_out = 1;
+        gpio_out = 0;
+        gpio_out = 1;
+        gpio_out = 0;
+    }
+}
+
+int main()
+{
+    Thread *thread  = new Thread(osPriorityRealtime);
+
+    thread->start(run);
+
+    while (true) {
+        wait(0.1); // 100 ns
+    }
+}