How to Achieve Sleep Wake-Up with MCU UART?

Follow+Star Public Account, don’t miss wonderful content
How to Achieve Sleep Wake-Up with MCU UART?
Source | Renesas Embedded Encyclopedia

UART is one of the most common communication methods in embedded development, thus making it a necessary peripheral for many projects.

The MCU UART (Universal Asynchronous Receiver-Transmitter) achieving sleep wake-up functionality typically involves low power design, interrupt mechanisms, and UART configuration.

Below, we will discuss methods for waking up from sleep using the UART in conjunction with the Renesas RA series microcontrollers.

Introduction

Taking RA2E1 as an example, it can achieve ultra-low power in sleep mode, with a typical sleep power consumption of only about 0.25uA at room temperature, making it very suitable for battery-powered applications or handheld devices.

Since the chip’s clock is off in this state (excluding the 32K sub-clock), it cannot receive UART wake-up (except for UART0’s Snooze mode). The following method allows for easy software configuration to achieve UART reception wake-up.

The principle is to pre-configure the RXD pin as IRQx before entering sleep, and then enter sleep. Most RA series chips have RXD & IRQ multiplexed pins, so no external hardware design is needed, allowing simple software switching between UART & IRQ to achieve both UART communication and sleep wake-up functionality.

Content & Principle

The demonstration example uses the EK-RA2E1 evaluation board, with UART1 (P401, P402) configured as TXD1 & RXD1. The method first configures UART1 through FSP for normal communication.

When entering sleep mode, UART1 is turned off, and RXD1 is released. Then, the IRQ4-related registers are configured to switch RXD1 to IRQ4 mode before entering sleep. When the other party sends any UART data (only for wake-up, no valid data can be received), the low level of the start bit can wake up the MCU, which will then reconfigure the IRQ4 pin back to RXD1.

The example uses a simple SW System Reset method to restart the system and reset RXD1 to UART.

Specific Configuration

01

UART1 Configuration

Configuring UART1 only requires setting it according to application needs, but it must be noted that the selected RXD pin must be multiplexed with IRQ for functional switching.

How to Achieve Sleep Wake-Up with MCU UART?

02

Low Power Mode Configuration

LPM is configured to SW Standby Mode, and in the Wake Sources, check IRQ4(RXD1).

How to Achieve Sleep Wake-Up with MCU UART?

03

IRQ Software Switching

Since IRQ is only for interrupt wake-up functionality, no interrupt callback functions need to be configured.

Switching process before entering sleep:

a. First, turn off UART1 and release the P402 pin

b. Configure P402 through PmnPFS to ISEL (1) & PIDR (1) = 0x4002

c. Disable IRQ4 and then configure the IRQ Control Register for IRQ4

d. Enable IRQ4

e. Enter sleep

f. After waking up from sleep, perform chip reset using NVIC_SystemReset() to return to UART1 startup state

How to Achieve Sleep Wake-Up with MCU UART?

By following the above simple low-level register configuration steps, the UART receive wake-up functionality can be achieved. However, since the chip requires some time to start the system clock after waking up, and the UART is in an unconfigured/turned-off state during this time, the wake-up data sent from the host cannot be effectively received. Communication data can only be normally received after the MCU has completed its startup, or after directly switching to UART1 after waking up.

Of course, if other microcontrollers do not have similar ultra-low power wake-up functionality, achieving similar wake-up functionality may require other methods, such as external interrupts, timer wake-up sleep, or sacrificing power consumption.

———— END ————

How to Achieve Sleep Wake-Up with MCU UART?

Using the OpenAMP framework to achieve inter-core communication and applications in multi-core processors

How to Achieve Sleep Wake-Up with MCU UART?

Sharing a lightweight open-source facial recognition algorithm

How to Achieve Sleep Wake-Up with MCU UART?

The differences between Release and Debug in the microcontroller development environment

Leave a Comment