user space LED/GPIO access

Hi

Any body know how to get access to the GPIO/LEDS on the connect ME 9210 dev board.

I can load the drivers/modules but nothing is created in /dev!

do you have to create a node manually in /dev?

If so how do you associate gpio to a node?

Thanks for any information

Derek

Hi

You need to write a gpio definition file.
Make a file named “cme9210js”
with the folowing data:

#-------------------------------------------------------
/dev/gpio d 755 0 0
/dev/gpio/0 c 644 0 0 250 0
/dev/gpio/1 c 644 0 0 250 1
/dev/gpio/2 c 644 0 0 250 2

RxD /dev/gpio/3 c 644 0 0 250 3

NC /dev/gpio/4 c 644 0 0 250 4

/dev/gpio/5 c 644 0 0 250 5

iButton /dev/gpio/6 c 644 0 0 250 6

TxD /dev/gpio/7 c 644 0 0 250 7

NC /dev/gpio/8 c 644 0 0 250 8

/dev/gpio/9 c 644 0 0 250 9

NC /dev/gpio/10 c 644 0 0 250 10

NC /dev/gpio/11 c 644 0 0 250 11

/dev/gpio/12 c 644 0 0 250 12
/dev/gpio/13 c 644 0 0 250 13
#----------------------------------------------

This is the file i needed.
You can edit it if you need ohther pins

put the file to your workspace project:

DigiEL4.2/workspace/aesscoretemplate/build/rootfs/etc/makedevs.d

Harald

Hi Harald42

I managed to get there, by reading the manual!!
There are a few key sentences that I missed in my rush to gwet things up and running.

Yours is a more complete file than mine and I will make use of it, thanks.

Derek

I have similar problem can’t user space LED/GPIO access.
I mount modul gpio and manually create node /dev/gpio/5
with mknod 5 c 250 5.
Open node is OK, but IOCTL commands for those ports not apply.
I try modify driver gpio.c insert
printk(KERN_INFO "info
");
into top of function gpio_open, gpio_ioctl, to see what is happening.
I when I try ioctl call, gpio_ioctl function in moudul is not start up.
I don’t know how ,can I control gpio (connect ME 9210).

please help

I’m working with the CME 9210 too but I have no such problem with GPIO’s. This is what I’m doing:

modprobe gpio

mkdir /dev/gpio

cd /dev/gpio

mknod 1 c 250 1

Then, from my application:

// Open GPIO file descriptor
int fdGPIO = open(“/dev/gpio/1”, O_RDWR);
// Configure GPIO as output
ioctl(fdGPIO, GPIO_CONFIG_AS_OUT, 0);

int state; // state=1 -> GPIO=on ; state=0 -> GPIO=off
// control GPIO
write(fdGPIO, (char *)&state, sizeof(char));

I hope this helps,

Daniel.

Thank you,
This was my mistake. I copy from manual this lines:

if (led = open (“/dev/gpio/6”, O_RDWR) < 0)
{
fprintf (stdout, "error gpio 1 can’t open
");
}

,bat here some bad syntax, rightly is:

led = open (“/dev/gpio/6”, O_RDWR);
if (led < 0)
{
fprintf (stdout, "error gpio 1 can’t open
");
}