This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

can not read gpio input

hardware: beagle bone (not black)

software: starterware

environment: CCS v5.5, ubuntu 12.04

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I want to use gpio1_15 (also tried gpio1_12) as gpio input.

first, add this function into platform code for beaglebone, gpio.c

void GPIO1Pin15PinMuxSetup(void) /** GPIO1_15, GPMC_AD15 **/
{
HWREG(SOC_CONTROL_REGS + CONTROL_CONF_GPMC_AD(15)) = CONTROL_CONF_MUXMODE(7);
}

then in gpio led example:

....
GPIO1Pin15PinMuxSetup();
/* Enabling the GPIO module. */
GPIOModuleEnable(GPIO_INSTANCE_ADDRESS);
/* Resetting the GPIO module. */
GPIOModuleReset(GPIO_INSTANCE_ADDRESS);
....
GPIODirModeSet(GPIO_INSTANCE_ADDRESS, 15, GPIO_DIR_INPUT); // sdo

The following function returns 0 when I connect the pin to 3.3V VDD directly:

ret = GPIOPinRead(GPIO_INSTANCE_ADDRESS, 15);

I also tried:


ret = (HWREG(GPIO_INSTANCE_ADDRESS + GPIO_DATAIN));
ret = (HWREG(GPIO_INSTANCE_ADDRESS + GPIO_DATAIN) & (1 << 15));

GPIO_DATAIN register always reads 0xE4000300. This is also observed in CCS register tab.

I connect gpio1_15 to both VDD 3.3V or GND, alternatively, the value does NOT change.

For the same hardware setup, if I set gpio dir mode to GPIO_DIR_OUTPUT, then GPIOPinWrite output correct voltage, GND or VDD.

Is there anything i missed to set up correctly? Or I had damage the hardware?