cancel
Showing results for 
Search instead for 
Did you mean: 

GPIO input not detecting during weird periods

Steven Xia
Associate
Posted on June 20, 2018 at 17:56

Hi,

I have been just messing around with the STM32F411RE-nucelo board. I have configured 2 gpio pins on the board. One as output which i am using to power another board (MSP430). Another pin as input which i use to sample gpio interrupts i get from the msp430. 

Using the output pin i have been powering the other board intermittently meaning power on and then power off. Since there is still a capacitor on the other board, it would run a bit more even when i turn the power off. 

The problem now comes where when I turn the power off ie toggle the output pin off, the STM32 board will refuse to detect any gpio interrupts that i get from the msp430

I know for a fact that the msp430 is still sending gpio signals because using a scope i can see that. I have attached a picture of the scope. It is suppose to detect 4 interrupts yet it only detects 2.

Through some testing, the 'bump' you see in the picture where it seems like the floor rises is caused by me toggling the output pin on. The STM32 board seems to only detect interrupts during that period.

I have included my code for the interrupts here, any help would be appreciated

// Initialize PIN_PC8 with output of 0

HAL_GPIO_WritePin(GPIOC, GPIO_PIN_9, GPIO_PIN_RESET);

GPIO_InitStruct.Pin = GPIO_PIN_9;

GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;

GPIO_InitStruct.Pull = GPIO_NOPULL;

GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;

HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);

//Initialize PIN_PB2 with input 

GPIO_InitStruct.Pin = GPIO_PIN_2;

GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;

GPIO_InitStruct.Pull = GPIO_PULLDOWN;

GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;

HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

HAL_NVIC_SetPriority(EXTI2_IRQn, 2, 0);

HAL_NVIC_EnableIRQ(EXTI2_IRQn);

void EXTI2_IRQHandler(void)

{

HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_2);

// ISR code

}

void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)

{

if(GPIO_Pin == GPIO_PIN_2)

{

counter2++; // counting the number of interrupts

}

}

HAL_GPIO_WritePin(GPIOC, GPIO_PIN_9, GPIO_PIN_SET); // where i am toggling the output pin

for (long long int i=0; i<400000; i++);

HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_9);

for (long long int i=0; i<10000000; i++);

#hal-gpio #stm32f4
0 REPLIES 0