I am a newbie in firmware programming. In my program, which was running on a STM32F446RETx Nucleo board, when a signal arrives at pin PC7, an action is taken place. In principle, it is quite similar to pressing the blue-button in order to turn on/off a led. However, in my case, a signal generator is connected to the pin. Also, the frequency of the signal generator might change during time.
The input signal, usually had a frequency between 100Hz and 200Hz and everything was fine. Recently, I needed to increase the frequency up to 1000Hz. Here the problem began. As soon as the frequency passed 440Hz, the interrupt-firing became irregular and when it passed 500Hz there was no interrup firing at all.
I tried to eliminate all the other processes, inputs, and timers to see if a lower microcontroller load can help, but nothing changed.
Here is the some part of the code:
/* USER CODE BEGIN EXTI9_5_IRQn 0 */
if(__HAL_GPIO_EXTI_GET_IT(ENCODER_SIGNAL_Pin) != RESET)
/* USER CODE END EXTI9_5_IRQn 0 */
/* USER CODE BEGIN EXTI9_5_IRQn 1 */
/* USER CODE END EXTI9_5_IRQn 1 */
GPIO_InitStruct.Pin = ENCODER_SIGNAL_Pin; //PC7
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
GPIO_InitStruct.Pull = GPIO_PULLUP;
HAL_NVIC_SetPriority(EXTI9_5_IRQn, 1, 1);
I really appreciate any help. Thank you!