10 years, 4 months ago.

InterruptIn not working except PC_13 pin on ST Nucleo F103RB !!!!!

  1. include "mbed.h"

InterruptIn event(PC14); DigitalOut led(LED1);

void trigger() { printf("triggered!\n"); }

int main() { event.rise(&trigger); while(1) { led = !led; wait(0.25); } }

Above code is not working on STM32F103RB nucleo board, but works for USER_BUTTON(i.e PC_13).please help!!!

Question relating to:

Affordable and flexible platform to ease prototyping using a STM32F103RBT6 microcontroller.

A note: What does "not working mean" ? Is there compiler error ? Linker error? Runtime error? Share more details.

posted by Martin Kojtal 24 Jul 2014

code will compile, but program flow will not come out from "InterruptIn event(PC14);" line while running..

posted by prabin yadav 24 Jul 2014

1 Answer

10 years, 4 months ago.

If I name the pin PC_14 instead of PC14, it works fine for me...

If I do so , it gives me error... Error: Identifier "PC14" is undefined in "main.cpp",

posted by prabin yadav 25 Jul 2014

I get the compile error if I use PC14 (from your original code) If I use PC_14, the interrupt is behaving as expected for me.
What do you have connected on PC14?
If the pin is floating, I get many spurious interrupt due noise being picked up by the pin.
If the pin is connected to a push button, I get the same behavior as PC_13: one message sent to the terminal every time I press.
once in a while I get 2 messages probably due to the bouncing of the switch.

For me all this is normal behavior.

posted by Maxime TEISSIER 25 Jul 2014