Possible bug and lacking feature in BBB bsp, GPIO API hooks

Federico Garcia Cruz federico.garciacruz at tallertechnologies.com
Wed Nov 11 18:51:44 UTC 2015

Hi all,
we've been working with the latest rtems on the Beaglebone and we've seen
the same behavior Steve B describes.
Finally we've found what is the source of this unexpected behavior.
As you could see in bbb-gpio.c, "rtems_gpio_bsp_multi_clear" and
"rtems_gpio_bsp_clear" they both use "mmio_set" on
the AM335X_GPIO_CLEARDATAOUT register of the beaglebone.
The problem is that" mmio_set" reads the current value of the register,
then it sets the bit of interest and then it writes this new value in the
AM335X_GPIO_CLEARDATAOUT, but according the datasheet of the AM355X, every
bit set in this register will produce a clear of the corresponding GPIO so
that every GPIO in 1 will be cleared.
We changed the "mmio_set" for "mmio_write" and then tested
"rtems_gpio_clear" and "rtems_gpio_multi_clear" and they are working fine.
Attached is the diff file.
Steve, could you please check if this fixes your problem too?

2015-11-07 16:33 GMT-03:00 Gedare Bloom <gedare at rtems.org>:

> On Sat, Nov 7, 2015 at 4:26 AM, André Marques
> <andre.lousa.marques at gmail.com> wrote:
> > Hello
> >
> > Às 17:31 de 02-11-2015, Steve B escreveu:
> >
> > I just looked at some sample code on Ketul's github, and the source code
> of
> > the API itself, rather than any actual documentation.
> >
> >
> > Documentation on the GPIO API can be found in
> >
> https://devel.rtems.org/wiki/GSoC/2015/RaspberryPi_peripherals_and_SD_card#RTEMSGPIOAPI
> >
> This deserves its own page.
> _______________________________________________
> users mailing list
> users at rtems.org
> http://lists.rtems.org/mailman/listinfo/users



Federico Garcia Cruz

Software Engineer

San Lorenzo 47, 3rd Floor, Office 5

Córdoba, Argentina

Phone: +54 351 4217888 / +54 351 4218211

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20151111/418fabcc/attachment-0002.html>
-------------- next part --------------
diff --git a/c/src/lib/libbsp/arm/beagle/gpio/bbb-gpio.c b/c/src/lib/libbsp/arm/beagle/gpio/bbb-gpio.c
index bd26051..6fa8a90 100644
--- a/c/src/lib/libbsp/arm/beagle/gpio/bbb-gpio.c
+++ b/c/src/lib/libbsp/arm/beagle/gpio/bbb-gpio.c
@@ -210,7 +210,7 @@ rtems_status_code rtems_gpio_bsp_multi_set(uint32_t bank, uint32_t bitmask)
 rtems_status_code rtems_gpio_bsp_multi_clear(uint32_t bank, uint32_t bitmask)
-  mmio_set(bbb_reg(bank, AM335X_GPIO_CLEARDATAOUT), bitmask);
+  mmio_write(bbb_reg(bank, AM335X_GPIO_CLEARDATAOUT), bitmask);
@@ -229,7 +229,7 @@ rtems_status_code rtems_gpio_bsp_set(uint32_t bank, uint32_t pin)
 rtems_status_code rtems_gpio_bsp_clear(uint32_t bank, uint32_t pin)
-  mmio_set(bbb_reg(bank, AM335X_GPIO_CLEARDATAOUT), BIT(pin));
+  mmio_write(bbb_reg(bank, AM335X_GPIO_CLEARDATAOUT), BIT(pin));

More information about the users mailing list