![](https://csdnimg.cn/release/download_crawler_static/88032722/bg8.jpg)
Step 4a: Understand the application
The following description is from the example project from STM32CubeG0 named
'LPUART_WakeUpFromStop_Init'.
@par Example Description
Configuration of GPIO and LPUART peripherals to allow characters received on LPUART_RX pin to
wake up the MCU from low-power mode. This example is based on the LPUART LL API. The peripheral
initialization uses LL initialization function to demonstrate LL init usage.
LPUART Peripheral is configured in asynchronous mode (9600 bauds, 8 data bit, 1 start bit, 1 stop
bit, no parity).
No HW flow control is used.
LPUART Clock is based on HSI.
Example execution:
After startup from reset and system configuration, LED3 is blinking quickly during 3 sec, then MCU
enters "Stop 0" mode (LED3 off). On first character reception by the LPUART from PC Com port (ex:
using HyperTerminal) after "Stop 0" Mode period, MCU wakes up from "Stop 0" Mode.
Received character value is checked :
- On a specific value ('S' or 's'), LED3 is turned On and program ends.
- If different from 'S' or 's', program performs a quick LED3 blinks during 3 sec and enters
again "Stop 0" mode, waiting for next character to wake up.
The first step is to understand the main settings for the MCU. This is generally clock speeds and power policies.
In this example, the general clock frequency is not specified because the only important setting is that the UART
works in low power Stop0 mode. It states the low power UART clock is based on the 'HIS' or high-speed internal
oscillator meaning there is no external crystal being used. The UART runs at 9600 baud, 8 data bits, 1 start and
stop bit, no parity. No hardware flow control is used. The application side checks for an 'S' or 's' to be received
and blinks an LED.
Step 4b: Find the closest MSPM0 example
Next step is to understand any differences between the UART modules for STM32G0 and MSPM0 and then
find the closest example in the MSPM0 SDK. This is easily accomplished by referring to the UART section in
Section 4. This section highlights differences between the UART modules and links to the UART-related MSPM0
SDK code examples. The closest example in the SDK for this example is probably uart_echo_interrupts_standby
where the "UART RX/TX echos using interrupts while device is in STANDBY mode".
This MSPM0 example is similar, but not identical to the being ported. This example is going to standby mode,
which is a lower power mode than Stop mode. The UART communication settings must be checked as well as
which GPIOs are being used. Finally, the application layer of monitoring for a specific character must be added.
Step 4c: Import and modify the example
Once a similar example is found, Open CCS and import the code example by going to Project > Import
CCS Projects... and navigate it to the MSPM0 SDK example folder. Import the example. Here is the
uart_echo_interrupts_standby example imported. This is a SysConfig project, so the main C file is simple. It
first calls the SysConfig driverlib initialization which is a function autogenerated by SysConfig to configures
the device. Then it enables the UART interrupt. Finally it goes to sleep waiting for any UART transaction. If it
receives a UART transaction, it echos the data right back and wakes up.
Ecosystem and Migration www.ti.com
8 Migration Guide From STM32
®
to Arm
®
-Based MSPM0 SLAAE56A – NOVEMBER 2022 – REVISED MARCH 2023
Submit Document Feedback
Copyright © 2023 Texas Instruments Incorporated