I have problem with interrupt, I am using mbed API with simplest example but once the interrupt should be triggered it hangs MCU, couldn’t find the problm. same happens when I use HAL Gpio interrupt,
I am asking because all methods like - printf, getc/s, putc/s, wrire, read and so on are covered by Mutex in whole MbedOS and Mutex can not be called in ISR. You need to set a bool flag and proces it in main loop or take the code out from ISR context via EventQueue
Please try to use mbed_error_printf(…) instead of printf(…) in interrupt context.
Such like as:
void flip()
{
/* Call mbed_error_printf(…) instead of printf(…) in interrupt context */
mbed_error_printf(“Called in ISR\r\n”);
}
void main()
{
button.rise(&flip);
/* Call printf(...) or mbed_error_printf(...) in thread context at least once before the mbed_error_printf(...) call in interrupt context */
mbed_error_printf("Called in main\r\n");
while (true);
That’s my class for printf and other stuff, turns out that was problem, I removed that function from interrupt callback and everything works just fine. maybe it was taking some time there and had trouble with interrupt handler.