AnsweredAssumed Answered

"Chip_GPIO_GetPinState" not working

Question asked by SAGAR PATIL on Dec 27, 2016
Latest reply on Dec 27, 2016 by SAGAR PATIL

Hi All and  LPC WARE,

 

I am using LPC43S67 EVM board,

in my project i have to read sensor digital input,

so i am using following code to test GPIO functionality :-

 

 

#include <board_api.h>
#include <chip.h>
#include <chip_lpc43xx.h>
#include <gpio_18xx_43xx.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>

 

int main(void)
{
    SystemCoreClockUpdate();
    Board_Init();                                                                                                                    //Chip_GPIO_init does nothing

 

//    Chip_SCU_PinMuxSet(0x1,0x13,SCU_MODE_INBUFF_EN);                                    //P1_13==GPIO1[6] from UM10503
//    Chip_SCU_PinMux(0x1,0x13,SCU_MODE_INBUFF_EN,SCU_MODE_FUNC0);

    

Chip_GPIO_SetPinDIR(LPC_GPIO_PORT,0x1,0x6,false);                                             //input   GPIO1[6]
    while(1)
    {
        if(Chip_GPIO_GetPinState(LPC_GPIO_PORT,0x1,0x6))
        {
            Chip_GPIO_SetPinState(LPC_GPIO_PORT,0x0,0x7,false);                                 //set GREEN led
        }
        else
        {
            Chip_GPIO_SetPinState(LPC_GPIO_PORT,0x3,0x7,false);                                  //set RED led
        }
    }
return 0;
}

 

but Chip_GPIO_GetPinState always returns "false",

i have connected 3.3v also on P1_13 also but still returns "false",

any help?

thanks and regards,

sagar
 

Outcomes