AnsweredAssumed Answered

stm32f429zi_interrupt_register init qusetion

Question asked by Kang Sung Gu on Sep 15, 2017
Latest reply on Sep 15, 2017 by Kang Sung Gu

CUBE MX Basic Settings (STM32F429ZI)

and My code.

.

.

int main(void)
{

  /* USER CODE BEGIN 1 */

  /* USER CODE END 1 */

  /* MCU Configuration----------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* USER CODE BEGIN Init */

  /* USER CODE END Init */

  /* Configure the system clock */
  SystemClock_Config();

  /* USER CODE BEGIN SysInit */

  /* USER CODE END SysInit */

  /* Initialize all configured peripherals */

  /* USER CODE BEGIN 2 */
 
  //GPIOG PIN 13,14 init
  __HAL_RCC_GPIOG_CLK_ENABLE(); //RCC GPIO Enable
  __HAL_RCC_GPIOA_CLK_ENABLE();
 
  GPIOA->PUPDR = 0x00000002; //GPIOA_PIN0 PULL DOWN  SET
 
  GPIOG->MODER = 0x04000000; //GPIOG_PIN_13 OUTPUT MODE
  GPIOG->OTYPER = 0x00000000; //GPIOG PORT Push-Pull
 GPIOG->OSPEEDR = 0x0C000000; //GPIOG_PIN_13 HIGH SPEED
  GPIOG->PUPDR =   0x00000000; //no pullup no pulldown

  //interrupt init
  __HAL_RCC_SYSCFG_CLK_ENABLE();

  SYSCFG->EXTICR[0] =0x00000000; //PA0 interrupt enable
  EXTI->IMR = 0x00000001; //EXTI 0 enable
  EXTI->RTSR = 0x00000001;//EXTI0 rising edge enable

 
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */

  }
  /* USER CODE END 3 */

}

.

.

.

/* USER CODE BEGIN 4 */
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin){
  if(GPIO_Pin == GPIO_PIN_0)  //rising edge in PA0
            HAL_GPIO_TogglePin(GPIOG, GPIO_PIN_13);
  else
    __NOP();
}

 

register init good but it is not working....

It works fine if I set it to CUBE MX and run it

 

 

Circuit is When the button is pressed, 5V is applied to PA0

Have I missed the register settings?

 

Attachments

Outcomes