[Voyage-linux] Best Alix 13C2 GPIO Setup For Reading Open/Close Circuit on Shutdowns Controller?

Michael Grollman (spam-protected)
Fri Nov 7 08:16:12 HKT 2008


 
Below is a little info from the driver expert on how to use the
drivers/char/cs5535_gpio.c -- any feedback on how well this works is greatly
appreciated, as would still be any advice on problem stratgey here. - mg

-----Original Message-----
From: voyage-linux-bounces+mXXXX list.voyage.hk   On Behalf Of mgrollman
Sent: Wednesday, November 05, 2008 3:32 PM
To: voyage-linux at voyage.hk
Subject: [Voyage-linux] Best Alix 13C2 GPIO Setup For Reading Open/Close
Circuit on Shutdowns Controller?


I am a long-time Voyage user (started at 0.2, currently on 0.5 for most
systems) that wants to do some new GPIO stuff with the Alix 3C2 board.  
The goal here is to have a way to turn the Alix off in an semi-elegant way a
short period of time (10 minutes) after ignition is turned off for a mobile
Alix solution.

For this new application, we'd like to integrate Alix 3C2 (or perhaps a
nearby model Alix) with a shutdown controller in a vehicle (similar to: 
http://www.mpegbox.com/microsdc/index.html).  In order to interface with
this unit, we'd like to read a signal from the shutdown controller that is
either open or shorts to ground, depending on what the shutdown controller
sees on the ignition line high or not.

I am none-too-clever with circuit design, and would prefer not to build
something that lets out the white smoke from a bunch of Alix boards.  
But I assume there is a small circuit that would be build here that is
pretty fail-safe for reading such an open or closed input?

There is an alternate line on the shutdown controller which sends momentary
connect to ground but is otherwise open -- not sure that'd be any easier to
read, though.

Anyone have some good suggestions on best way to do this, both from an
electronics point of view, as well as a GPIO driver point of view?  I see
there are a few different driver solutions now in GPIO-land, but not sure
which is best for for this kind of simple task.

Cheers,

- Michael

--------------------------------


For what it's worth, here is a little data on howto for the current GPIO
driver for AMD CS5535/CS5536:

As far as I know, there isn't any documentation apart from the source code
(drivers/char/cs5535_gpio.c).

The basic procedure is:
1. Figure out which pin(s) you want to manipulate.
Determine the hexidecimal mask that matches those pins.
For example, if I wanted to touch pins 5,25,26, and 27, the mask is
0x0e000020.

2. modprobe the driver, specifying a major number.
For this example, I chose a major number of 250.
$ modprobe cs5535_gpio major=250 mask=0x0e00020

3. Create device nodes for pins (shell script shown) for m in 5 25 26 27 ;
do
  mknod -m 0664 /dev/gpio/$m c 250 $m
done

4. Configure/set/read the values using cat/echo/read/write.
Refer to the driver source and the cs5535/cs5536 datasheets for details.
This will configure pin 5 as an open drain output.
$ echo "tdpOi" > /dev/gpio/5
This will set the value of pin 5.
$ echo "0" > /dev/gpio/5

If you are using write(), the file position doesn't matter.
If you are using read(), the file position must be reset to 0 before each
read.






More information about the Voyage-linux mailing list