I am using STM32F103C8 blue pill board with arduino ide - stm32duino official core.
I am trying to configure the external interrupt on pin PB4, according to the datasheet.
However, seems like i have missed something or it doesn't work at all.
This is the piece of code I am using for testing purposes.
Code: Select all
void setup() {
pinMode(PB4, INPUT_PULLDOWN);
RCC->APB2ENR |= (1 << 0);
AFIO->EXTICR[2] |= (1 << 0);
EXTI->IMR |= (1 << 4);
EXTI->RTSR |= (1 << 4);
EXTI->FTSR &= ~(1 << 4);
NVIC_SetPriority(EXTI4_IRQn, 0);
NVIC_EnableIRQ(EXTI4_IRQn);
}
Code: Select all
void loop() {
// put your main code here, to run repeatedly:
}
Code: Select all
void EXTI4_IRQHandler(void) {
Serial.println("Trigger_Signal");
}
Code: Select all
attachInterrupt(PB4, EXTI4_IRQHandler, RISING);
Any Idea on how to do so?
Regards,