[beagleboard] Accessing GPIO1 registers

Hi all,

I'm having trouble accessing the GPIO1 registers to power on one of
the user LED's. Thus far I've got the following code:
@.text is at 0x80000000
.section .text
.equ GPIO1_BASE, 0x4804C000
.global main
main:
ldr r0, =GPIO1_BASE
mov r2, #1 @no idle [GPIO_SYSCONFIG]
ldr r1, [r0, #0x10]
orr r1, r1, r2, lsl #3
str r1, [r0, #0x10]
mov r2, #0 @set as output [GPIO_OE]
ldr r1, [r0, #0x134]
orr r1, r1, r2, lsl #21
str r1, [r0, #0x134]
ldr r1, [r0, #0x194]
mov r2, #1 @set output value [GPIO_SETDATAOUT]
orr r1, r1, r2, lsl #21
str r1, [r0, #0x194]
b main

I power up my BeagleBone without an SD card, build the program and
start the debugger in the Code Composer Studio. Then I move to
0x8000000 and try to step through it, but as soon as it tries to load
the GPIO_SYSCONFIG register at address 0x4804C010 (or any GPIO1
register) I get a Data Abort exception (I haven't properly set up my
error handling yet, but that's what I presume). I've tried to simply
view these registers in memory when the BeagleBone was running the
shipped distribution but the IDE couldn't access these registers as
well. It seems as if the GPIO1 controller isn't there though the
LED's blink when running off the SD card. What am I missing here?

How were you trying to access the registers when Linux was running?

Do you have the GPIO1 required clocks running correctly? Sorry, I'm
not as familiar with the GPIO subsystem on bare-metal.

Have you pin muxed some pins to GPIO1? (maybe not given below)

Sidenote: I've come across the concept of pin muxing when using a
Linux distribution on the BeagleBone, do I have to care about this
when running bare-metal, and if so, how do I select the muxed pin?

Unless the pins you want to access are already set up correctly by the
out of reset state, yes, you probably need to worry about pin muxing.

-Andrew

OMAP needs proper memory mapping in order to access any memory space. I think you are missing configuring the MMU in order to access these regs. I’m not sure about the default MMU settings.

If you are able to work on C, this is a very good link :

"Addressing multiple BeagleBone GPIO pins in C" : http://www.nunoalves.com/open_source/?p=127

I have attached a real code working on my BeagleBone.

Good luck,

     Jordi

Al 08/10/12 18:21, En/na Andrew Bradford ha escrit:

nalves01.c (11.3 KB)