* Peculiar Behaviour of the GPIO Program
@ 2007-11-23 6:35 Azhar Mr.
2007-11-26 23:55 ` Krishna Prasad Herur
0 siblings, 1 reply; 3+ messages in thread
From: Azhar Mr. @ 2007-11-23 6:35 UTC (permalink / raw)
To: linux-omap-open-source
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 dont understand this peculiar behavior of my GPIO-CODE.
Please Help
With Regards
Azhar
---------------------------------
Bring your gang together - do your thing. Start your group.
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: Peculiar Behaviour of the GPIO Program
2007-11-23 6:35 Peculiar Behaviour of the GPIO Program Azhar Mr.
@ 2007-11-26 23:55 ` Krishna Prasad Herur
2007-11-27 0:05 ` Igor Stoppa
0 siblings, 1 reply; 3+ messages in thread
From: Krishna Prasad Herur @ 2007-11-26 23:55 UTC (permalink / raw)
To: Azhar Mr., linux-omap-open-source
The GPIO driver does not automatically do the required pin muxing for
you. It is possible that the pin you are looking at is muxed with other
signals. Look at the OMAP TRM, and set the Pin Mux register correctly.
-Prasad
-----Original Message-----
From: linux-omap-open-source-bounces+kherur=nextwave.com@linux.omap.com
[mailto:linux-omap-open-source-bounces+kherur=nextwave.com@linux.omap.co
m] On Behalf Of Azhar Mr.
Sent: Thursday, November 22, 2007 10:35 PM
To: linux-omap-open-source@linux.omap.com
Subject: Peculiar Behaviour of the GPIO Program
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.
_______________________________________________
Linux-omap-open-source mailing list
Linux-omap-open-source@linux.omap.com
http://linux.omap.com/mailman/listinfo/linux-omap-open-source
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: Peculiar Behaviour of the GPIO Program
2007-11-26 23:55 ` Krishna Prasad Herur
@ 2007-11-27 0:05 ` Igor Stoppa
0 siblings, 0 replies; 3+ messages in thread
From: Igor Stoppa @ 2007-11-27 0:05 UTC (permalink / raw)
To: ext Krishna Prasad Herur; +Cc: linux-omap-open-source
On Mon, 2007-11-26 at 15:55 -0800, ext Krishna Prasad Herur wrote:
> The GPIO driver does not automatically do the required pin muxing for
> you. It is possible that the pin you are looking at is muxed with other
> signals. Look at the OMAP TRM, and set the Pin Mux register correctly.
> -Prasad
Pullup/pulldown settings might require some adjustment too.
> -----Original Message-----
> From: linux-omap-open-source-bounces+kherur=nextwave.com@linux.omap.com
> [mailto:linux-omap-open-source-bounces+kherur=nextwave.com@linux.omap.co
> m] On Behalf Of Azhar Mr.
> Sent: Thursday, November 22, 2007 10:35 PM
> To: linux-omap-open-source@linux.omap.com
> Subject: Peculiar Behaviour of the GPIO Program
>
> 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.
> _______________________________________________
> Linux-omap-open-source mailing list
> Linux-omap-open-source@linux.omap.com
> http://linux.omap.com/mailman/listinfo/linux-omap-open-source
>
> _______________________________________________
> Linux-omap-open-source mailing list
> Linux-omap-open-source@linux.omap.com
> http://linux.omap.com/mailman/listinfo/linux-omap-open-source
--
Cheers, Igor
Igor Stoppa <igor.stoppa@nokia.com>
(Nokia Multimedia - CP - OSSO / Helsinki, Finland)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-11-27 0:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-23 6:35 Peculiar Behaviour of the GPIO Program Azhar Mr.
2007-11-26 23:55 ` Krishna Prasad Herur
2007-11-27 0:05 ` Igor Stoppa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox