Re: [beagleboard] Accessing GPIO1 registers

177 views
Skip to first unread message

Andrew Bradford

unread,
Oct 8, 2012, 12:21:06 PM10/8/12
to beagl...@googlegroups.com, wann...@gmail.com
On Mon, 8 Oct 2012 06:55:40 -0700 (PDT)
Wannes <wann...@gmail.com> wrote:

> 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

Hesham

unread,
Oct 8, 2012, 1:24:01 PM10/8/12
to beagl...@googlegroups.com, wann...@gmail.com


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.

electronics.cat

unread,
Oct 8, 2012, 1:27:03 PM10/8/12
to beagl...@googlegroups.com
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
Reply all
Reply to author
Forward
0 new messages