ARMmbed

Sleep/deepsleep and Serial class

Hello.
On page https://os.mbed.com/docs/mbed-os/v5.13/apis/power-management-sleep.html mentioned about possibility of locking deepsleep from Serial class.

In test application I create instance of Serial.
Application send small amount of data and (after complete operation) invoke enable_input(false) and enable_output(false).
But, deepsleep still locked (and current indicator on test board say same).
It is a bug or expected behavior?

Configs on proper places:
“target.tickless-from-us-ticker”: false,
“target.deep-sleep-latency”: 50,
and
"macros_add": ["MBED_TICKLESS"],

Test application source:

#include "mbed.h"

void txcb(int v)
{
  //printf("txcb(%d)\n", v);
}

int main(void) {
  // low power mode clocks off
  __HAL_RCC_USB_OTG_FS_CLK_SLEEP_DISABLE();
  __HAL_RCC_USB_OTG_HS_CLK_SLEEP_DISABLE();
  __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_DISABLE();
  __HAL_RCC_DAC_CLK_SLEEP_DISABLE();
  __HAL_RCC_ADC1_CLK_SLEEP_DISABLE();
  __HAL_RCC_ADC2_CLK_SLEEP_DISABLE();
  __HAL_RCC_ADC3_CLK_SLEEP_DISABLE();
  __HAL_RCC_SAI1_CLK_SLEEP_DISABLE();
  __HAL_RCC_CAN1_CLK_SLEEP_DISABLE();
  __HAL_RCC_CAN2_CLK_SLEEP_DISABLE();
  __HAL_RCC_CEC_CLK_SLEEP_DISABLE();
  __HAL_RCC_FMPI2C1_CLK_SLEEP_DISABLE();
  __HAL_RCC_WWDG_CLK_SLEEP_DISABLE();

   mbed_file_handle(STDIN_FILENO)->enable_input(false);


  Serial serial(PA_9, PA_10, 115200);
  event_callback_t serialEventCb;

  serialEventCb = txcb;
  serial.enable_input(false);
  serial.write((const uint8_t *) "hello", 5, serialEventCb);
  ThisThread::sleep_for(1000);
  serial.enable_output(false);

  printf("sleep_manager_can_deep_sleep()=%d\r\n", sleep_manager_can_deep_sleep());    
  for (;;) {
    printf("sleep_manager_can_deep_sleep()=%d\r\n", sleep_manager_can_deep_sleep());    
    ThisThread::sleep_for(1000);
    
    //serial.enable_output(false);
    //serial.abort_write();
    //serial.abort_read();
    //serialEventCb = NULL;
    //serial.attach(NULL);
  }
}