on accessing the p8/9 headers

OK, I want to get to the bottom of this whole GPIO issue on the BBB, so I’m opening up this thread as a “documenter” whereby which I can take notes based on my research into how you consistently, stably and SOLIDLY programatically access the GPIO pins on a BBB. I’ve already done a lot of the footwork so I’m not entirely unknowledgeable, but I want to get to the heart of this issue and solve the mental block people have with this. A private hope.

Either way, probably a good mess of processed links, articles and information where you can start.

OK, how I’m looking at this problem, of how to configure and use the GPIO pins on a BBB is as if the BBB is like a PIC or other microcontroller not an SBC to start (I’m starting at the pins and working my way in, conceptually).

So what I’m doing is looking for a datasheet for the p8/9 header electrical portion of the BBB. There is one, but I really don’t like how its laid out (let me get you the link though) for the work I’m doing here. We will use these instead:

Here is the link to the BBB Reference Manual (which is still great, just at this stage I want things laid out like I like):


We’re going to use this pdf a lot too so here’s the link.

What has been coming through loud and clear is the “GPIO Settings” (the little box at the bottom of the images in the previous post). Let’s talk about them.

I’ve done a lot of electrical engineering in my time with digital circuits, so I’m thinking of setting bits 3-7 how you would set up your GPIO on a microcontroller which would basically be bare-bones, fast with pull-downs (this is how a PIC is set up). You can have them float but then you would have to anchor them high or low externally, so let’s just pull them down.

A good conservative choice for setting these bits is x0100xxx (expressed in binary here).

So how the GPIO Settings works is you have to set your bits in such a way as to produce the effect you want. Every pin has a MODE (REMEMBER this word) that allows you to configure the pin how you want it (ie. switching over a given GPIO pin to a UART pin so now you have serial communications). That’s what the big tables above are for, they list all seven modes for each pin which value is put in bits 0-2.

For example, if you wanted to set these bits to MODE 4 your byte would be 00100010 (in binary).

OK, thru tracing hardware for now, so let’s look at overlays for a second. Here is a link to what looks like the cleanest (if not official) code base for gpio configuration.


How this code base set up is traditionally, with a “make file”. To build these, you usually just type “make all” or just “make”. This is A correct way to distribute this code.

But what I wanted to talk about is universala, more precisely: cape-universala-00A0.dts Now in researching this issue, you’ll come across this file over and over again (its like the uEnv file). Here is what I’m suggesting you do in figuring out these DTS files (overlay or cape manager files) is you download the zip of the above github link and look at the files in it manually first. If you go to /src/arm within the ZIP file, you will come across all of your available overlays.

Look for cape-universala-00A0.dts and open it in a text editor (I’m doing it in Windows so I’m using my EditLite). There is an important reason why I’m suggesting this. Look at the contents conceptually first OK? Its easy to figure out how the commenting out works (its similar or identical to C’s commenting out). What you notice is that “universala” is obviously set up for using a BBB in the Cloud-9y, stand-alone way (i.e. using a lot of the pins for HDMI output and the like).

Now this is NOT how I use my Beagle. I use it like a tiny UN*X host and telnet (SSH) into it and I want to use all of my GPIO pins as UARTs, SPI’s and I2C’s (as I’m using it as kind of a controller for a project with a lot of sensors and actuators and stuff). So I want to find an overlay that satisfies my requirements.

So what I did was I started reading through the overlays available. I immediately was attracted to BB-UART1-00A0.dts . Now I was “surprised” when I manually read this file (I say this for teaching effect) because there is only the overlay for activating UART1 in it and it ignores all the other pins completely. This is very different from cape-universala-00A0.dts in that this file seems to be VERY preoccupied with every pin on the board.

My working theory at this point is that they are…of course…overlays. In other words there is some procedure, some approach that allows you to overlay a bunch of these files in such a way that it ends up configuring the pins exactly how you want. But in typical UNIX tradition the reasoning is dense, commenting sparse and the code difficult to sift through.

So that’s my working theory right now is I have to determine conceptually HOW these overlays are actually overlaid over top each other. (Thoughts? to the group…conceptually…in plain english, no code what is the overlay process?)

OK, how are these “overlays” set up technically?

In my reading, what seems to be operative, is that these overlays are “compiled” with the magical:

dtc compiler

(Reference: DTC And Compiling Custom Overlays heading in https://vadl.github.io/beagleboneblack/2016/07/29/setting-up-bbb-gpio )

Now GCC being the only way to actually compile something aside (I will not be budged in this opinion), we have to build this “compiler” so we can process our configuration files such that it performs the required operation to the BBB. I’m assuming we just set up out overlays in the correct fashion and then commit them to the OS with the dtc compiler.

I’ll document my research into this process here. I need to load it to my BBB, make/build it and then figure out the configuration such that when I’m finished I have a nice constellation of GPIO, UART and I2C pins just the way I want them, and report here.

Thoughts I want to capture (for later discussion):

  • working theory: I want to be able to access my communication pins (my SPI, I2C, and UART serial) stuff through TTYO1 thru 6 so I can use streams (a la fopen() in C ) so I have some /dev/ abstraction insulating me from a lot of platform and cross-compilation issues.

  • I really need to learn python so I can talk more intelligently on how these ideas relate to python.

  • apparently there are three accepted ways of configuring these pins: overlays, the uEnv.txt file (Q: are the overlay names loaded there just the .dts filenames minus the 00A0.dts suffix…kinda looks like) and the config-pin utility. Still have questions in my mind as to how they all work together to configure the board.

Capturing thoughts:

  • I’m thinking that there are conceptually two stages to this: (1) configuration (which is loaded by the OS at start-up, which is fine I think for most real applications) and (2) how you actually access the pins from whatever language/environment you are using.

  • Feeling pretty confident about being able to access via /dev/TTYO1-6 on serial based communication and maybe using a C library for direct GPIO (like digital on/off output/input) access. Wondering if SPI and I2C are serial enough to be able to access them this way. Research will tell.

Since this is my thread, I though I would reach out to my fellows, both professional (ie. Beagleboard) and hobbyist (that that have ACTUALLY solved this issue and can add something to this discussion) if they can shed some light on the following issues.

I’m serious though about people that have done it before, ok, I’ve been programming UN*X for quite sometime and already know what a popen and a ps are, we don’t need yet another elaboration on it. If you have successfully managed to properly configure the GPIO on a BB I would love to hear from you. And I will proceed with my own research on the subject, posting here.

Some of the topics that elaboration would help on are currently:

  • how conceptually (not technically, functionally, in english) does “overlaying” work. And better if it is a mundain procedure but I do need it explained (would save me some time).

  • Am I correct in assuming that to commit this “overlay” to OS that I need to “compile” it? Have I got it right that its the DTC compiler at the above URL.

  • Does this correctly configure my board for the suite of PWM/TIMER/I2C/UART/SPI/CAN/GPIO features available on the p8/9 headers AT START UP?

  • Down the line: is there a nice tutorial out there or PDF that deliniates a correct procedure for using /dev/ abstraction to access especially the I2C/SPI/UART features via streams (in let’s say C).

  • what is the accepted procedure for accessing the pins in GPIO mode?

  • A moderators: once we get this issue resolved is there any way we can stickey it to the top of each of the boards sections, as well as the hardware board? I apologize for my forwardness, its just a question.

Thank you for your compliance jk. :smiley:

Bye Bye!!


Moderators could you please remove this post. I haven’t a clue what he means by “bye bye” but it doesn’t sound all that positive. Thank you.

It is not. Please keep what you post pertinent to this forum. Oh, I am the moderator.


Gerald is the mod, and he’s pointing it your previous post was not ‘on topic’, it was spam…


Gerald is a mod? Look if you guys want me to buy your board, I expect the tech support to be more friendly than that? Can you remind him this is a business.

And maybe get him to fly a moderator banner or something. Thank you

(Likes Gerald so wondering what’s up)


OK status report, where I’m at is the dtc compiler I was talking about seems only to be buildable with a Debian-style installer, which is a deal-breaker for me because I use stock Angstrom.

Found another overlay compiler by Pantelis Antoniou, but this one doesn’t appear to work either because of a missing *.h file on make (however it appears more promising because of its more traditional C structure). I think a little more work on that would be

Also remember when compiling on MinGW that the make command is “mingw32-make” not “make”. However it seems to partially build with that header file problem. (what are you compiling it on MinGW for…its just where I evaluate stuff before committing to a given library/program).

Got some datasheets to look at. Interestingly enough, the datasheet for the Sitara presents their design a little differently as BBB which is interesting. I’ll be back.


you sent a spam. If you expect anybody to help you, you must follow
community rules. Spamming the list with non-related content is not
among them.


Look at what you posted.

We are volunteers here and none of us get paid for what we do. I don’t care if you buy a board or not.

I expect posters to follow the rules and post things that pertain to the forum.


Gerald, can you articulate what you difficulty with my posts are, according to TOS where the violations are, and I will correct them. I am NOT trying to monopolize your board or whatever, I just have questions is all. But if you could be a good moderator and let me know what you concern is with me. If it is reasonable I will agree and make the proper changes.

Or I will be forced to go to Mouser and ask for a refund on my BB. I like it. But I am not committed to using it.

Thank you.

Angstrom is dead and has been un-maintained since the fall of 2013.


Gerald, can you articulate what you difficulty with my posts are, according
to TOS where the violations are, and I will correct them. I am NOT trying to
monopolize your board or whatever, I just have questions is all. But if you
could be a good moderator and let me know what you concern is with me. If it
is reasonable I will agree and make the proper changes.

The "post" in question is deleted, you sent it via email to 11,495
members. It was a random spam Question & Answer crap

the post was the one before this post "
https://groups.google.com/d/msg/beagleboard/9HoWwEPz-5Q/vNrmYwP0AwAJ "

"proper changes" it already got sent out to 11,495 via email...
there's nothing to change... just don't do it again...

Or I will be forced to go to Mouser and ask for a refund on my BB. I like
it. But I am not committed to using it.


Well, this guy is already on my blacklist, so as far as I’m concerned . . . let me post corny joke garbage posts. Granted, I’m only 1 of those 11,495 people who got mailed. . .