Re: at91_get_gpio_value() always low

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Hello,
the main requirement for at_*_gpio I think should be all includes needed by 
gpio function added to the source and this line in init:
For setting output: gpio_direction_output(pin,1);
For setting input: gpio_direction_input(pin);

For getting value:
int level = at91_get_gpio_value(pin);

This gets me the value of the pin, but as far, as I remember, if the pin is 
set as input, it has to be connected to +5V to show high value. Moreover, I 
don't want to lie, but I think that at91_get_gpio_value() gets value only if 
the pin is set as input.

I looked over the code:
> at91_set_gpio_input(AT91_PIN_PA24, 1); <<<--- Here
> if (!at91_get_gpio_value(AT91_PIN_PA24))
>   jumper_set = 1;

I think there should be at91_set_gpio_input(AT91_PIN_PA24); as you don't 
need to set the value of input.

P.S. I don't know if these functions are correct now, because I used them on 
2.6.22 kernel.

Good luck.

Regards,
Tomas Daujotas

----- Original Message ----- 
From: "Andrejs Cainikovs" <AndrejsC@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
To: "Pierre Savary" <pierre.savary@xxxxxxxxxx>
Cc: <linux-arm-kernel@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Wednesday, September 17, 2008 9:59 PM
Subject: Re: at91_get_gpio_value() always low



Pierre,

Yes, but this didn't helped even with a 1s delay.
Is there any special requirements to get at91_*_gpio working? Some init
stuff or something?

Kind regards,
Andrejs Cainikovs

Pierre Savary wrote:
> Have you tried with a delay between the configuration of the IO and the
> reading?
> Pierre
>
> -----Message d'origine-----
> De : linux-arm-kernel-bounces@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:linux-arm-kernel-bounces@xxxxxxxxxxxxxxxxxxxxxx] De la part de
> Andrejs Cainikovs
> Envoyé : mercredi 17 septembre 2008 09:41
> À : linux-arm-kernel@xxxxxxxxxxxxxxxxxxxxxx
> Objet : at91_get_gpio_value() always low
>
>
> Hi, my problem is rather simple, but anyway, i'm unable to get it work.
>
> I have a jumper connected between ARM pin and ground. And the code in
> board_init:
>
> at91_set_gpio_input(AT91_PIN_PA24, 1);
> if (!at91_get_gpio_value(AT91_PIN_PA24))
>   jumper_set = 1;
>
> Appearantly this won't sense the pin. Even if i remove the jumper, i get
> at91_get_gpio_value(AT91_PIN_PA24) = 0, but it *should* go high because
> of pull-up.
>
> Any ideas?
>
> Thanks,
>
> Kind regards,
> Andrejs Cainikovs
> 


-------------------------------------------------------------------
List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
FAQ:        http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette:  http://www.arm.linux.org.uk/mailinglists/etiquette.php


[Linux ARM]     [Linux ARM MSM]     [Linux ARM Kernel]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

Add to Google Follow linuxarm on Twitter