I want to use an input of the dm365 not used by the board, just by adding a switch.
How I can use it in the soft?
I'm working on LeopardBoard 365, I saw in the Hardware Guide the Expansion port pin assignment. So I think that I can use the GPIO 22 to 25 and 62 to 64 (I just need a GPIO). How to configurate the GPIO as an input and how to have the intput value (0 or 1)?
Thanks in advance
I don't succeed in include gpio library in my soft, it doesn't find it
I want to use the file asm/arch/gpio.h, but I can't include it in my own application just by written #include <asm/arch/gpio.h>
How use the GPIO function??
asm/arch/gpio.h is only usable by code running in kernel.
You can use the /sys file system to access GPIO (enable via make config -> kernel -> device drivers -> gpio -> /sys/class/gpio). Then you can just read and write files in the /sys/class/gpio directory to control GPIOs from a Linux application.
CFLAGS += -I$(DEVDIR)/kernel/$(KERNEL)/include
Todd
To answer your question, if you want to be able to include Linux kernel header files (useful when Linux applications make ioctl() calls), then in the Makefile add,
I can't find gpio->/sys/class/gpio in the devices drivers menu
And il the /sys/class/gpio there are 2 files that I can't open. It's in this directory that I have to create file?
In this link designsomething.org/.../134.aspx it is written that we can read and write registers. How know the registers address like a GPIO output register?
I found registers addresses in dm365-registers.c. I want to see the output of the GPIO23, is it really at the address 0x01C67020 (GPIO_BANK01_IN)?
Busybox contains the devmem utility, that allows you to read and write hardware registers.
cd $DEVDIR
make config # -> file system, applications, busybox -> misc -> devmem
Here is an example when I was looking into an RGB888 output for the LI-DVI1 board
>From sprufg9b/pg 48: Table 12. Interface Signals For Parallel RGB Digital Displays
PINMUX4[13:12].GIO33 = 3
PINMUX4[11:10].GIO32 = 3
PINMUX4[7:6].GIO30 = 3
PINMUX4[5:4].GIO29 = 3
PINMUX4[3:2].GIO28 = 3
PINMUX4[1:0].GIO27 = 3
ARM user's guide sprufg5a/pg 127 Pin Mux 4 (PINMUX4) Register 0x01C40010
/ # devmem 0x01C40010 w
0x51735455
0101 0100 0101 0101 <- was
0111 1100 1111 1111 <-for RGB888
This appears to be wrong (SPI1/SPI2 is enabled instead of RBG888). I think the value needed for RBG888 should be
0x51733CFF
/ # devmem 0x01C40010 w 0x51733CFF
and verifying I properly wrote the register
Thanks.
I have connected a push button in the expansion port (GPIO22, GND and 3.3V), but I don't understand, whereas I don't configure GPIO22, it seems to be a reset!!
I wanted just use this input in my soft, but I can't: when I put in on, it resets!
Is someone has an idea? Problem of hardware Leopard?
sorry: a error of button connection!
I've added in board-dm365-evm.c the following lines in order to initialize the GPIO22:
davinci_cfg_reg(DM365_GPIO22,PINMUX_RESV);gpio_request(GPIO22,"gpio_button");gpio_direction_input(22);
and in mux.c I've added:
/*GPIO22, button*/
DM365_GPIO22,
in the mux_cfg file I don't know what add, I've tried with:
MUX_CFG("DM365_GPIO22", 3, 22, 3, 0, 0)
but when I boot, it stops at "Starting Kernel...."
Please help me to configure this GPIO as an input.
Thanks
rectification of the post :
davinci_cfg_reg(DM365_GPIO22,PINMUX_RESV);
gpio_request(22,"gpio_button");
gpio_direction_input(22);
please: it's very important