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)

Files at this revision

API Documentation at this revision

Comitter:
stefanwaldschmidt
Date:
Mon May 13 12:28:40 2019 +0000
Commit message:
initial commit

Changed in this revision

.gitignore Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.gitignore	Mon May 13 12:28:40 2019 +0000
@@ -0,0 +1,4 @@
+.build
+.mbed
+projectfiles
+*.py*
--- /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
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-os.lib	Mon May 13 12:28:40 2019 +0000
@@ -0,0 +1,1 @@
+https://github.com/ARMmbed/mbed-os.git/#0f959dbe4749c20416236e4fe1dac5692cbe18ab