Question
Reading from GPIO PD
Posted on May 09, 2014 at 17:21
Hi all,
I'm using Discovery F3. I have a problem to read my input GPIO PD. The configuration is as indicated below: /* GPIOD Periph clock enable */ RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOD, ENABLE); /* Configure PD4, PD10 input mode */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4 | GPIO_Pin_10; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN; GPIO_Init(GPIOD, &GPIO_InitStructure); The PD10 is controlled by an external command that switch between 0 and 1(3v), In main i add this code: while(Ctrl_Status==0x00) // Waiting for the Ctrl_Status to be 0x01 { cpt=(GPIOD->IDR & GPIO_Pin_10); if(cpt) { STM_EVAL_LEDToggle(LED3); //Ctrl_Status=0x01; } } The problem is that the Led is always blanking even before applying my 3v, that means that the PD0 is always high. any opinions ? thanks