The first byte of UART Rx (/dev/ttyHS4) is always missing


#1

Hello.

When receiving UART data, the first byte of Rx (ttyHS4) is always missing.
It seems to wake up with the first byte after going into sleep mode.
You must disable sleep mode and use the received data as is.
Can this UART sleeping option be disabled?
Please advice.


#2

Usually when a device support runtime PM you can disable sleep mode via sysfs, something like this (not tested):

echo on > /sys/class/tty/ttyHS4/power/control

#3

I tried with the “on” and “auto” options, but I can not.

Modified the following in the kernel source(msm_serial_hs.c)
static int msm_hs_runtime_suspend(struct device *dev)
{
//msm_hs_pm_suspend(dev);
return 0;
}

I confirmed that it is not suspend.
source Is there a better way without modification?


#4

What do you mean ? did you try as root ?

The sysfs way should work, forcing ‘on’ prevents the device to be suspended.


#5

change auto suspend delay time in function and see you are able to achieve expected output
static void msm_serial_hs_rt_init(struct uart_port *uport)

{

  • pm_runtime_set_autosuspend_delay(uport->dev, 100);
  • pm_runtime_set_autosuspend_delay(uport->dev, 500);

}