GPIO commands on OMAP4
Patrick
kpa_info at yahoo.fr
Thu Apr 5 10:38:51 EDT 2012
On 04/05/2012 03:49 PM, Sascha Hauer wrote:
> On Thu, Apr 05, 2012 at 11:40:49AM +0200, Patrick wrote:
>> Dear mailing-list,
>>
>> I am using a pcm049 phyCORE omap4430 module from Phytec with BareBox
>> 2011.09.0 patched with BSP from Phytec.
>>
>> I would like to use the GPIO command to read a switch at startup.
>> This chip is connected on ABE_MCBSP1_DX (gpio_116). I have edited
>> the boards/pcm049/mux.c files to change the configuration of this
>> GPIO as follow: {ABE_MCBSP1_DX, (DIS | IEN | M3)} instead of
>> {ABE_MCBSP1_DX, (SAFE_MODE)}.
>>
>> I then use the "gpio_get_value 116" command followed by "echo $?" to
>> read the value. I always read a 0. On Linux I could read the right
>> value depending of the position of the switch, so it's not an
>> hardware problems.
>>
>> I have tried with one of the two LEDs on the module (gpio_152) and I
>> could change the LED state and read it back with gpio_get_value.
>>
>> I do not understand what I am doing wrong. Any help will be appreciated.
>
> What you tried should work. The only thing I can imagine is that you
> need a gpio_direction_input before reading the value.
>
> Sascha
>
I have found the the problem come from the mux configuration.
I have added a call to set_muxconf_regs() from the gpio_get_value()
(this is only to try) and then it works. I have checked my configuration
and the lowlevel init is enabled:
CONFIG_MACH_HAS_LOWLEVEL_INIT=y
CONFIG_MACH_DO_LOWLEVEL_INIT=y
I am runnig my development version of barebox from the stable barebox
flashed on NAND. I do the following:
tftp barebox.bin /dev/ram0
go /dev/ram0
Could this be a problem ?
Thanks for your help
Patrick
More information about the barebox
mailing list