Jump to content

Java based GPIO via MMIO fast (compared to gpiod)!


Recommended Posts

Posted

OK, playing around with NanoPi Duo (H2+) to see what kind of performance boost I can get using MMIO (/dev/mem) instead of gpiod (forget sysfs) and it was pretty impressive. I used pre-calculated offset to run a square wave (rapid on/off) on pin 203 IOG11 and I hit ~3.8 MHz compared to ~500 KHz using gpiod. You can take a peek at the source at https://github.com/sgjava/java-periphery/blob/master/src/main/java/com/codeferm/periphery/demo/MmioTest.java. So the idea is how to make this generic with boards with multiple GPIO chips and different register configurations. The cool thing is the underlying MMIO stuff is kernel cross platform. Any ways I've been thinking about this for a while and now it's more of a reality.

 

This was with 32 bit writes, I haven't tried 8 bit writes to see what the difference is.

 

18:20:05.423 [main] INFO  com.codeferm.periphery.demo.MmioTest - 3832959.62 writes per second

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines