[Voyage-linux] ALIX.1C GPIO

Bart Jooris (spam-protected)
Mon Sep 29 16:25:32 HKT 2008


Hi Josh and Tom,

To control the leds|buzzer|resetbutton on the alix3c3 I wrote a 
"generic" program to control the GPIO of the CS5536.
I don't use the cs5536_gpio and you have to be root to use it (calls iopl).
It's powerfull, please check the diagram of the ALIX before changing the 
mode of a GPIO pin and
have a look at page 480- of the CS5536 datasheet.
I use it since a month now and it looks stable.
Invoking the program without params shows a pretty good help

> root at inode014:~# /usr/w-iLab.t/gpiostat
> (c) 2008 Ghent University bart.jooris at ugent.be
> Syntax: /usr/w-iLab.t/gpiostat bit [parameterstring]
>         where bit is in the range from 0 to 31
>         if '-' is part of the string then Regs will be read back
>         lower case will clear the bit, upper case will set the bit
>         [v|V] Output Value
>         [o|O] Output Enable
>         [d|D] Output Open Drain Enable
>         [r|R] Output Invert Enable
>         [a|A] Output Auxiliairy 1 Select
>         [b|B] Output Auxiliairy 2 Select
>         [h|H] Output Pull-Up Enable
>         [l|L] Output Pull-Down Enable
>         [i|I] Input Enable
>         [u|U] Input Invert Enable
>         [f|F] Input Filter Enable
>         [c|C] Input Event Count Enable
>         [.|.] Input Read Back
>         [s|S] Input Auxiliairy 1 Select
>         [k|K] Lock Enable
>         [i|I] Input Enable
>         [p|P] Input Positive Edge Enable
>         [n|N] Input Negative Edge Enable
>         [x|X] Input Positive Edge Status
>         [y|Y] Input Negative Edge Status


For example:
to configure led0 on the ALIX3c3 which is connected to GPIO pin 6 of the 
CS5536 you invoke

>     gpiostat 6 abiOD


read it like this
pin6 with (NO Output Auxiliairy 1 Select & NO Output Auxiliairy 2 Select 
& NO Input Enable & Output Enable & Output Open Drain Enable)
gpiostat will only show the registers it changed...

to toggle the led you invoke

>     gpiostat 6 V
>     sleep 1
>     gpiostat 6 v
>     ...


I attached both source and bin (as it can be hard to compile, you need a 
least the kernel-headers... CentOS 4.5 box can do the trick).

Hope it works for you,

Cheers,

Bart Jooris
Researcher
IBBT-IBCN research group-Ghent University



Josh F wrote:

> I see cs5535_gpio in modprobe and in dmesg, and it loads fine, but I 
> see no way to use it.  I also have not figured out how to use the gpio 
> pins directly, which would also be fine.  In the BIOS, it has settings 
> to make each pin either input or output.
>
> If anyone has any more insight to controlling gpio, please let us all 
> know!
>
>
>
>
> Tom Billiet wrote:
>
>> Hi,
>>
>> Interesting question, I haven't found this out either. The best I 
>> could find was that the geode seems to control the gpio pins 
>> directly, so you have to search how to control gpio pins on a geode 
>> processor I think. But I must say I did not come anything further.
>>
>> Kind regards,
>> Tom
>>
>> ----- Original Message -----
>> From: Josh Fields
>> Time: 28-09-08 01:52
>>
>>> Does anyone have some quick examples to use the GPIO header on the 
>>> ALIX.1C?
>>>
>>> For example, how to turn on/off an output pin, and how to read an 
>>> input pin?
>>>
>>>
>>>
>>> _______________________________________________
>>> Voyage-linux mailing list
>>> Voyage-linux at list.voyage.hk
>>> http://list.voyage.hk/mailman/listinfo/voyage-linux
>>
>
>
> _______________________________________________
> Voyage-linux mailing list
> Voyage-linux at list.voyage.hk
> http://list.voyage.hk/mailman/listinfo/voyage-linux


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: gpiostat.c
URL: <http://list.voyage.hk/pipermail/voyage-linux/attachments/20080929/64b7be0b/attachment.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gpiostat
Type: application/octet-stream
Size: 11372 bytes
Desc: not available
URL: <http://list.voyage.hk/pipermail/voyage-linux/attachments/20080929/64b7be0b/attachment.obj>


More information about the Voyage-linux mailing list