2018-12-01 12:44 PM
I'm trying to read the Interrupt Register off a memory-mapped device (through the FSMC peripheral) inside the interrupt handler function that handles the EXTI1 IRQ, but the execution never reaches the end of the ISR once the memory read function has been called inside the ISR and right after HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_1). After the second printf(), the program returns back to the main loop.
This is my interrupt handler:
void EXTI1_IRQHandler(void)
{
/* USER CODE BEGIN EXTI1_IRQn 0 */
printf("\n> This executes");
/* USER CODE END EXTI1_IRQn 0 */
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_1);
/* USER CODE BEGIN EXTI1_IRQn 1 */
printf("\n> This also executes");
FMC_ReadReg(INTERRUPT_REG, 0);
// WE NEVER GET HERE
/* USER CODE END EXTI1_IRQn 1 */
}
I don't know if calling the memory read function from the ISR disrupts the program counter, but I thought this is the best way to do it. For now, the only way for me to get the interrupt value is to update a flag (global variable) inside the ISR and pass that to a state machine inside my main loop so I know that I have to read the interrupt register. Reading or accessing the memory-mapped device works flawlessly almost everywhere across the program, except inside an interrupt handler. Any ideas?
2018-12-01 01:33 PM
What is FMC_ReadReg() ?
JW
2018-12-01 02:52 PM
It's the function that reads the interrupt register from memory-mapped device.