<div dir="ltr"><div><div>Attaching my init.c code now (I went through and trimmed out whatever was irrelevant).<br></div>Please give this a run and let me know if you see the same behavior.<br><br></div>Steve<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 2, 2015 at 9:31 AM, Steve B <span dir="ltr"><<a href="mailto:sbattazzo@gmail.com" target="_blank">sbattazzo@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>I just looked at some sample code on Ketul's github, and the source code of the API itself, rather than any actual documentation.<br><br></div>I have already made calls to rtems_gpio_initialize() and rtems_gpio_request_pin() as Ketul suggested.<br></div>I am about to go on travel but I will attach my code once tonight I get settled in, and maybe one of you can run it and see if you agree with me on the symptom.<span class="HOEnZb"><font color="#888888"><br><br></font></span></div><span class="HOEnZb"><font color="#888888">Steve<br></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Oct 31, 2015 at 6:45 AM, Gedare Bloom <span dir="ltr"><<a href="mailto:gedare@rtems.org" target="_blank">gedare@rtems.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This problem indicates a lack of clear documentation. Steve, where did<br>
you look for guidance on using the API?<br>
<div><div><br>
On Sat, Oct 31, 2015 at 5:11 AM, Ketul Shah <<a href="mailto:ketulshah1993@gmail.com" target="_blank">ketulshah1993@gmail.com</a>> wrote:<br>
> Hi Steve,<br>
><br>
> I suggest you to kindly configure GPIO API by using following functions in<br>
> your code,<br>
><br>
> rtems_gpio_initialize();<br>
> rtems_gpio_request_pin(.....);<br>
><br>
> After using it should work properly. Me and Ben had tested on our BBBs.<br>
><br>
> For example code you can have a loot at link.<br>
><br>
> Hope this helps.<br>
><br>
> Thanks,<br>
><br>
> Ketul<br>
><br>
> On 31 October 2015 at 05:11, Steve B <<a href="mailto:sbattazzo@gmail.com" target="_blank">sbattazzo@gmail.com</a>> wrote:<br>
>><br>
>> Hi again guys,<br>
>> I've noticed an unexpected (to me) behavior in the GPIO API for Beaglebone<br>
>> Black.<br>
>><br>
>> I borrowed a periodic task from the clock test source, and set it up to<br>
>> toggle the GPIOs once every couple seconds.. here's what I have:<br>
>><br>
>> rtems_task Test_task(<br>
>>   rtems_task_argument task_index<br>
>> )<br>
>> {<br>
>>   int task_count = 0;<br>
>>   rtems_time_of_day time;<br>
>>   rtems_interval    ticks;<br>
>><br>
>>   ticks = task_index * 2 * rtems_clock_get_ticks_per_second();<br>
>><br>
>>   for ( ; ; ) {<br>
>>     task_count++;<br>
>>     (void) rtems_clock_get_tod( &time );<br>
>>     if ( time.second >= 35 ) {<br>
>>       puts( "*** END OF CLOCK TICK TEST ***" );<br>
>>       //exit( 0 );<br>
>>       while(1);<br>
>>     }<br>
>>     put_name( Task_name[ task_index ], FALSE );<br>
>>     print_time( " - rtems_clock_get_tod - ", &time, "\n" );<br>
>><br>
>>     //Toggle GPIO<br>
>>     if(task_count & 1) {<br>
>>         rtems_gpio_set(LED1);<br>
>>         rtems_gpio_set(LED2);<br>
>>         }<br>
>>     else rtems_gpio_clear(LED1);<br>
>><br>
>>     (void) rtems_task_wake_after( ticks );<br>
>>   }<br>
>> }<br>
>><br>
>> Notice I've defined that if the least significant bit of my variable<br>
>> task_count is 1, then I set both LED1 and LED2. If that LSB is zero, I just<br>
>> call to clear LED1.<br>
>> When I actually run this, both LED1 and LED2 are being cleared! Same is<br>
>> true with the 3rd and 4th user LEDs as well, if I happen to set all four of<br>
>> them. So I think somehow rtems_gpio_bsp_clear() is clearing the entire bank,<br>
>> not just the single pin specified in the argument. Can somebody confirm this<br>
>> behavior?<br>
>> I will dig around and see if I can figure out why it's happening and<br>
>> generate a patch if I find it.<br>
>><br>
>> Also, I was hoping to be able to toggle a GPIO output by checking its<br>
>> current state and using that to decide whether to set or clear, but I don't<br>
>> see anything in the API that would allow me to check the state of an output.<br>
>> Is this a known/intended limitation?<br>
>><br>
>> Cheers,<br>
>><br>
>> Steve<br>
>><br>
>><br>
>><br>
>><br>
>> _______________________________________________<br>
>> users mailing list<br>
>> <a href="mailto:users@rtems.org" target="_blank">users@rtems.org</a><br>
>> <a href="http://lists.rtems.org/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/users</a><br>
><br>
><br>
><br>
> _______________________________________________<br>
> users mailing list<br>
> <a href="mailto:users@rtems.org" target="_blank">users@rtems.org</a><br>
> <a href="http://lists.rtems.org/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/users</a><br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>