Beaglebone gpio

I've read through the 335x TRM, and I found the gpio config registers,
but I can't seem to find the registers used for pin muxing?? I use
mmap methods to access the gpio stuff directly, and this works fine on
the bb and bbxm, but the registers have changed for the bone....I
don't see any code or docs on this yet....

Anyone used mmap to get to the bone's gpio pins?

Thanks!

I found them in SPRUH73B, AM335x ARM Cortex-A8 MPU Tech Ref Man on pg 1218
starting at offset 0x800: conf_gpmc_ad0 onward.

Hope that helps,
John

.

Yep...that's them! Thanks John, I've got a test program rolling
now....no problems using the bone GPIO with raw register access. For
anyone needing this for the bone:

PINMUX config register: base is 0x44E10000, and as john said, the
individual GPIO lines start at offset 0x0800
GPIO config/data registers: base is GPIO-0: 0x44E07000, GPIO-1
0x4804C000, GPIO-2 0x481AC000, GPIO-3 0x481AE000 and the individual
regs offsets are 0x0000 to 0x0194

And, as John said, the registers are explained in the TI TRM for the
bone arm processor, doc# SPRUH73C, available here:

http://www.ti.com/general/docs/lit/getliterature.tsp?literatureNumber=spruh73c&fileType=pdf

Hi Terry,

Is there any possibility you could elaborate here as I am struggling to get access to the beaglebones gpio output register through mmap.

Regards,
Jack

here you go, I am working on an ir reader and i am using mmap here is the code to read bank 1 on the bone:

#define GPIO1_START 0x4804C000

int raw_fd = open("/dev/mem", O_RDWR | O_SYNC);

gpio = (ulong*) mmap(NULL, 0xFFF, PROT_READ | PROT_WRITE, MAP_SHARED,
raw_fd, GPIO1_START);

//this will return the gpio status of the
printf("GPIO Input register state %x ", gpio[0x138/4]);

here are the scraps that should allow you to read bank 1 of the bone.

Look at the AM33xx technical manual to figure out which pins are active and what are not.

On 25/05/12 03:40, Chrs2021 wrote:

here you go, I am working on an ir reader and i am using mmap here is the code to read bank 1 on the bone:

#define GPIO1_START 0x4804C000

int raw_fd = open("/dev/mem", O_RDWR | O_SYNC);

gpio = (ulong*) mmap(NULL, 0xFFF, PROT_READ | PROT_WRITE, MAP_SHARED,
raw_fd, GPIO1_START);

//this will return the gpio status of the
printf("GPIO Input register state %x ", gpio[0x138/4]);

here are the scraps that should allow you to read bank 1 of the bone.

Look at the AM33xx technical manual to figure out which pins are active and what are not.

On Wednesday, January 25, 2012 2:58:24 PM UTC-5, wrote:

I've read through the 335x TRM, and I found the gpio config registers,
but I can't seem to find the registers used for pin muxing?? I use
mmap methods to access the gpio stuff directly, and this works fine on
the bb and bbxm, but the registers have changed for the bone....I
don't see any code or docs on this yet....

Anyone used mmap to get to the bone's gpio pins?

Thanks!

-- To join: [http://beagleboard.org/discuss](http://beagleboard.org/discuss)
To unsubscribe from this group, send email to:
Frequently asked questions:

Thanks Chris.

With the help from you above and by further reading of the pyBBIO git repo I managed to get it going. I plan to document it soon and will post a follow up message when I have some spare time!

Regards,

Hi Jack, hi Chris,

I have tried the example of Chris as well with success
Attached my code based on the example, tested on Angstroem.

Many thanks and best regards
Walter

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>

#define GPIO1_START 0x4804C000

int main() {

int raw_fd = open("/dev/mem", O_RDWR | O_SYNC);

if (raw_fd < 0) {
printf(“Could not open memory\n”);
return 0;
}

// GPIO Configuration: configure are input
volatile ulong gpio;
gpio = (ulong
) mmap(NULL, 0xFFF, PROT_READ | PROT_WRITE, MAP_SHARED,
raw_fd, GPIO1_START);

if (gpio == MAP_FAILED) {
printf(“gpio Mapping failed\n”);
close(raw_fd);
return 0;
}

printf("GPIO1 Input-Register %x ",gpio[0x138/4]);
close(raw_fd);

return 0;
}

While we're on the subject I'll drop my function in here too for completeness. This is altering the beaglebone GPIO outputs using mmap.

I first setup the pins as outputs using sysfs then perform this function.