cancel
Showing results for 
Search instead for 
Did you mean: 

STPC Elite - GPIO configuration

abendor
Associate II
Posted on May 12, 2005 at 11:34

STPC Elite - GPIO configuration

8 REPLIES 8
abendor
Associate II
Posted on June 24, 2003 at 05:50

Hello,

I am using the STPC Elite. I would like to configure the registers controlling the GPIO. However, the values that I set in the control registers are never set, and the default value always stays there.

For example:

When I set a value to register 0x320 (Port Direction Control), it's value always stays 0xFF.

How do I enable and control the GPIO?

Thanks!
stephen239955_st
Associate II
Posted on June 24, 2003 at 06:33

The GPIOs are set using the miscelaneous register on the PCI. That is register 40h.

Before you can use the GPIOs, you need to enable them via this register.
abendor
Associate II
Posted on June 24, 2003 at 08:18

To access register 40h, what values should I set to Register 0xCf8 -

Enable - 1???

Bus number - ???

Device number - ???

Function number - ???

Register number - 40h

Thanks!
abendor
Associate II
Posted on June 25, 2003 at 11:08

When accessing the PCI configuration registers - register 0xCF8 has 6 bits for the register number (bites 2...7). It means that the highest register number that can be accessed is 0x3F.

How can I access the SOUTH BRIDGE MISCELLANEOUS REGISTER which has offset of 0x40?

Thanks!
thierry239955_st
Associate II
Posted on June 25, 2003 at 11:41

The register number is 8 bits large! The contend of the 0xcf8 register is:

1BBBBBBB BBBBBBBB DDDDDFFF RRRRRRRR

bit 31----------bit 0

B=Bus, 15 bits, 16-30

D=Device, 5 bits, 11-15

F=Function, 3 bits, 8-10

R=Register, 8 bits, 0-7

(bit 31 is always to 1)

Farfalla

[ This message was edited by: Farfalla on 25-06-2003 15:13 ]
gordon
Associate
Posted on February 06, 2004 at 17:36

So that would be 0x80006040, resulting in something like this(?):

Code:

<BR>mov ax, 80006040h ;SB_Misc0 <BR>mov dx, 0cf8h <BR>out dx,ax <BR> <BR>mov ax 2 ; enable gpio <BR>mov dx, 0cfch <BR>out dx,ax <BR>

Then we are free to do I/O to 320..327 for the lower byte of gpio, no?

[ This message was edited by: Gordon on 06-02-2004 22:07 ]
gordon
Associate
Posted on February 23, 2004 at 21:03

Turns out, my suggestion wasn't complete

First of all, the SBMisc0 register has to be accessed with a 32b access. Then you can do it. This works better:

Code:

mov eax, 80006040h

mov dx,0cf8h

out dx,eax

;

mov dx,0cfch

in al,dx

or al,2

out dx,al

; now you have access to the gpio

xor al,al ; make all lower byte outputs

mov dx, 0320h

out dx,al

;now out to 0326h appears on the gpio port pins

Enjoy!

aschampy
Associate
Posted on May 12, 2005 at 11:34

Do you know how to check with their supplied excecutable for checking registers, mio, whether this enable is working?

Thanks,

Adam

Quote:

On 24-02-2004 at 01:33, Anonymous wrote:

Turns out, my suggestion wasn't complete

First of all, the SBMisc0 register has to be accessed with a 32b access. Then you can do it. This works better:

Code:

mov eax, 80006040h

mov dx,0cf8h

out dx,eax

;

mov dx,0cfch

in al,dx

or al,2

out dx,al

; now you have access to the gpio

xor al,al ; make all lower byte outputs

mov dx, 0320h

out dx,al

;now out to 0326h appears on the gpio port pins

Enjoy!