10 years, 5 months ago.

Serial Interrupt

Can anyone identify what's wrong with this. I'm obviously missing something basic.

#include "mbed.h"
#include "rtos.h"
#include"RawSerial.h"

void Led1_Flasher(void const *args) 
{
    DigitalOut myled(LED1);

    while(1) 
    {
        myled = 1;
        wait(0.2);
        myled = 0;
        wait(0.2);
    }
}

void SerialInterruptHandler(void)
{
    DigitalOut led(LED2);
    
    led = !led;
    return;
}

int main() 
{
    RawSerial pc(USBTX, USBRX); // tx, rx
    pc.attach(&SerialInterruptHandler, Serial::RxIrq);

    Thread thread1(Led1_Flasher);
    
    while(true);
}

On an mbed LPC1768 sending a character to the USB serial port results in LED2 turning on (so the interrupt is obviously working to that degree) but the mbed is then locked up (LED1 stops flashing).

Is there some specific manner in which I should be returning from the interrupt?

1 Answer

10 years, 5 months ago.

Never mind. Just had to actually read a character to reset the interrupt. Interesting.

Accepted Answer