Two other features of going low level with mmap:

     Open drain output: By controlling the output enable registers, you can 
do open drain by setting the output to drive 0, then enable output to pull 
low, disable output to for high (with external pullup or internal through 
pin muxing).

     Simultaneous toggling: You can set the pin states of a whole gpio bank 
at once. This is nice if you're bit banging.

2.8MHz seems slow. I was at 4MHz through an mmap in *Python*. Make sure 
you're using the set registers rather than doing a read-modify-write and 
only opening the mmap once...and I suppose your clock scaling will matter 
too, so maybe it's the same.

--Brandon

On Wednesday, June 4, 2014 2:26:32 PM UTC-7, john3909 wrote:
>
>
> From: Tony DiCola <to...@tonydicola.com <javascript:>>
> Reply-To: <beagl...@googlegroups.com <javascript:>>
> Date: Wednesday, June 4, 2014 at 8:29 AM
> To: <beagl...@googlegroups.com <javascript:>>
> Subject: Re: [beagleboard] Beaglebone Black libraries for GPIO access in 
> C/C++?
>
> Thanks for the replies everyone--looks like some nice libraries to check 
> out.
>
> Regarding memory mapped GPIO, check out this nice blog post for more info: 
> http://vabi-robotics.blogspot.com/2013/10/register-access-to-gpios-of-beaglebone.html
>  
>  You can effectively map the GPIO registers to a process' memory space and 
> directly access them so there's no overhead of making the system calls to 
> read, write, etc. the sysfs-based GPIO.  
>
> I actually just tried out a couple quick tests and saw toggling a pin high 
> and low in a tight loop with sysfs is pretty slow, only a few hunded khz. 
>  However using memory mapped GPIO registers it's much, much faster.  I'm 
> seeing around 2.8 mhz toggling a pin with this approach.  Now neither 
> approach is technically going to ever give you a real time guarantee of 
> course, but it's nice to have the ability to read and write GPIO fairly 
> quickly in some cases with memory mapped GPIO.
>
> The downside is you cannot support GPIO interrupts. 
>
> Regards,
> John
>
>
>
> On Wed, Jun 4, 2014 at 5:00 AM, Micka <micka...@gmail.com <javascript:>> 
> wrote:
>
>> William Hermans, how did you controlled the GPIO ?
>>
>> The only way that I know is with :
>>
>>
>> /sys/class/gpio/gpio%d/value
>>
>>
>> but you talk about mmap ? How did you use it with this 
>> /sys/class/gpio/gpio%d/value ?
>>
>> Thx you,
>>
>> Micka,
>>
>>
>>
>>
>> On Tue, Jun 3, 2014 at 11:57 PM, William Hermans <yyr...@gmail.com 
>> <javascript:>> wrote:
>>
>>> sysfs, and mmap. I've seen mention of both on the web ( including for 
>>> the BB white ).
>>>
>>> *wiringPi*
>>>>
>>>
>>> Whats this ? The Arduino IDE for the rPI ? Nothing like this exists for 
>>> the BBB that I am aware of. 
>>>
>>>
>>> On Tue, Jun 3, 2014 at 2:45 PM, Jacek Radzikowski <jacek.ra...@gmail.com 
>>> <javascript:>> wrote:
>>>
>>>> <shameless plug>
>>>> https://github.com/piranha32/IOoo
>>>> </shameless plug>
>>>>
>>>> j.
>>>>
>>>>
>>>> On Tue, Jun 3, 2014 at 5:42 PM, Tony DiCola <to...@tonydicola.com 
>>>> <javascript:>> wrote:
>>>> > Sorry if this is a common question, but I've searched around the web 
>>>> and the
>>>> > forum here and am curious are there any somewhat mature or popular 
>>>> libraries
>>>> > for simple digital GPIO access on the Beaglebone Black in C/C++?  I'm
>>>> > curious if there's anything like wiringPi or similar for the BBB yet. 
>>>>  If
>>>> > not, are folks just rolling their own thing with access to sysfs or 
>>>> mmap?
>>>> >
>>>> > --
>>>> > 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 beagleboard...@googlegroups.com <javascript:>.
>>>> > For more options, visit https://groups.google.com/d/optout.
>>>>
>>>>
>>>>
>>>> --
>>>> Given a choice between two theories, take the one which is funnier
>>>>
>>>> --
>>>> 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 beagleboard...@googlegroups.com <javascript:>.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>> -- 
>>> 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 beagleboard...@googlegroups.com <javascript:>.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> -- 
>> For more options, visit http://beagleboard.org/discuss
>> --- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "BeagleBoard" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/beagleboard/Mef65w6PZ7s/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> beagleboard...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> -- 
> 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 beagleboard...@googlegroups.com <javascript:>.
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 
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 beagleboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to