AnsweredAssumed Answered

2 Timers use with stm32F746BG

Question asked by Yuriy Pankratz on Sep 5, 2017
Latest reply on Sep 13, 2017 by Yuriy Pankratz
Hello, I use MDK-Lite 5.23 uVision / stm32F746BG. I work with two timer interrupts at the same moment: TIM1_UP_TIM10_IRQHandler(void) + TIM2_IRQHandler(void) + program code at the main() function 
void TIM1_UP_TIM10_IRQHandler(void)
{
  /* USER CODE BEGIN TIM1_UP_TIM10_IRQn 0 */
    /* USER CODE END TIM1_UP_TIM10_IRQn 0 */
  HAL_TIM_IRQHandler(&htim1);
  /* USER CODE BEGIN TIM1_UP_TIM10_IRQn 1 */
 
      HAL_GPIO_TogglePin(GPIOE, GPIO_PIN_4);
  /* USER CODE END TIM1_UP_TIM10_IRQn 1 */
}
/**
* @brief This function handles TIM2 global interrupt.
*/
void TIM2_IRQHandler(void)
{
  /* USER CODE BEGIN TIM2_IRQn 0 */
  HAL_TIM_Base_Stop_IT(&htim2);
  /* USER CODE END TIM2_IRQn 0 */
  HAL_TIM_IRQHandler(&htim2);
  /* USER CODE BEGIN TIM2_IRQn 1 */
   HAL_GPIO_TogglePin(GPIOJ, GPIO_PIN_13);
  HAL_TIM_Base_Start_IT(&htim2);
  /* USER CODE END TIM2_IRQn 1 */
}
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();
  /* Configure the system clock */
  SystemClock_Config();
  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_TIM2_Init();
  MX_TIM1_Init();
  /* Initialize interrupts */
  MX_NVIC_Init();
  /* USER CODE BEGIN 2 */
  HAL_TIM_Base_Start_IT(&htim1);
HAL_TIM_Base_Start_IT(&htim2);
   
  /* USER CODE END 2 */
  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
  /* USER CODE END WHILE */
  /* USER CODE BEGIN 3 */
  HAL_GPIO_TogglePin(GPIOJ, GPIO_PIN_14);
}
  /* USER CODE END 3 */
}

Outcomes