cancel
Showing results for 
Search instead for 
Did you mean: 

GPIO input problem

hamid hassannejad
Associate II
Posted on February 01, 2018 at 18:11

Hi,

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:

void EXTI9_5_IRQHandler(void)
{
 /* USER CODE BEGIN EXTI9_5_IRQn 0 */
 if(__HAL_GPIO_EXTI_GET_IT(ENCODER_SIGNAL_Pin) != RESET)
 {
 ...
 }
 /* USER CODE END EXTI9_5_IRQn 0 */
 HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_7);
 /* USER CODE BEGIN EXTI9_5_IRQn 1 */
 /* USER CODE END EXTI9_5_IRQn 1 */
}
//initialization
GPIO_InitStruct.Pin = ENCODER_SIGNAL_Pin; //PC7
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
GPIO_InitStruct.Pull = GPIO_PULLUP;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
...
HAL_NVIC_SetPriority(EXTI9_5_IRQn, 1, 1);
HAL_NVIC_EnableIRQ(EXTI9_5_IRQn);
...
�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?

I really appreciate any help. Thank you!

#hal-gpio #gpio-speed #interrupt-issue
0 REPLIES 0