cancel
Showing results for 
Search instead for 
Did you mean: 

EXTI strange behavior on stm32h7r3z8t6

MihavinVin
Associate

Hi, I am building a custom board with stm32h7r3z8t6

Have a problem with EXTI function:

I use 2 EXTIs - EXTI8 in PD8 and EXTI9 on PC8.

Both are defined as rising edge interrupt sources. Both pulled down and without any signal.

Both are toggling LEDs.

EXTI8 generates a square signal of 2.1MHz on the LED pin.

EXTI9 nothing, never entering to the interrupt.

The picture is the same if the signal source with 400KHz is connected to EXTI9 and EXTI8.

system clock running at 600MHz HCLK at 300MHz.

External crystal 48MHz.

 

I tried just reading pins and applying the value to LEDs - it works fine, so I guess, the pins are soldered well and not burned.

Using ST-LINK3 Debugger.

 

The Signal on LED2_Pin:

98fd4bbf-88ef-488d-91d6-1e8e70461bc9.jpg

MihavinVin_0-1735749775134.png

 
 
void SystemClock_Config(void)
{
 
  if (HAL_PWREx_ConfigSupply(PWR_LDO_SUPPLY) != HAL_OK)
  {
    /* Initialization error */
    Error_Handler();
  }
  RCC_OscInitTypeDef RCC_OscInitStruct = {0};
  RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
 
  /** Configure the main internal regulator output voltage
  */
  if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE0) != HAL_OK)
  {
    Error_Handler();
  }
 
  /** Initializes the RCC Oscillators according to the specified parameters
  * in the RCC_OscInitTypeDef structure.
  */
  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_HSE;
  RCC_OscInitStruct.HSEState = RCC_HSE_ON;
  RCC_OscInitStruct.HSIState = RCC_HSI_ON;
  RCC_OscInitStruct.HSIDiv = RCC_HSI_DIV1;
  RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
  RCC_OscInitStruct.PLL1.PLLState = RCC_PLL_ON;
  RCC_OscInitStruct.PLL1.PLLSource = RCC_PLLSOURCE_HSE;
  RCC_OscInitStruct.PLL1.PLLM = 3;
  RCC_OscInitStruct.PLL1.PLLN = 37;
  RCC_OscInitStruct.PLL1.PLLP = 1;
  RCC_OscInitStruct.PLL1.PLLQ = 20;
  RCC_OscInitStruct.PLL1.PLLR = 2;
  RCC_OscInitStruct.PLL1.PLLS = 2;
  RCC_OscInitStruct.PLL1.PLLT = 2;
  RCC_OscInitStruct.PLL1.PLLFractional = 4096;
  RCC_OscInitStruct.PLL2.PLLState = RCC_PLL_NONE;
  RCC_OscInitStruct.PLL3.PLLState = RCC_PLL_NONE;
  if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
  {
    Error_Handler();
  }
 
  /** Initializes the CPU, AHB and APB buses clocks
  */
  RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
                              |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2
                              |RCC_CLOCKTYPE_PCLK4|RCC_CLOCKTYPE_PCLK5;
  RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
  RCC_ClkInitStruct.SYSCLKDivider = RCC_SYSCLK_DIV1;
  RCC_ClkInitStruct.AHBCLKDivider = RCC_HCLK_DIV2;
  RCC_ClkInitStruct.APB1CLKDivider = RCC_APB1_DIV2;
  RCC_ClkInitStruct.APB2CLKDivider = RCC_APB2_DIV2;
  RCC_ClkInitStruct.APB4CLKDivider = RCC_APB4_DIV2;
  RCC_ClkInitStruct.APB5CLKDivider = RCC_APB5_DIV2;
// Enable SYSCFG clock
//RCC->APB4ENR |= RCC_APB4ENR;
 
 
 
  if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_7) != HAL_OK)
  {
    Error_Handler();
  }
  HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSE, RCC_MCODIV_15);
 
  /** Enables the Clock Security System
  */
  HAL_RCC_EnableCSS();
}
 
 
EXTI :
 

void EXTI8_IRQHandler(void)
{
/* USER CODE BEGIN EXTI8_IRQn 0 */

/* USER CODE END EXTI8_IRQn 0 */
HAL_GPIO_EXTI_IRQHandler(DRDY_Pin);
/* USER CODE BEGIN EXTI8_IRQn 1 */
HAL_GPIO_TogglePin(LED2_GPIO_Port,LED2_Pin);
/* USER CODE END EXTI8_IRQn 1 */
}

/**
* @brief This function handles EXTI line9 interrupt.
*/
void EXTI9_IRQHandler(void)
{
/* USER CODE BEGIN EXTI9_IRQn 0 */

/* USER CODE END EXTI9_IRQn 0 */
HAL_GPIO_EXTI_IRQHandler(DCLK_Pin);
/* USER CODE BEGIN EXTI9_IRQn 1 */
HAL_GPIO_TogglePin(LED3_GPIO_Port,LED3_Pin);
/* USER CODE END EXTI9_IRQn 1 */
}

 

MihavinVin_1-1735750392870.png

 

 

6 REPLIES 6

>>EXTI9 on PC8

No, EXTI9 would need to come from a GPIO_PIN_9 on one of the GPIO Banks

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
MihavinVin
Associate

Thanks for answer.

It's my typo.

EXTI9=>PC9

EXTI8=>PD8

 

TDK
Guru

If the interrupt is being triggered, there's a reason for it. Set a breakpoint in EXTI8_IRQHandler and examine the state of pins and registers to determine why it's being called. Look at VECTACTIVE to make sure the correct handler is being called. (Compare the value VECTACTIVE - 16 to those listed in IRQn_Type.)

 

If you feel a post has answered your question, please click "Accept as Solution".

Thanks for your answer,

I get VECTACTIVE = 0x28 when it triggers the EXTI8 And nothing on EXTI9. With and without input signal.

I tried to use HSI - the same behavior.

I am pretty sure it comes from the MCO1, It generates 2.2MHz. If it is OFF, EXTI9 is not triggered but still does not respond to the external signal.

 

 

MihavinVin_1-1735835564618.png

 

TDK
Guru

> I get VECTACTIVE = 0x28 when it triggers the EXTI8

0x28 - 16 = 24, which is EXTI8_IRQn, so that lines up. Something is triggering it.

 

> I am pretty sure it comes from the MCO1, It generates 2.2MHz. If it is OFF, EXTI9 is not triggered but still does not respond to the external signal.

Makes sense. Perhaps PD8 is not hooked up to what you think it is, or the EXTI8 interrupt is not set to PD8. Note that MCO1 output is on PA8, which is the default EXTI port.

Look at SBS->EXTICR2 and ensure lower 4 bits are set to 0x3.

If you feel a post has answered your question, please click "Accept as Solution".

Read out and check/post content of relevant GPIO and EXTI, and as @TDK said above, the EXTI steering registers.

JW