diff --git a/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_IMX/sleep.c b/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_IMX/sleep.c index bf4d011b87..86e9ee4500 100644 --- a/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_IMX/sleep.c +++ b/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_IMX/sleep.c @@ -19,8 +19,7 @@ extern void vPortPRE_SLEEP_PROCESSING(clock_mode_t powermode); extern void vPortPOST_SLEEP_PROCESSING(clock_mode_t powermode); -extern void serial_wait_tx_complete(uint32_t uart_index); - +extern bool serial_check_tx_ongoing(); void hal_sleep(void) { @@ -35,10 +34,12 @@ void hal_sleep(void) void hal_deepsleep(void) { - vPortPRE_SLEEP_PROCESSING(kCLOCK_ModeStop); + /* Check if any of the UART's is transmitting data */ + if (serial_check_tx_ongoing()) { + return; + } - /* Wait till debug UART is done transmitting */ - serial_wait_tx_complete(STDIO_UART); + vPortPRE_SLEEP_PROCESSING(kCLOCK_ModeStop); __DSB(); __WFI();