Possible bug and lacking feature in BBB bsp, GPIO API hooks
Ketul Shah
ketulshah1993 at gmail.com
Wed Nov 11 20:09:58 UTC 2015
Dear Federico Garcia,
Yes, I got the point. So "A read of the GPIO_CLEARDATAOUT register returns
the value of the data output register (GPIO_DATAOUT)" is the key point
behind this bug.
Thanks for reporting and debugging.
Ben, I think we should add the patch after proper test.
Also we should use mmio_write() in rtems_gpio_bsp_multi_set()
and rtems_gpio_bsp_set() too that uses GPIO_SETDATAOUT register.
Regards,
Ketul
On 12 November 2015 at 01:08, Federico Garcia Cruz <
federico.garciacruz at tallertechnologies.com> wrote:
> Ketul,
> you should use the mmio_write() in the gpio clear bit register, if you
> mantain the value of the complete bank you would clear not just the gpio
> number that you want but all the gpios that current value is 1.
> Here's what the data sheet says about this register:
>
> GPIO_CLEARDATAOUT is shown in Figure 25-31 and described in Table 25-30.
> Writing a 1 to a bit in the GPIO_CLEARDATAOUT register clears to 0 the
> corresponding bit in the
> GPIO_DATAOUT register; writing a 0 has no effect. A read of the
> GPIO_CLEARDATAOUT register
> returns the value of the data output register (GPIO_DATAOUT).
>
> It's described in the section 25.4.1.25 GPIO_CLEARDATAOUT of the
> AM335x_technical_reference_manual.pdf.
>
> 2015-11-11 16:29 GMT-03:00 Ketul Shah <ketulshah1993 at gmail.com>:
>
>> Hi All,
>>
>> Dear Federico Garcia,
>>
>> I really appreciate your great efforts. My views on this are :-
>>
>> Following are the macros from bsp.h
>>
>> #define mmio_write(a,v) (*(volatile uint32_t *)(a) = (v))
>> #define mmio_set(a,v) mmio_write((a), mmio_read((a)) | (v))
>>
>> So purpose of using mmio_set() is to make change on the desired bit only
>> (not the whole bank).
>> While using of mmio_write() will always make change on 32 bits (Value of
>> desired bit would be 1 and rest would be forced to 1), the bank.
>>
>> However I will try to test your code too on my BBB after a small Diwali
>> vacation.
>>
>> Latest RTEMS was tested OK by me as well as Ben.
>>
>> Thanks & Regards,
>> Ketul
>>
>> On 12 November 2015 at 00:21, Federico Garcia Cruz <
>> federico.garciacruz at tallertechnologies.com> wrote:
>>
>>> 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?
>>> Thanks.
>>>
>>> 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
>>>>
>>>
>>>
>>>
>>> --
>>>
>>> <http://www.tallertechnologies.com>
>>>
>>>
>>> Federico Garcia Cruz
>>>
>>> Software Engineer
>>>
>>>
>>> San Lorenzo 47, 3rd Floor, Office 5
>>>
>>> Córdoba, Argentina
>>>
>>>
>>> Phone: +54 351 4217888 / +54 351 4218211
>>>
>>>
>>> <http://www.linkedin.com/company/taller-technologies>
>>> <https://www.facebook.com/tallertechnologies>
>>>
>>> _______________________________________________
>>> users mailing list
>>> users at rtems.org
>>> http://lists.rtems.org/mailman/listinfo/users
>>>
>>
>>
>
>
> --
>
> <http://www.tallertechnologies.com>
>
>
> Federico Garcia Cruz
>
> Software Engineer
>
>
> San Lorenzo 47, 3rd Floor, Office 5
>
> Córdoba, Argentina
>
>
> Phone: +54 351 4217888 / +54 351 4218211
>
>
> <http://www.linkedin.com/company/taller-technologies>
> <https://www.facebook.com/tallertechnologies>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20151112/fbb66b87/attachment-0002.html>
More information about the users
mailing list