How to use sleep mode in AMB82-mini

I want to reduce power consumption when idle. because I will use AMB82-MINI with battery.

In “RTL8735B_Datasheet_1_0_Lite”, This document tell me RTL8735B support Sleep Mode and Snooze Mode that can continue execution of instructions when exit sleep mode. I interest in it.

I find in source code and found this.

void SleepCG(u16 Option, u32 SDuration, u8 Clock, u8 SramOption)

But I don’t know how to use this function.

Hi @Phum, May I know which SDK you are using? Arduino or Standard SDK?

Hi @pammyleong,

I can use both Arduino and Standard SDK. But now my code is based on Arduino and use some function from Standard SDK, e.g. read/write data in nor flash.

Hi @Phum,

For Standard SDK and Arduino SDK, we do not have any examples currently for using SleepCG. Sleep mode will be enabled if the SleepCG function is used.

The power consumption in standby mode could be lower than in sleep mode. You can consider using standby mode .

I have tried modifying the API and added an example, “SleepMode”. You can give it a try.

void SleepCG(u16 Option, u32 SDuration, u8 Clock, u8 SramOption)
Option: wake up source that you would like to set.
SDuration: Sleep duration
Clock: 1: 4MHz, 0: 100kHz.
SramOption: 0: shutdown mode. 1: retention mode. 2: Normal mode.

The SramOption can be changed in Line 430 based on your preference in PowerMode.cpp.

PowerMode.zip (7.2 KB)

Hi @pammyleong,

Before I post this thread. I have been tested SleepCG function by change Standby function in line 287 of original source code. But after wake-up, AMB82-mini have reset, not continue to run code.

Then I try change SramOption and store some program state in static variable. But after wake-up value in variable have reset to zero.

But now I found solution from pm_retention example. that is to change variable to store in .retention.data section. And enable SWR 1.35V(I don’t know what this is).

Now I success my objective to store some state or continue running of program.

Thank you.

Some of output

Log

== Rtl8735b IoT Platform ==
Chip VID: 0, Ver: 0
ROM Version: v3.0

[Normal mode]
BootFromNORFlash
[SPIF Err]Invalid ID
[Start Boot ROM…]
=== Load PARTBL ===
=== Load Done ===
=== Load ISP_IQ ===
[fcs chk pass]
ISP_IQ @ 0x8401080, 0x14f80, 0x0
mfcs_data version 0x00010001
fcs_data version 0x00010101
=== Process ISP_IQ ===
=== Load Done ===
=== Load BL ===
[Image Start Table @ 0x18200]
=== Load Done ===

== Boot Loader ==
Nov 21 2023:11:38:27
=== Load FCS Para ===
=== Load Done ===
[crc pass]
=== Load ISP_IQ Sensor ===
ISP_IQ @ 0x8401080, 0x14f80
=== Process ISP_IQ ===
=== Load Done ===
=== Load FW1 ===
[Image Start Table @ 0x20106200]
RAM Load @ 0x8081100->0x20106200, 0x6544
DRAM_TYPE is DDR2 128MB.
ddr_freq = 533
DDR Load @ 0x8088080->0x70100000, 0x14cc8
=== FW Load Done ===

Boot Loader <==

== RAM Start ==
Build @ 11:59:37, Nov 21 2023

$8735b>
PM Retention DEMO

retention_count=0

== Rtl8735b IoT Platform ==
Chip VID: 0, Ver: 0
ROM Version: v3.0

[Normal mode]
BootFromNORFlash
[SPIF Err]Invalid ID
[Start Boot ROM…]
=== Load PARTBL ===
=== Load Done ===
=== Load ISP_IQ ===
[fcs chk pass]
ISP_IQ @ 0x8401080, 0x14f80, 0x0
mfcs_data version 0x00010001
fcs_data version 0x00010101
=== Process ISP_IQ ===
=== Load Done ===
=== Load BL ===
[Image Start Table @ 0x18200]
=== Load Done ===

== Boot Loader ==
Nov 21 2023:11:38:27
=== Load FCS Para ===
=== Load Done ===
[crc pass]
=== Load ISP_IQ Sensor ===
ISP_IQ @ 0x8401080, 0x14f80
=== Process ISP_IQ ===
=== Load Done ===
=== Load FW1 ===
[Image Start Table @ 0x20106200]
RAM Load @ 0x8081100->0x20106200, 0x6544
DRAM_TYPE is DDR2 128MB.
ddr_freq = 533
DDR Load @ 0x8088080->0x70100000, 0x14cc8
=== FW Load Done ===

Boot Loader <==

== RAM Start ==
Build @ 11:59:37, Nov 21 2023

$8735b>
PM Retention DEMO

retention_count=1

== Rtl8735b IoT Platform ==
Chip VID: 0, Ver: 0
ROM Version: v3.0

[Normal mode]
BootFromNORFlash
[SPIF Err]Invalid ID
[Start Boot ROM…]
=== Load PARTBL ===
=== Load Done ===
=== Load ISP_IQ ===
[fcs chk pass]
ISP_IQ @ 0x8401080, 0x14f80, 0x0
mfcs_data version 0x00010001
fcs_data version 0x00010101
=== Process ISP_IQ ===
=== Load Done ===
=== Load BL ===
[Image Start Table @ 0x18200]
=== Load Done ===

== Boot Loader ==
Nov 21 2023:11:38:27
=== Load FCS Para ===
=== Load Done ===
[crc pass]
=== Load ISP_IQ Sensor ===
ISP_IQ @ 0x8401080, 0x14f80
=== Process ISP_IQ ===
=== Load Done ===
=== Load FW1 ===
[Image Start Table @ 0x20106200]
RAM Load @ 0x8081100->0x20106200, 0x6544
DRAM_TYPE is DDR2 128MB.
ddr_freq = 533
DDR Load @ 0x8088080->0x70100000, 0x14cc8
=== FW Load Done ===

Boot Loader <==

== RAM Start ==
Build @ 11:59:37, Nov 21 2023

$8735b>
PM Retention DEMO

retention_count=2

== Rtl8735b IoT Platform ==
Chip VID: 0, Ver: 0
ROM Version: v3.0

[Normal mode]
BootFromNORFlash
[SPIF Err]Invalid ID
[Start Boot ROM…]
=== Load PARTBL ===
=== Load Done ===
=== Load ISP_IQ ===
[fcs chk pass]
ISP_IQ @ 0x8401080, 0x14f80, 0x0
mfcs_data version 0x00010001
fcs_data version 0x00010101
=== Process ISP_IQ ===
=== Load Done ===
=== Load BL ===
[Image Start Table @ 0x18200]
=== Load Done ===

== Boot Loader ==
Nov 21 2023:11:38:27
=== Load FCS Para ===
=== Load Done ===
[crc pass]
=== Load ISP_IQ Sensor ===
ISP_IQ @ 0x8401080, 0x14f80
=== Process ISP_IQ ===
=== Load Done ===
=== Load FW1 ===
[Image Start Table @ 0x20106200]
RAM Load @ 0x8081100->0x20106200, 0x6544
DRAM_TYPE is DDR2 128MB.
ddr_freq = 533
DDR Load @ 0x8088080->0x70100000, 0x14cc8
=== FW Load Done ===

Boot Loader <==

== RAM Start ==
Build @ 11:59:37, Nov 21 2023

$8735b>
PM Retention DEMO

retention_count=3