Native C libraries to GPIO pins?

David Culp
David Culp New Member Posts: 12
I just got my Up Board and have it set up and running. I want to transition a project I have been working on with the RPi 3 to the Up Board. The project is driving a large series of 32X32 RGB LED panels. In order to do this I have to trigger the GPIO pins extremely quickly to keep the display updated at 24 bpp color.

I see that some Python libraries have been ported and that is great. However, is there a native C library I can use and documentation to go with it?


  • Dan O'Donovan
    Dan O'Donovan Administrator, Moderator, Emutex Posts: 241 admin
    For a native C library, I suggest using libMRAA:
    We added support there for the UP board. It provides a C library, and also offers Python and Javascript and Java bindings on top.

    Regarding speed, however, the GPIO pins on the UP board cannot be toggled very quickly, even with C code. This is a hardware limitation that we've observed in the GPIO controller used in this Intel SoC. GPIO performance is about 10x slower, compared to Raspberry Pi 2.

    Also, something else to be aware of is that the C libraries for RPi that offer very fast GPIO access typically bypass the kernel driver and access the GPIO registers directly. Something like this could be implemented for UP - it still doesn't get around the fact that the GPIO hardware is 10x slower, but it can at least get around some of the inefficiencies inherent in access the GPIOs via the kernel sysfs interface. But this is not straightforward because there are 2 hardware components to be aware of - the GPIO controller in the SoC, and the CPLD on the board in between the SoC and the GPIO pins. The latter needs to be configured correctly according to the desired pin mode and direction. When you access the GPIOs via sysfs, in the range 0-27, the kernel drivers are taking care of this for you.
  • David Culp
    David Culp New Member Posts: 12
    Thanks for the info, I will give the library a try and see what kind of performance I can get out of it.

    In reality, to get the most amount of performance out of the RPi I do bypass the kernel driver and access the GPIO pins directly.