[Voyage-linux] GPIO on Alix 1.D working!
QmQ
(spam-protected)
Sat Mar 21 10:00:01 HKT 2009
After A LOT of reading I've finally 'cracked' Alix 1.D (and probably
1.C) GPIO! :D
I've searched A LOT for a *working* GPIO solution on the Internet but
found none. If however there is one out there please let me know :) But
I'll write my own anyway :P
I'm releasing a VERY UGLY and highly incomplete code snippet that
proves it does work. Now that I know what and how I will write a much
better piece of code to ease GPIO access for myself (and everyone else
if someone will be interested).
This method does not require any drivers whatsoever.
Compile: gcc gpio.c -O2 -Wall
Run as root!
This test assumes the board GPIOs are at their defaults. If they are
not (i.e. changed via BIOS) do NOT do what follows. Why? By default the
GPIOs are configured as INPUT. In the following test I'm going to short
circuit one of the GPIO pins with the ground. If that pin would be
configured as output...I have no idea what would happen, but better not
try ;)
To test it I've attached a switch between GPIO11 and GND (GPIO pins 4
and 2). When I run the test program I get 0xFF which means no button is
pressed. When I switch the switch (short circuit the pins) and run the
program I get 0xFD. Bit #1 has changed == GPIO11 works!
And that's it! No big deal now that I think about it, but for me it's a
huge breakthrough (many hours well spent) so I needed to tell someone ;)
I will investigate GPIO further and if anyone is interested post some
more detail. I have attached the code (gpio.c) and the zipped program.
In the process I've learned how to access/control the hardware monitor,
so if anyone is interested in that - let me know.
*USE AT YOUR OWN RISK!*
Some additional system info:
---------------------
Board: Alix 1.D
BIOS: 8/27/08
Settings: default
Voyage: lenny on USB stick
GCC 4.3.2
---------------------
Now I can rest in peace - 3AM here :)
Regards,
QmQ
PS
I still don't know why my system "sees" 3 LEDs and allows me to control
them - I'm beginning to think the LED module is either statically built
for board(s) which have LEDs or that my system somewhere has pins for 3
LEDs (which would be cool - the disk/CPU usage functionality might come
in handy).
PPS
I hope this will get archived some day so here are some additional
keywords that might help someone find this. They certainly would've
helped me :)
winbond W83627HF configuration register
--
This message has been scanned by ArcaMail, ArcaVir 2009
scanned 2009-03-21 03:00:06, engine: 2009.0010, base: 2009.03.20 12:20:35
www.arcabit.pl
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: gpio.c
URL: <http://list.voyage.hk/pipermail/voyage-linux/attachments/20090321/7b232dbd/attachment.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gpio.zip
Type: application/zip
Size: 3173 bytes
Desc: not available
URL: <http://list.voyage.hk/pipermail/voyage-linux/attachments/20090321/7b232dbd/attachment.zip>
More information about the Voyage-linux
mailing list