Hi all, has anyone measured how fast GPIO pins can be toggled from the i.MX6? With the SAM3X on my Arduino Due I've managed to switch pins (for reading or writing) at about 10MHz and I wanted to know how fast the i.MX6 can do it. Also the SAM3X can switch a port of pins together, so with a single instruction you can read/write up to 32 pins at the same time, can the i.MX6 do it or you have to toggle one pin at time?
Hi, using this bash code for testing: #!/bin/bash echo "Test gpio 55 speed (ARDUINO D52) " echo out > /sys/class/gpio/gpio55/direction for (( i=0; i<10000; i++ )) do echo 1> /sys/class/gpio/gpio55/value echo 0> /sys/class/gpio/gpio55/value done echo "finish" save it and then run: $ time ./gpioSpeedTest it rerurns real 2.471 user 1.390 sys 1.080 pcpu 99.95 So definetly you generate a 2.471 / 10000 = 0.000247 sec period 1/ 0,000247 = 4048 Hz I think you can go faster using c language. Regards
For fastest performance, you may want to consider bypassing Linux' /dev/gpio driver and "poking" the i.MX6 CPU's memory-mapped GPIO registers directly. See the imx-utils/devregs.cpp code published by Boundary Devices, which includes a partial register-map file, and the (huge!) IMX6DQRM reference manual from Freescale for more detail. Of course doing this requires root privileges, and any mistakes (even *reading* from the wrong register) can easily crash your board. With the current GPIO driver, reading back the state of outputs via /dev/gpio doesn't work anyway (they are not tracked by the kernel and always return zero), so at least there's no further concern about those getting out of sync.
I have the same question for Udoo Neo. How fast can the cortex-M4 processor can toggle the gpio pins? As the M4 processors clock's clock speed is 200MHz, is it possible to generate a 100MHz square wave using M4 processor and arduino IDE ?
We have never tried it, I guess nobody knows. If you will discover it please share the results with the community. Anyway this doesn't not seem a question for UDOO 101, which is meant to answer basic questions for total beginners, not specific technical questions - this is a suggestion for next time. Best regards