On Thu, Jul 27, 2023 at 10:17:05PM +0100, andy pugh wrote: > On Thu, 27 Jul 2023 at 21:54, Kent Gibson <warthog618@xxxxxxxxx> wrote: > > > That is not how the line_bulk API is used. > > You don't request the lines separately and then add them to the bulk, > > you add them to the bulk then request them with > > gpiod_line_request_bulk_input(), or one of the other > > gpiod_line_request_bulk_XXX() functions. > > I did try that way first, but it didn't seem to be working for me. > I am currently upgrading the system to Bookworm (gpiod v1.6) to try again. > If you can repeat it, and ideally provide a failing test case, then we can take a look at it. > > Btw, the primary use case for the bulk is for when you need to perform > > operations on a set of lines as simultaneously as possible. > > I am trying to do things as quickly as possible on a predetermined set > of lines. > I am experimenting with gpiod as a replacement for an existing (and > no-longer-working) driver that is part of LinuxCNC. > > I suspect that gpiod won't be fast enough, ideally I would like to be > able to write to 15 IO lines in 15µs. (because the code will run in a > realtime thread which can't overrun) > (There are other reasons that it might not work too, you can probably > think of more than I can) > Depends on what Pi you are on. A Pi Zero would struggle, but on a Pi4 that is doable, of course depending on what else you are doing. That is based on benchmarking libgpiod v2, but I would expect v1 to be similar. On a Pi is it significantly faster to go direct to hardware using /dev/gpiomem, rather than going via the kernel as libgpiod does. I do my best to avoid using gpiomem these days, but if you really need to minimize CPU cycles or latency then that is another option. Cheers, Kent.