cc2538: uart: Fix garbled output occurring upon lpm_enter()

lpm_enter() must not enter PM1+ if the UART is transmitting. Otherwise,
the UART clock gets disabled, and its TX is broken.

The commit b8b54a033c had already
partially fixed this issue, but it could still occur while transmitting
stop bits because, contrary to UART_FR.BUSY, UART_FR.TXFE takes only the
data bits into account, not the stop bits.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
This commit is contained in:
Benoît Thébaudeau 2016-08-15 03:07:52 +02:00
parent 9e91a3832d
commit a52a3d94d3

View file

@ -230,9 +230,7 @@ permit_pm1(void)
const uart_regs_t *regs;
for(regs = &uart_regs[0]; regs < &uart_regs[UART_INSTANCE_COUNT]; regs++) {
/* Note: UART_FR.TXFE reads 0 if the UART clock is gated. */
if((REG(SYS_CTRL_RCGCUART) & regs->sys_ctrl_rcgcuart_uart) != 0 &&
(REG(regs->base + UART_FR) & UART_FR_TXFE) == 0) {
if((REG(regs->base + UART_FR) & UART_FR_BUSY) != 0) {
return false;
}
}