2015-03-25 10:18 AM
Hi,
i'm pretty new to Interrupt handling so maybe i forgot something. This is my code for Setting up PA0 & PA1 Input Pins. The pin state works fine:bool GetRegisterDdkSpurA() { return GPIOA->IDR & GPIO_IDR_IDR_0; }
bool GetRegisterDdkSpurB() { return GPIOA->IDR & GPIO_IDR_IDR_1; } but i get no call of the Interrupt Routine - i set up like this:__GPIOA_CLK_ENABLE();
// GPIO A, Pin 0 Init
static GPIO_InitTypeDef aGpioInitPin0; aGpioInitPin0.Mode = GPIO_MODE_INPUT; aGpioInitPin0.Pull = GPIO_PULLDOWN; aGpioInitPin0.Speed = GPIO_SPEED_LOW; aGpioInitPin0.Alternate = 0; aGpioInitPin0.Pin = GPIO_PIN_0; HAL_GPIO_Init(GPIOA, &aGpioInitPin0);// GPIO A, Pin 1 Init
static GPIO_InitTypeDef aGpioInitPin1; aGpioInitPin1.Mode = GPIO_MODE_INPUT; aGpioInitPin1.Pull = GPIO_PULLDOWN; aGpioInitPin1.Speed = GPIO_SPEED_LOW; aGpioInitPin1.Alternate = 0; aGpioInitPin1.Pin = GPIO_PIN_1; HAL_GPIO_Init(GPIOA, &aGpioInitPin1); // Interrupt for PA0 SYSCFG->EXTICR[0] = (SYSCFG->EXTICR[0] & SYSCFG_EXTICR1_EXTI0) | SYSCFG_EXTICR1_EXTI0_PA; // Port A, Pin 0 auf _EXTI0-interrupt mappen. EXTI->RTSR |= (1 << EXTI0_IRQn); // Enable Rising Trigger for Interrupt ExtI0 EXTI->FTSR |= (1 << EXTI0_IRQn); // Enable Fallig Trigger for Interrupt ExtI0 HAL_NVIC_SetPriority(EXTI0_IRQn, 0x0F, 0x00); // lowest priority. HAL_NVIC_EnableIRQ(EXTI0_IRQn); // enable interrupt.// Interrupt for PA1
SYSCFG->EXTICR[1] = (SYSCFG->EXTICR[1] & SYSCFG_EXTICR1_EXTI1) | SYSCFG_EXTICR1_EXTI1_PA; // Port A, Pin 1 auf _EXTI1-interrupt mappen. EXTI->RTSR |= (1 << EXTI1_IRQn); // Enable Rising Trigger for Interrupt ExtI1 EXTI->FTSR |= (1 << EXTI1_IRQn); // Enable Fallig Trigger for Interrupt ExtI1 HAL_NVIC_SetPriority(EXTI1_IRQn, 0x0F, 0x00); // lowest priority. HAL_NVIC_EnableIRQ(EXTI1_IRQn); // enable interrupt. extern ''C'' void EXTI0_IRQHandler(void) {// ...
} extern ''C'' void EXTI1_IRQHandler(void) {// ...
}