cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4xx NVIC->ISPR Question

Kang Sung Gu
Associate II
Posted on September 23, 2017 at 16:27

When is the ISPR register used?

ISPR [0] | = 0x00000001 << 6;

// (EXTI0 Position)

Does this code convert the EXTI0 interrupt into the pending state so that the EXTI0 interrupt should not be executed?

But the interrupts work well

Did I misunderstand?

This is my sorce 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 */

   //NVIC Register init

  NVIC->ISER[0] |= 0x01<<6; //EXTI0 vect enable

 

  //SYSCFG Register init

  SYSCFG->EXTICR[0] |=0x00000000; //PA0 interrupt enable

 

  //RCC Register init

  __IO uint32_t tmpreg = 0x00U; //__IO = volatile 

  RCC->AHB1ENR |= 0x00000041; //GPIOG, GPIOA AHB1ENR

  //RCC->APB2ENR |= 0x00000001 << 14; //SYSCFG ENABLE: APB2 clock is EXTI 

  /* Delay after an RCC peripheral clock enabling */

  tmpreg = 1; //

  UNUSED(tmpreg); //

  

  //GPIO Register init

  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   |=   0x0000000; //no pullup no pulldown

 

  //EXTI Register init

  EXTI->IMR  |= 0x00000001; //EXTI0 enable

  EXTI->RTSR |= 0x00000001;//EXTI0 rising edge enable

 

  NVIC->ISPR[0] = 0x00000001<<6;

  /* USER CODE END 2 */

  /* Infinite loop */

  /* USER CODE BEGIN WHILE */

  while (1)

  {

  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */

  }

  /* USER CODE END 3 */

}

0690X00000608LpQAI.png
2 REPLIES 2
Posted on September 23, 2017 at 23:40

Hello!

Does this code convert the EXTI0 interrupt into the pending state so that the EXTI0 interrupt should not be executed?

But the interrupts work well

The exceptions can be Active , Inactive or Pending.

 Inactive means no Pending and no Active

 Pending means, the exception is waiting to be serviced by the MCU.  A SW or HW IRQ can change the state of the corresponding exception to pending. Also ISPR can change an inactive exception to pending.

€

Active means, an exception that is being serviced by the MCU but has not completed yet.

Regards

vf

Posted on September 24, 2017 at 15:22

Thanks Vangelis Fortounas