cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 F7 - Discovery gpio interrupts do not return to main

hjh
Associate III
Posted on August 28, 2015 at 22:56

HI guys

I can simply not see why this is not working

volatile _Bool DitOn = 0;

volatile _Bool DahOn = 0;

void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)

{

BSP_LED_Toggle(LED1);

if(HAL_GPIO_ReadPin(GPIOI,GPIO_PIN_2) == GPIO_PIN_RESET)

{

 //DitOn = 1;

}

else

{

 //DitOn = 0;

}

}

This is working perfect....the interrupt callback retur to the main function and continue..BUT if i do remove my // so it have to set the to volatile vars it seams like IT DO NOT return to the main ???

Is there anything wrong here ?

Hjalmar
5 REPLIES 5
digital_dreamer
Associate II
Posted on August 29, 2015 at 07:23

I don't see a clear pending flag command anywhere in the interrupt.

MAJ

hjh
Associate III
Posted on August 29, 2015 at 18:13

HI

it comes in the standard function

void EXTI2_IRQHandler(void)

{

   HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_2);

}

which are in the .it file ...

No the problem are arcording to my var i think ...

I try now to make a pointer instead ..

Hjalmar

megahercas6
Senior
Posted on August 31, 2015 at 07:41

void EXTI_Int(void)
{ 
GPIO_InitTypeDef GPIO_InitStructure;
__HAL_RCC_GPIOE_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
GPIO_InitStructure.Mode = GPIO_MODE_IT_RISING;
GPIO_InitStructure.Pull = GPIO_NOPULL;
GPIO_InitStructure.Pin = GPIO_PIN_12;
HAL_GPIO_Init(GPIOE, &GPIO_InitStructure);
GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStructure.Pull = GPIO_NOPULL;
GPIO_InitStructure.Pin = GPIO_PIN_0;
HAL_GPIO_Init(GPIOB, &GPIO_InitStructure);
HAL_GPIO_WritePin(GPIOB,GPIO_PIN_0, GPIO_PIN_RESET);
Delay(0xFFFF);
HAL_GPIO_WritePin(GPIOB,GPIO_PIN_0, GPIO_PIN_SET);
HAL_NVIC_SetPriority(EXTI15_10_IRQn, 1, 10);
HAL_NVIC_EnableIRQ(EXTI15_10_IRQn);
}
extern uint32_t program_counter;
void EXTI15_10_IRQHandler(void)
{
if((EXTI->PR&0x01000)==0x01000)
{
spi_i++;
SPI_Config();
program_counter = 0;
HAL_GPIO_WritePin(GPIOA,GPIO_PIN_2, GPIO_PIN_SET);
Delay(0xFFF);
HAL_GPIO_WritePin(GPIOA,GPIO_PIN_2, GPIO_PIN_RESET);
EXTI->PR = 0x01000;
}
}

This is my code for interrupts. To be honest, for me STM32F7 does not work in a way i want, this code sometimes will run, sometimes it will not. I have no idea what going on, something is very very unstable... Same with stupid compiler, i++ don't increment variables, constant crashes, hard faults, you name it, and i am sick of it. Note, i think i did modified original HAL so it would work like SPL, this is why i have so many stuff inside.
tm3341
Associate II
Posted on August 31, 2015 at 08:49

Just calm down.

hardfault is not because of incrementing your variable. Have you checked for stack overflow? Probably didn't.

Interrupts in F7 works as expected, without any problems. Configured with HAL drivers or without them.

megahercas6
Senior
Posted on August 31, 2015 at 10:16

Same code will run with no problems with STM32F4 all day long, and will crash in STM32F7 at random times. I did post video how IAR ARM compiles code. With all my application code, it start to freak out, and do stupid thinks like that. But if i only testing that part of code that crashes ( aka does not work at all, like i++ that is counting gpio interrupts), it does work.