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)
main.cpp
- Committer:
- stefanwaldschmidt
- Date:
- 2019-05-13
- Revision:
- 0:f122acadb07b
File content as of revision 0:f122acadb07b:
/* 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 } }