2015-08-28 01:56 PM
HI guys
I can simply not see why this is not workingvolatile _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 ?Hjalmar2015-08-28 10:23 PM
I don't see a clear pending flag command anywhere in the interrupt.
MAJ2015-08-29 09:13 AM
HI
it comes in the standard functionvoid 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 ..Hjalmar2015-08-30 10:41 PM
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.
2015-08-30 11:49 PM
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.2015-08-31 01:16 AM
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.