AnsweredAssumed Answered

please help me to find error with read input data pin

Question asked by chau_vo.huong on May 19, 2015
Latest reply on May 20, 2015 by chau_vo.huong
 hi guys , i have tried to get input data pin ,
i use CMSIS  library and stm32 discovery kit 
this is my code 

void main()
//// i set up port D  wiht internal pull-up resistor before read value i/o pin
     GPIO_InitStructure.GPIO_Pin = 0xffff;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
  GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_InitStructure.GPIO_PuPd =   GPIO_PuPd_UP;
  GPIO_Init(GPIOD, &GPIO_InitStructure);
/// i set up port E  as output data to see whether the pin change value
  GPIO_InitStructure.GPIO_Pin = 0xffff;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
  GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
  GPIO_Init(GPIOE, &GPIO_InitStructure);
/// and this is while loop to check the value data in pin D2
if( GPIO_ReadInputDataBit(GPIOD,GPIO_Pin_2)==1)
and it isn't run hizzz ,unless i connect the PD2  to Gnd  before reset MCU ( if MCU  running , after i connect pin PD2  to GND , IT IS NOT TRUE ) i think it very simple .
some body can help me , thank very much