Hi All and lpcware,
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
Solved! Go to Solution.
Hi all,
below code is working for me,
#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(1,13,SCU_MODE_INBUFF_EN); //for SCU functionality use P1_13
while(1)
{
if(Chip_GPIO_GetPinState(LPC_GPIO_PORT,1,6)) for GPIO functionality use GPIO1[6]
{
Chip_GPIO_SetPinState(LPC_GPIO_PORT,0,7,false);
}
else
{
Chip_GPIO_SetPinState(LPC_GPIO_PORT,3,7,false);
}
}
}
Thanks for the help,
sagar
Hi all,
below code is working for me,
#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(1,13,SCU_MODE_INBUFF_EN); //for SCU functionality use P1_13
while(1)
{
if(Chip_GPIO_GetPinState(LPC_GPIO_PORT,1,6)) for GPIO functionality use GPIO1[6]
{
Chip_GPIO_SetPinState(LPC_GPIO_PORT,0,7,false);
}
else
{
Chip_GPIO_SetPinState(LPC_GPIO_PORT,3,7,false);
}
}
}
Thanks for the help,
sagar