UART unbuffered serial port example not working on Nuvoton- m487 family controller

Hi Team,

While practiced UART(unbuffered serial) with nuvoton m487 family controller using mbedos, received error message: Mutex: 0x20001c94,Not allowed in ISR context.

without using interrupt function iam able to receive and sent data was working, but using receiver isr function not working.
for your reference:



  • Copyright (c) 2020 Arm Limited and affiliates.
  • SPDX-License-Identifier: Apache-2.0

#include “mbed.h”

// Create a DigitalOutput object to toggle an LED whenever data is received.
static DigitalOut led(LED1);

// Create a UnbufferedSerial object with a default baud rate.
static UnbufferedSerial serial_port(USBTX, USBRX);

void on_rx_interrupt()
char c;

// Toggle the LED.
led = !led;

// Read the data to clear the receive interrupt.
if (, 1)) {
    // Echo the input back to the terminal.
    serial_port.write(&c, 1);


int main(void)
// Set desired properties (9600-8-N-1).
/* bits / 8,
parity / SerialBase::None,
stop bit */ 1

// Register a callback to process a Rx (receive) interrupt.
serial_port.attach(&on_rx_interrupt, SerialBase::RxIrq);