UART and LOGUART
For peripherals that require specific clock settings, such as UART and LOGUART, the configuration procedures are described in the following sections.
Initialize UART/LOGUART and enable their interrupts.
Set the wake-up source: In
sleep_wevent_config[], configure the wake-up source (UART0/UART1/UART2_BT/UART_LOG) and specify the CPU to be woken up (WAKEUP_KM4 or WAKEUP_KM0). Ensure the interrupt is registered on the CPU to be woken up.Select the clock source:
XTAL: In
ps_config[], set xtal_mode_in_sleep to XTAL_Normal and set keep_OSC4M_on to TRUE.OSC2M: In
ps_config[], set keep_OSC4M_on to TRUE.
Set the operating voltage: In
ps_config[], setsleep_to_08Vto TRUE.Enter sleep mode by releasing the wake lock on KM4 (PMU_OS needs to be released because it is acquired by default at system startup).
Clear the UART/LOGUART interrupt after waking up.
Note
When using UART as a wake-up source, the following limitations apply:
The Rx clock source can only be OSC2M, and OSC4M must not be turned off during sleep. It is not recommended to use UART as a wake-up source when the baud rate is greater than 115200.
Before sleep, you need to call the API
RCC_PeriphClockSource_UART(UARTx_DEV, UART_RX_CLK_OSC_LP)to switch the clock to OSC2M.If higher baud rate is required after waking up, you can use the API
RCC_PeriphClockSource_UART(UARTx_DEV, UART_RX_CLK_XTAL_40M)to switch to XTAL40M Rx clock.
Any part of commands used for wake-up that exceed the FIFO depth (64 bytes) will be lost.
When using LOGUART as a wake-up source, the following limitations apply:
If the Rx clock source is OSC2M, OSC4M must not be turned off during sleep.
Before sleep, you need to call the API
RCC_PeriphClockSource_LOGUART(LOGUART_CLK_OSC_LP)to switch the clock to OSC2M.If higher baud rate is required after waking up, you can use the API
RCC_PeriphClockSource_LOGUART(LOGUART_CLK_XTAL_40M)to switch to XTAL40M Rx clock.
If the Rx clock source is XTAL40M, XTAL must not be turned off during sleep.
Any part of commands used for wake-up that exceed the FIFO depth (16 bytes) will be lost.
For peripherals that require specific clock settings, such as UART and LOGUART, the configuration procedures are described in the following sections.
Initialize UART/LOGUART and enable their interrupts.
Set the wake-up source: In
sleep_wevent_config[], set the wake-up source (UART0/UART1/UART2/UART3/UART_LOG) and specify the CPU to be woken up (WAKEUP_AP or WAKEUP_NP). Ensure the interrupt is registered on the CPU to be woken up.Set the clock source: In
ps_config[], set xtal_mode_in_sleep to XTAL_Normal.Enter sleep mode by releasing the wake lock on KM4 (PMU_OS needs to be released because it is acquired by default at system startup).
Clear the UART/LOGUART interrupt upon waking up.
Note
When using UART as a wake-up source, the following limitations exist:
When the Rx clock source is XTAL40M, do not turn off XTAL during sleep.
Any part of a wake-up command exceeding the FIFO depth (64 bytes) will be lost.
When using LOGUART as a wake-up source, the following limitations exist:
When the Rx clock source is XTAL40M, do not turn off XTAL during sleep.
Any part of a wake-up command exceeding the FIFO depth (16 bytes) will be lost.
For peripherals that require specific clock settings, such as UART and LOGUART, the configuration procedures are described in the following sections.
Initialize UART/LOGUART and enable their interrupts.
Set the wake-up source: In
sleep_wevent_config[], set the wake-up source (UART0/UART1/UART2/UART3/UART_LOG) and specify the CPU to be woken up (WAKEUP_AP or WAKEUP_NP). Ensure the interrupt is registered on the CPU to be woken up.Set the clock source: In
ps_config[], set xtal_mode_in_sleep to XTAL_Normal.Enter sleep mode by releasing the wake lock on KM4 (PMU_OS needs to be released because it is acquired by default at system startup).
Clear the UART/LOGUART interrupt upon waking up.
Note
When using UART as a wake-up source, the following limitations exist:
When the Rx clock source is XTAL40M, do not turn off XTAL during sleep.
Any part of a wake-up command exceeding the FIFO depth (64 bytes) will be lost.
When using LOGUART as a wake-up source, the following limitations exist:
When the Rx clock source is XTAL40M, do not turn off XTAL during sleep.
Any part of a wake-up command exceeding the FIFO depth (16 bytes) will be lost.
For peripherals that require specific clock settings, such as UART and LOGUART, the configuration procedures are described in the following sections.
Initialize UART/LOGUART and enable their interrupts.
Set the wake-up source: In
sleep_wevent_config[], set the wake-up source (UART0/UART1/UART2/UART3/UART_LOG) and specify the CPU to be woken up (WAKEUP_AP or WAKEUP_NP). Ensure the interrupt is registered on the CPU to be woken up.Set the clock source: In
ps_config[], set xtal_mode_in_sleep to XTAL_Normal.Enter sleep mode by releasing the wake lock on KM4 (PMU_OS needs to be released because it is acquired by default at system startup).
Clear the UART/LOGUART interrupt upon waking up.
Note
When using UART as a wake-up source, the following limitations exist:
When the Rx clock source is XTAL40M, do not turn off XTAL during sleep.
Any part of a wake-up command exceeding the FIFO depth (64 bytes) will be lost.
When using LOGUART as a wake-up source, the following limitations exist:
When the Rx clock source is XTAL40M, do not turn off XTAL during sleep.
Any part of a wake-up command exceeding the FIFO depth (16 bytes) will be lost.
For peripherals that require specific clock settings, such as UART and LOGUART, the configuration procedures are described in the following sections.
Initialize UART/LOGUART and enable their interrupts.
Set the wake-up source: In
sleep_wevent_config[], set the wake-up source (UART0/UART1/UART2/UART3/UART_LOG) and specify the CPU to be woken up (WAKEUP_AP or WAKEUP_NP). Ensure the interrupt is registered on the CPU to be woken up.Set the clock source: In
ps_config[], set xtal_mode_in_sleep to XTAL_Normal.Enter sleep mode by releasing the wake lock on KM4 (PMU_OS needs to be released because it is acquired by default at system startup).
Clear the UART/LOGUART interrupt upon waking up.
Note
When using UART as a wake-up source, the following limitations exist:
When the Rx clock source is XTAL40M, do not turn off XTAL during sleep.
Any part of a wake-up command exceeding the FIFO depth (64 bytes) will be lost.
When using LOGUART as a wake-up source, the following limitations exist:
When the Rx clock source is XTAL40M, do not turn off XTAL during sleep.
Any part of a wake-up command exceeding the FIFO depth (16 bytes) will be lost.
For peripherals that require specific clock settings, such as UART and LOGUART, the configuration procedures are described in the following sections.
Initialize UART/LOGUART and enable their interrupts.
Set the wake-up source: In
sleep_wevent_config[], set the relevant wake-up source (UART0/UART1/UART2/UART_LOG) and specify the CPU to be woken up (WAKEUP_AP/WAKEUP_NP/WAKEUP_LP). Ensure the interrupt is registered on the corresponding CPU.Select the clock source:
XTAL: In
ps_config[], set xtal_mode_in_sleep to XTAL_Normal and set keep_OSC4M_on to TRUE.OSC2M: In
ps_config[], set keep_OSC4M_on to TRUE.
Enter sleep mode by releasing the wake lock on KM4 (PMU_OS needs to be released because it is acquired by default at system startup).
Clear the UART/LOGUART interrupt upon wake-up.
Note
When using UART as a wake-up source, the following limitations apply:
If the Rx clock source is XTAL40M, do not turn off XTAL during sleep.
If the Rx clock source is OSC2M, do not turn off OSC4M during sleep.
Before sleep, call the API
RCC_PeriphClockSource_UART(UARTx_DEV, UART_RX_CLK_OSC_LP)to switch the clock to OSC2M.If a higher baud rate is needed after waking up, call
RCC_PeriphClockSource_UART(UARTx_DEV, UART_RX_CLK_XTAL_40M)to switch to XTAL40M Rx clock.
Any part of a wake-up command exceeding the FIFO depth (64 bytes) will be lost.
When using LOGUART as a wake-up source, the following limitations apply:
If the Rx clock source is XTAL40M, do not turn off XTAL during sleep.
If the Rx clock source is OSC2M, do not turn off OSC4M during sleep.
Before sleep, call the API
RCC_PeriphClockSource_LOGUART(UARTLOG_CLK_OSC_LP)to switch the clock to OSC2M.If a higher baud rate is needed after waking up, call
RCC_PeriphClockSource_LOGUART(UARTLOG_CLK_XTAL_40M)to switch to XTAL40M Rx clock.
Any part of a wake-up command exceeding the FIFO depth (16 bytes) will be lost.