libgpiod on Beaglebone AI

Well, toggling python using gpiod is around 6.5KHz for one pin and about half that for two. Which is what you expect since it’s looped.

My code is a bit sloppy. I keep reopening the and closing the file rather than using a lseek().

Using lseek() is about the same speed as the python.

There’re two options to control the 32 outputs of a GPIO subsystem:

  1. writes to register GPIO_DATAOUT, or
  2. writes to registers GPIO_SETDATAOUT and GPIO_CLEARDATAOUT
    In the first case all pins switch at the exact same time. But there’s a downside in controlling all 32 pins at once: it may override changes on lines controlled by other software.

The second option is a convenient way to avoid that overriding. The registers GPIO_SETDATAOUT and GPIO_CLEARDATAOUT can be used to change only the masked pins. As long as only one register is necessary (ie all pins set, or all pins cleared) the change is at the exact same time. In contrast when performing mixed changes (some pins set, others cleared) you’ll see a delay between the output changes depending on the L3 latency.

@Mark

In order to testing gpiod you should use mixed changes

while true; do gpioset 1 18=0 19=1 gpioset 1 18=1 19=0 done

Regards

BTW:
Changing multiple pins on the same chip all at once is supported in libpruio since version 0.0 (2014, kernel 3.8).