Czy wolisz polską wersję strony elektroda?
Nie, dziękuję Przekieruj mnie tampowersave for bk7231
PowerSave 1
, DeepSleep <sec>
, or bk_enter_deep_sleep()
with appropriate wake-up sources. BK7231 power domains & clocks
• Core domain (CPU + SRAM) – up to 120 MHz; gated in dynamic sleep.
• Wi-Fi PHY/RF domain – 40 MHz crystal or PLL; turned off in deep sleep.
• Always-On (AON) domain – 32 kHz RC/XO, RTC, a few GPIOs, small 256 B SRAM.
• Peripherals domain – UART/SPI/I²C/ADC; individually clock-gated.
Power-saving states (measured on BK7231N reference board, 3.3 V) | State | Supply current | Wake-up time | Connectivity | Typical use | SDK keyword / OBK cmd |
---|---|---|---|---|---|---|
ACTIVE | 60–120 mA Tx | 0 | full | data Tx/Rx | none | |
POWER-SAVE / MODEM-SLEEP | 4–15 mA (depends on DTIM) | 200 µs | STA stays associated | standby with low latency | bk_wlan_mcu_ps_mode_enable() , PowerSave 1 |
|
LOW-VOLTAGE SLEEP | 0.3–1 mA | <1 ms | disconnected | fast periodic tasks | bk_ps_low_voltage_sleep() |
|
DEEP-SLEEP TIMER | 5–20 µA (RTC on) | 3–8 ms boot + Wi-Fi connect | none | long-interval sensors | bk_enter_deep_sleep() , DeepSleep 900 |
|
PIN-DEEP-SLEEP | 2–8 µA (RTC off) | same as above | none | door/BTN wake | PinDeepSleep GPIO13 FALLING |
802.11 Power-save theory
P ∝ beacon interval / DTIM.
• Module sets PS flag → AP buffers frames.
• BK7231 wakes every DTIM-period (N×102.4 ms on 2.4 GHz).
• Increasing DTIM or listen_interval
lowers average current but adds latency.
Firmware hooks
a. Beken SDK 3.x
bk_wlan_mcu_ps_mode_enable(); // dynamic sleep
bk_wlan_dtim_rf_ps_mode_enable(3); // DTIM=3
bk_enter_deep_sleep(PS_DEEP_WAKEUP_RTC, // deep sleep 30 s
30000, 0, 0);
b. OpenBeken CLI
PowerSave 1 // enable dynamic sleep
DeepSleep 600 // 10 min deep sleep
PinDeepSleep 8 RISING // wake on GPIO8 rising edge
Wifi_LCDTIM 3 // set DTIM=3
System-level optimisation
• Batch sensing + MQTT publish → deep sleep immediately.
• Disable pull-ups on unused pins (GPIO_INIT_HIGH_IMPEDANCE
).
• Gate external sensors via MOSFET on GPIO to remove their quiescent current.
• Compile hot code into IRAM, use WFI
instruction inside idle hook.
PowerSave 1
in 2023; recent PRs fix peripheral glitches (UART0 DMA & BL0937 spikes) when dynamic sleep is active. Example: Battery-door sensor running on CR2032
PinDeepSleep
with GPIO3 (reed switch) rising-edge. Analogy: Think of dynamic sleep as putting your phone screen off but still connected to LTE; deep sleep is like powering it down and relying on the alarm clock.
PowerSave 1
; if average current >2 mA, move to deep sleep. bk_misc_get_wakeup_source()
for debugging. listen_interval
. BK7231 offers multi-tier power saving: dynamic (online), low-voltage, and deep-sleep (offline). Use PowerSave 1
for latency-sensitive mains devices; adopt DeepSleep
/PinDeepSleep
for battery sensors. Tune DTIM, gate peripherals, and verify with µA-grade instruments to achieve single-digit-µA standby currents and multi-year battery life.