cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F446 EXTI GPIO interrupt not triggering

Mohamed Aymen
Associate II

Hello,

 

I’m working with an STM32F446 and have configured GPIOB pin 12 as an EXTI input. After initialization and before entering the main while loop, I call a function that blocks program execution(what I mean by blocking : I have a test that stands in a blocking while until I receive the first bytes of USART reception) . In this scenario, changing the pin state does not trigger the EXTI interrupt. However, if I comment out this blocking function, the EXTI works as expected. I also observe the same behavior if I insert a while(1) loop before the main loop.

Has anyone experienced similar behavior? If yes, do you know what the solution might be?

 

Thank you in advance.

Aymen

3 REPLIES 3
mƎALLEm
ST Employee

Hello @Mohamed Aymen ,

Better to share your main so we can look at it closely.

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

This is my main 

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 */
  MX_GPIO_Init();
  MX_DMA_Init();
  MX_I2C3_Init();
  MX_SPI3_Init();
  MX_TIM1_Init();
  MX_TIM2_Init();
  MX_USART2_UART_Init();
  MX_ADC1_Init();
  MX_SPI4_Init();
  MX_DAC_Init();
  MX_TIM6_Init();
  MX_USART1_UART_Init();
  MX_TIM5_Init();
  MX_IWDG_Init();

  /* USER CODE BEGIN 2 */

// Init du TIMER pour la pause de 5�S pour l'init des STPM
	HAL_TIM_Base_Start(&htim5) ;

	CalibrationEnCours = TFLAG_FALSE ;
// while(1){HAL_IWDG_Refresh(&hiwdg) ;} // If I uncomment this line, the EXTI no longer functions
// Positionner la demande d'envoi de la configuration par la carte UC (sur scrutation)
  stm32_rs485_wait_config = VRAI;

// Tester la presence des connecteurs au boot
	PresenceConnecteur.flag = TFLAG_TRUE ;

	LancerAutotest = 0 ;

  /* USER CODE END 2 */

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

  /* USER CODE BEGIN 3 */
	// Reinit WATCHDOG
		HAL_IWDG_Refresh(&hiwdg) ;
        .
        .
        .
}

If you use this code, do you fall into the same behavior? (removed all the stuff, keeping the GPIO config + two while loops):

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 */
  MX_GPIO_Init();


  /* USER CODE BEGIN 2 */

 while(1){} // If I uncomment this line, the EXTI no longer functions



// Tester la presence des connecteurs au boot




  /* USER CODE END 2 */

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

  /* USER CODE BEGIN 3 */

        .
        .
        .
}

  

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.