[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Where are the GPIO pins on the dev-board?


The GPIO pins are used on the developer board for e.g. flow control
on the serial ports. You can use them for your application instead
if you turn off flow control or don't use the serial ports (you may
have to unmount the serial tranceivers to avoid collisions on the
signals). The GPIO pins are assigned like this:

Pin  Usage                    Available on
PA0  Initialize serial ports
PA1  Test button
PA3  COM2 enable
PA4  DTR2                     X18 pin 7 
PA5  RI2                      X18 pin 8 
PA6  DSR2                     X18 pin 2  
PA7  CD2                      X18 pin 1
PB0  EEPROM data
PB1  EEPROM clock
PB2  EEPROM select
PB3  COM1 enable
PB4  DTR1                     X4 pin 7 
PB5  RI1                      X4 pin 8
PB6  DSR2                     X4 pin 2
PB7  CD2                      X4 pin 1 

The direction and default values are configurable in kernel config.
Example: Assume that you want to set PB4 as output with a defualt
value of 0.

1. cd to elinix directory
2. make menuconfig 
3. Select Hardware setup
4. In R_PORT_PB_DIR each bit represents direction for one pin. Bit
0 selects direction for PB0 etc. A value of 1 means output, 0 input.
In this example you shoule make sure that bit 4 of R_PORT_PB_DIR is 1.
5. In R_PORT_PB_DATA each bit represents default value for one pin.
Bit 0 selects value for PB0 etc. In this example bit 4 in
R_PORT_PB_DATA should be 0.
6. Rebuild the kernel and your product

The values can be modified from applications by writing to /dev/gpiob.
Example: To set the bit above the following code can be used (with 
bitmap = 0x10:

void setbits(int bitmap)
  int devfd;
  devfd = open("/dev/gpiob", O_WRONLY);
  ioctl(devfd,_IO(ETRAXGPIO_IOCTYPE, IO_SETBITS), bitmap);
  close( devfd );

void clrbits(int bitmap)
  int devfd;
  devfd = open("/dev/gpiob", O_WRONLY);
  ioctl(devfd, _IO(ETRAXGPIO_IOCTYPE, IO_CLRBITS), bitmap);
  close( devfd );

Best Regads,

-----Original Message-----
From: owner-dev-etrax@xxxxxxx.com]On">mailto:owner-dev-etrax@xxxxxxx.com]On
Behalf Of Johan Magnusson (QIC)
Sent: Thursday, December 14, 2000 1:13 PM
To: dev-etrax
Subject: Where are the GPIO pins on the dev-board?

We would like to flash a LED connected to some pin on the developer board and we have read about the general ports on the chip, but we can not find them on the developer board. Where are they???? And please.. If you can,  give us a hint about bits that has to be set (direction, enable, etc) and how we can do this in a cgi-script so that we can flash the LED with a browser click.

Thanks in advance
/ Johan K Magnusson & Alexander Gordon