Skip to content

Commit be60c33

Browse files
committed
fw/drivers/sf32lb52/uart: disable stop mode if RX is enabled
We cannot use stop mode (deepsleep) if UART RX is enabled, otherwise the system would not react to UART input when in deepsleep. While this increases power consumption significantly, it is not critical as on release builds (except on MFG firmware) the dbgserial is turned off. Fixes #427 Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
1 parent 5c3355d commit be60c33

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/fw/drivers/sf32lb52/uart.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "uart_definitions.h"
1818

1919
#include "drivers/uart.h"
20+
#include "kernel/util/stop.h"
2021
#include "system/passert.h"
2122

2223
#include "FreeRTOS.h"
@@ -37,12 +38,14 @@ static void prv_init(UARTDevice *dev, uint32_t mode) {
3738
case UART_MODE_TX_RX:
3839
HAL_PIN_Set(dev->tx.pad, dev->tx.func, dev->tx.flags, 1);
3940
HAL_PIN_Set(dev->rx.pad, dev->rx.func, dev->rx.flags, 1);
41+
stop_mode_disable(InhibitorDbgSerial);
4042
break;
4143
case UART_MODE_TX:
4244
HAL_PIN_Set(dev->tx.pad, dev->tx.func, dev->tx.flags, 1);
4345
break;
4446
case UART_MODE_RX:
4547
HAL_PIN_Set(dev->rx.pad, dev->rx.func, dev->rx.flags, 1);
48+
stop_mode_disable(InhibitorDbgSerial);
4649
break;
4750
default:
4851
WTF;

0 commit comments

Comments
 (0)