public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: "Azhar Mr." <shaik.azharuddin@yahoo.co.in>
To: linux-omap-open-source@linux.omap.com
Subject: Peculiar Behaviour of the GPIO Program
Date: Fri, 23 Nov 2007 06:35:19 +0000 (GMT)	[thread overview]
Message-ID: <74079.72407.qm@web7604.mail.in.yahoo.com> (raw)

Dear all,
   
  I am working on OMAP5912 OSK.
   
  I am trying to write a simple GPIO Program to write a value ‘1’ to a particular free GPIO Pin. For that I had written a program led_glow.c given below.
   
  /* define any of the valid GPIO pins as LED_GPIO */
  #define LED_GPIO 18
   
   
  /* Defines the value written to the pin defined as LED_GPIO */
   
  #define LED_STATUS 1
   
  MODULE_LICENSE("Dual BSD/GPL");
   
   
  int init_module(void)
  {
        /* requesting for LED_GPIO */
        if(omap_request_gpio(LED_GPIO)<0)
        {
   printk("[ERROR]: Failed in allocating the requested GPIO Pin \n");
              return -1;
        }
        
        /* setting LED_GPIO as output pin */
   
       omap_set_gpio_direction(LED_GPIO,0);
   
        /* writing to LED_GPIO the value of LED_STATUS */
   
        omap_set_gpio_dataout(LED_GPIO,LED_STATUS);
   
        /* printing the value of LED_GPIO pin */
   
  printk("value of pin # %d = %d\n",LED_GPIO,omap_get_gpio_datain(LED_GPIO));
   
        return 0;
  }
   
  void cleanup_module(void)
  {
        omap_free_gpio(LED_GPIO);     
  printk("[SUCCESS]: LED_GLOW Module unregistered successfull.\n");
  }
   
   
  I included our led_glow.c as a module in the Linux-2.6.22/drivers/leds directory .
   
  Then using arm-linux-gcc compiler, I compiled the led_glow.c code to obtain led_glow.ko
   
  Then using the insmod I inserted the module led_glow.ko in the
  OSK5912 Environment.
   
  I tested the module with various free GPIO-Pins of Expansion connector 'C'
   
  For some GPIO pins it is able to write the value '1' and for some pins it is unable to write '1'
   
  Sh-3.00# value of pin #15 = 1
  Sh-3.00# value of pin #16 = 1
  Sh-3.00# value of pin #17= 0
  Sh-3.00# value of pin #20 = 0
   
  I tested all the free GPIO pins of EXPANSION CONEECTOR C, irrespective of the printed value at the GPIO Pins at all the GPIO Pins I can observe only '0' value in the C.R.O. I could not get any response in the C.R.O
   
  I don’t understand this peculiar behavior of my GPIO-CODE.
   
  Please Help
   
  With Regards
   
  Azhar

       
---------------------------------
 Bring your gang together - do your thing.  Start your group.

             reply	other threads:[~2007-11-23  6:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-23  6:35 Azhar Mr. [this message]
2007-11-26 23:55 ` Peculiar Behaviour of the GPIO Program Krishna Prasad Herur
2007-11-27  0:05   ` Igor Stoppa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=74079.72407.qm@web7604.mail.in.yahoo.com \
    --to=shaik.azharuddin@yahoo.co.in \
    --cc=linux-omap-open-source@linux.omap.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox