• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1]
Author Topic: How to Add and Control GPIO's of the Sheevaplug  (Read 6330 times)
snake
Newbie
*

Karma: 3
Posts: 37



View Profile
« on: November 22, 2009, 08:02:41 PM »

Hello,

I would like to seek some help regarding GPIO's.

1) I would like to connect a device on one of the GPIO's of the sheevaplug for example ( MPP44 ) and would like to reset this pin during a system boot. Is there an easy way to do this?

2) If this could not be done automatically, is there a way to include the GPIO and control it manually (turn on/off)?


Hope somebody could help...


Logged

snake
Newbie
*

Karma: 3
Posts: 37



View Profile
« Reply #1 on: November 23, 2009, 01:20:07 AM »

Hello,

I would like to seek some help regarding GPIO's.

1) I would like to connect a device on one of the GPIO's of the sheevaplug for example ( MPP44 ) and would like to reset this pin during a system boot. Is there an easy way to do this?

2) If this could not be done automatically, is there a way to include the GPIO and control it manually (turn on/off)?


Hope somebody could help...





Got it working now, I tried assigning the MPP to work as an LED so that I could turn it off and on in the OS level. I edited "arch/arm/mach-kirkwood/sheevaplug-setup.c" and placed my MPP value.


It worked ok and I was to able to get a response of:

#echo "default-on" > /sys/class/leds/my-device/trigger       ----> outputs 1.2 mV
#echo "none" > /sys/class/leds/my-device/trigger               ----> open line


Though I admit that it's a strange way to implement this...  Grin

Maybe there is a better way to do this on the sheevaplug configs...





Logged

sdaau
Newbie
*

Karma: 1
Posts: 8


View Profile
« Reply #2 on: June 03, 2010, 04:53:47 AM »

Hi,

Just wanted to say thanks for posting this!

These could be useful related links:
Linux Kernel Documentation :: spi : spi-summary
Documentation:Linux/GPIO - AVRFreaks Wiki

For the Guruplug, consider also Re-building the kernel and U-Boot - PlugWiki, which points to Guruplug-patchset-2.6.33.2.tar.bz2; and in this archive, we can read in ./guruplug-patchset/0001-Kirkwood-Marvell-GuruPlug-support.patch:

Code:
diff --git a/arch/arm/mach-kirkwood/guruplug-setup.c b/arch/arm/mach-kirkwood/guruplug-setup.c
new file mode 100644
index 0000000..54d07c8
--- /dev/null
+++ b/arch/arm/mach-kirkwood/guruplug-setup.c
@@ -0,0 +1,131 @@
+/*
+ * arch/arm/mach-kirkwood/guruplug-setup.c
+ *
+ * Marvell GuruPlug Reference Board Setup
+ *
...[snip]
+static struct gpio_led guruplug_led_pins[] = {
+ {
+ .name = "guruplug:red:health",
+ .gpio = 46,
+ .active_low = 1,
+ },
+ {
+ .name = "guruplug:green:health",
+ .gpio = 47,
+ .active_low = 1,
+ },
+ {
+ .name = "guruplug:red:wmode",
+ .gpio = 48,
+ .active_low = 1,
+ },
+ {
+ .name = "guruplug:green:wmode",
+ .gpio = 49,
+ .active_low = 1,
+ },
+};

which is the definition of the LED pins...

Cheers!
Logged

snake
Newbie
*

Karma: 3
Posts: 37



View Profile
« Reply #3 on: June 09, 2010, 02:10:41 AM »

Hello sdaau,



Just wanted to say thanks for posting this!


Thank you too for replying to this thread, I've learned from your post. By reading your posted links and looking for related topics I was able to bump on this:
http://squidge.sourceforge.net/gpio/

With a bit of change on the sheevaplug.c and the kernel configs, I could now control the GPIO's. I am now interested on your other posted link about the SPI connection. If you do have some additional pointers on doing this, I would really appreciate it.

Thanks!  Grin
Logged

Pages: [1]
Print
Jump to: