Skip to content

Commit 3c10e98

Browse files
jtguggedalsimensrostad
authored andcommitted
modules: shell: Add wait before UARTs are suspended
Add a short wait before UARTs are suspended to leave time to empty the buffers. Otherwise an assert will kick in because the TX_STOPPED event has not been received before suspending the UARTs. Signed-off-by: Jan Tore Guggedal <[email protected]>
1 parent 367aafb commit 3c10e98

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

app/src/modules/shell/shell.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ static void uart_disable_handler(struct k_work *work)
6767
}
6868
#endif
6969

70+
/* Wait for UART buffers to be emptied before suspending.
71+
* If a transfer is ongoing, the driver will cause an assertion to fail.
72+
* 100 ms is an arbitrary value that should be enough for the buffers to empty.
73+
*/
74+
k_busy_wait(100 * USEC_PER_MSEC);
75+
7076
if (device_is_ready(uart1_dev)) {
7177
pm_device_action_run(uart1_dev, PM_DEVICE_ACTION_SUSPEND);
7278
}

0 commit comments

Comments
 (0)