Faster GPIO on XU4
-
- Posts: 78
- Joined: Mon Dec 29, 2014 7:47 am
- languages_spoken: english
- ODROIDs: C1, C1+, C2, XU4
- Has thanked: 1 time
- Been thanked: 4 times
- Contact:
Faster GPIO on XU4
I'm working on a light weight cross platform IO library for Java called Java Periphery https://github.com/sgjava/java-periphery which can use MMIO for GPIO updating registers directly instead of using GPIO device or deprecated sysfs interface. Using GPIO device I get 44 KHz (square wave) and using MMIO I get 300 KHz. I've seen where people have said you can get 2-3 MHz, but I've not seen that. Also, I'm only using a single core. With my Allwinner boards I get 2+ MHz on a single core using same exact code.
- odroid
- Site Admin
- Posts: 40816
- Joined: Fri Feb 22, 2013 11:14 pm
- languages_spoken: English, Korean
- ODROIDs: ODROID
- Has thanked: 3098 times
- Been thanked: 1709 times
- Contact:
Re: Faster GPIO on XU4
Try our wiringpi library to narrow down root causes.
https://wiki.odroid.com/odroid-xu4/appl ... o/wiringpi
https://wiki.odroid.com/odroid-xu4/appl ... o/wiringpi
-
- Posts: 78
- Joined: Mon Dec 29, 2014 7:47 am
- languages_spoken: english
- ODROIDs: C1, C1+, C2, XU4
- Has thanked: 1 time
- Been thanked: 4 times
- Contact:
Re: Faster GPIO on XU4
It's an apples and oranges kind of thing. Firstly, I'm running Armbian with a 5.4.x kernel. Secondly, I'm trying to stay away from deprecated interfaces such as sysfs and wiringPi (although I did look at the wiringPi XU3/XU4 code). I'm using /dev/mem and register mappings to keep my MMIO code board cross platform. I see there's /dev/gpiomem, so I'm going to test this since it should be a bit safer than /dev/mem.
-
- Posts: 9
- Joined: Tue May 06, 2014 8:03 am
- languages_spoken: english
- ODROIDs: XU4
- Has thanked: 2 times
- Been thanked: 2 times
- Contact:
Re: Faster GPIO on XU4
Looks like I'm a little late to the party, but I'm currently setting up servo signals with my XU4 using C and the memory mapped gpio registers. I've been able to get somewhat reasonably accurate timings using bitbanging with an thread running real time. Still not as good as what I could get off a microcontroller, but much better than what I get without the RT!
- mctom
- Posts: 2744
- Joined: Wed Nov 11, 2020 4:44 am
- languages_spoken: english, polish
- ODROIDs: OGA, XU4, C2, M1, H3+, SP3, Vu8M
- Location: Gdansk, Poland
- Has thanked: 368 times
- Been thanked: 481 times
- Contact:
Re: Faster GPIO on XU4
I had the same problems with my pistackmon projects, where I bitbanged serial data to emulate PWM on 16 LEDs. It worked quite well with C++LikeSmith wrote: ↑Sun Feb 19, 2023 2:37 pmLooks like I'm a little late to the party, but I'm currently setting up servo signals with my XU4 using C and the memory mapped gpio registers. I've been able to get somewhat reasonably accurate timings using bitbanging with an thread running real time. Still not as good as what I could get off a microcontroller, but much better than what I get without the RT!
sleep_until
, and incrementing the target time by fixed amount on each cycle. It was more stable than a comparable sleep_for
.I'm taking about 50us resolution here, so as you said, not comparable to microcontroller performance at all.

Who is online
Users browsing this forum: No registered users and 2 guests