On Thu, Mar 6, 2014 at 4:25 AM, <[email protected]> wrote:

> All the examples and libraries (Python mostly) that I can find for
> doing IO to the GPIO pins seem to handle only a bit at a time.  This
> is fine for things like driving relays and LEDs but makes little sense
> for 8-bit data.
>
> Are there any sets of 8 GPIO pins that can be used together easily for
> outputting 8-bit data?


>From a hardware standpoint, some of the GPIOs are in the same bank and can
be updated in the same register write.

See the TRM at http://www.ti.com/product/am3359.

You have options of using the GPIO_DATAOUT, GPIO_SETDATAOUT and
GPIO_CLEARDATAOUT registers. Up to 32 GPIOs can be controlled by each of
these registers. The GPIO numbers are given in the format GPIOx_y where x
is the bank that will be in a single register and y is the offset within
the register.

Of course, it might be more practical for you to utilize the GPMC bus when
looking to do parallel operations, especially if you want to use DMA or
otherwise perform repeated accesses.

The following blog post shows an example of using 'mmap' to configure and
utilize the GPMC bus:
http://engineersofthecorn.blogspot.com/2012/06/faux-gpmc-interfacing-with-beaglebone.html

There is a GPMC driver in the kernel at
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arm/mach-omap2/gpmc.c
.

I'm not sure how to use it.

You can also use the PRU for fast parallel bus access.



>  ... and are there any Python IO libraries that
> make doing this easy?
>

I'm not aware of any that make it possible today, though it could be
possible. Most typically, from Linux userspace it is common to utilize the
SYSFS entries provided by the kernel to perform GPIO entries.

See the Linux kernel documentation on SYSFS entries at
https://www.kernel.org/doc/Documentation/gpio/sysfs.txt.

It is, however, possible to access the GPIO registers directly from within
Python using 'mmap':
http://www.alexanderhiam.com/tutorials/beaglebone-io-using-python-mmap/
http://hackaday.com/2013/12/07/speeding-up-beaglebone-black-gpio-a-thousand-times/

Adafruit_BBIO uses the SYSFS entries as can be seen at
https://github.com/adafruit/adafruit-beaglebone-io-python/blob/557448a13780149c1ca1f3116262dc4fd002adf2/source/event_gpio.c#L262
.

PyBBIO uses 'mmap' as can be seen at
https://github.com/alexanderhiam/PyBBIO/blob/81a4a22a3a0c7805db80605edb3212dd4646673c/bbio/platform/beaglebone/gpio.py#L34
.

The 'mmap' method exposes the registers. Despite the PyBBIO library not
exposing a function today that would perform writes to multiple pins at
once, it should be possible to modify the code to expose new functions.


>
> At present my Python code is carefully masking, shifting and
> outputting the data bit by bit and I have a horrible suspicion that
> the library I'm using is carefully doing the opposite before it does
> the actual write to GPIO. :-)
>

What library are you using?


>
> --
> Chris Green
> ยท
>
> --
> For more options, visit http://beagleboard.org/discuss
> ---
> You received this message because you are subscribed to the Google Groups
> "BeagleBoard" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to