Supported Chips
Ameba SoC |
RTL8721Dx |
RTL8726E |
RTL8720E |
RTL8730E |
---|---|---|---|---|
Supported |
Y |
Y |
Y |
Y |
Introduction
This chapter mainly introduces various configuration files that require special attention and modification during the development process.
ameba_bootcfg
This section introduces the boot-related configurations including SoC clock switch and boot log.
GitHub
The KM4 boots at 200MHz at the BootRom Stage, and switches to a higher frequency during the bootloader Stage.
There are some limitations when changing the SoC clock:
Clock |
Cut |
Frequency |
Core voltage |
---|---|---|---|
PLL |
300MHz ~ 600MHz |
||
KM0 |
A-Cut |
≤115MHz |
|
KM4 |
A-Cut |
≤260MHz |
0.9V |
KM4 |
A-Cut |
≤345MHz |
1.0V |
Note
The maximum operating speed of Flash with Wide Range VCC 1.65V~3.6V should use the speed limit of 1.65V~2.3V power supply.
SoC & PSRAM Clock Set Flow
Check the value of
Boot_SocClk_Info_Idx
andSocClk_Info[]
inameba_bootcfg.c
.// For KM4, max. 345MHz under 1.0V, max. 260MHz under 0.9V // For KM0, max. 115MHz under 1.0V, max. 104MHz under 0.9V // PLL can be 300MHz~688.128MHz // KM4_CKD range is [1, 8], KM0_CKD range is [1, 16] or USEXTAL const SocClk_Info_TypeDef SocClk_Info[] = { // PLL_CLK, Vol_Type, KM4_CKD, KM0_CKD, PSRAMC_CKD {PLL_520M, CORE_VOL_0P9, CLKDIV(2), CLKDIV(5), CLKDIV(2)}, {PLL_331M, CORE_VOL_1P0, CLKDIV(1), CLKDIV(3), CLKDIV(1)}, {PLL_400M, CORE_VOL_0P9, CLKDIV(2), CLKDIV(4), CLKDIV(1)}, {PLL_480M, CORE_VOL_0P9, CLKDIV(2), CLKDIV(5), CLKDIV(2)}, // 48M for USB {PLL_677P376M, CORE_VOL_1P0, CLKDIV(2), CLKDIV(6), CLKDIV(2)}, {PLL_688P128M, CORE_VOL_1P0, CLKDIV(2), CLKDIV(6), CLKDIV(2)}, }; /** * @brief SocClk_Info selection * Boot_SocClk_Info_Idx is [0, sizeof(SocClk_Info)), Soc will set the SoC clock by SocClk_Info[Boot_SocClk_Info_Idx] * / #ifdef CONFIG_USB_DEVICE_EN u8 Boot_SocClk_Info_Idx = 3; // Make sure the PLL_CLK for USB is an integer multiple of 48MHz #else u8 Boot_SocClk_Info_Idx = 0; #endif
Check the
BOOT_ChipInfo_ClkInfoIdx()
function in\bootloader\bootloader_km4.c
.u32 BOOT_ChipInfo_ClkInfoIdx(void) { /* PSRAM die is wb955 which can run up to 200MHz */ /* Boot_SocClk_Info_Idx is valid, use user config socclk */ return Boot_SocClk_Info_Idx; }
The bootloader will set the SoC clock defined by
SocClk_Info[Boot_SocClk_Info_Idx]
, and PSRAM rate will also be changed with SoC clock.PSRAM type
PSRAM speed
SocClk_Info[x]
Clock Info
No PSRAM
SocClk_Info[0]
PLL: 520MHz
KM4: 260MHz
KM0: 86.6MHz
WB955
≤200MHz
SocClk_Info[1]
PLL: 330MHz
KM4: PLL/1
KM0: PLL/4
PSRAM: PLL/2
Refer to one of the following methods to change the SoC clock if needed.
Modify
SocClk_Info[0]
inameba_bootcfg.c
.Modify
Boot_SocClk_Info_Idx
to [0, sizeof(SocClk_Info)], and then define your own clock info inSocClk_Info [Boot_SocClk_Info_Idx]
.
Note
Consider the limitations of the hardware and do not set the clock info illogically.
Example
Change
KM4_CKD
ofSocClk_Info[0]
toCLKDIV(3)
if KM4 is wanted to run at 520MHz/3.// For KM4, max. 345MHz under 1.0V, max. 260MHz under 0.9V // For KM0, max. 115MHz under 1.0V, max. 104MHz under 0.9V // PLL can be 300MHz~688.128MHz // KM4_CKD range is [1, 8], KM0_CKD range is [1, 16] or USEXTAL const SocClk_Info_TypeDef SocClk_Info[] = { // PLL_CLK, Vol_Type, KM4_CKD, KM0_CKD, PSRAMC_CKD {PLL_520M, CORE_VOL_0P9, CLKDIV(2), CLKDIV(5), CLKDIV(2)}, {PLL_331M, CORE_VOL_1P0, CLKDIV(1), CLKDIV(3), CLKDIV(1)}, {PLL_400M, CORE_VOL_0P9, CLKDIV(2), CLKDIV(4), CLKDIV(1)}, {PLL_480M, CORE_VOL_0P9, CLKDIV(2), CLKDIV(5), CLKDIV(2)}, // 48M for USB {PLL_677P376M, CORE_VOL_1P0, CLKDIV(2), CLKDIV(6), CLKDIV(2)}, {PLL_688P128M, CORE_VOL_1P0, CLKDIV(2), CLKDIV(6), CLKDIV(2)}, };
Based on the example configuration, the clock of KM4 is 173.3MHz, KM0 is 86.6MHz, PSRAM controller is 260MHz (twice the PSRAM), and core power is 0.9V. The clocks of left modules will be set to a reasonable value by software automatically based on their maximum speeds.
Rebuild the project and download the new image again.
GitHub
The KM4 boots at 150MHz at the BootROM Stage, and switches to a higher frequency during the bootloader Stage.
There are some limitations when changing the SoC clock:
Clock |
Cut |
Frequency |
Core voltage |
Note |
---|---|---|---|---|
PLLM |
330MHz ~ 660MHz |
|||
PLLD |
330MHz ~ 660MHz |
Can not exceed the maximum frequency of DSP clock |
||
KM4/KR4 |
A-Cut |
≤200MHz |
0.9V |
|
KM4/KR4 |
A-Cut |
≤240MHz |
1.0V |
|
KM4/KR4 |
B-Cut |
≤300MHz |
0.9V |
|
KM4/KR4 |
B-Cut |
≤400MHz |
1.0V |
|
DSP |
≤400MHz |
0.9V |
The same as PLLD |
|
DSP |
≤500MHz |
1.0V |
The same as PLLD |
SoC & PSRAM Clock Set Flow
(Optional) Find out the speed limit of embedded PSRAM device, if not sure.
Print the value of
ChipInfo_BDNum()
function, which will get the chip info from OTP.Refer to PSRAM type in Chip_Info[] in
\component\soc\amebalite\lib\ram_common\ameba_chipinfo_lib.c
.
For example, if bdnumer is 0x1010, the PSRAM can run under 200MHz.
const CHIPINFO_TypeDef Chip_Info[] = { //subnum pkgnum bdnumer psram type {0, 2, 1010, PSRAM_DEVICE_CLK_200 | PSRAM_VENDOR_WB | PSRAM_SIZE_32Mb | PSRAM_PAGE128 }, //QFN48 {0, 3, 1011, PSRAM_DEVICE_CLK_250 | PSRAM_VENDOR_WB | PSRAM_SIZE_256Mb | PSRAM_PAGE1024 }, //QFN68 {0, 1, 1012, PSRAM_VENDOR_NONE }, //QFN48 {0, 0, 1014, PSRAM_DEVICE_CLK_NotClear | PSRAM_VENDOR_NotClear }, //QFN144 debug package {1, 2, 1015, PSRAM_DEVICE_CLK_200 | PSRAM_VENDOR_WB | PSRAM_SIZE_32Mb | PSRAM_PAGE128 }, //QFN48 {1, 1, 1016, PSRAM_VENDOR_NONE }, //QFN48 {0, 4, 1019, PSRAM_DEVICE_CLK_250 | PSRAM_VENDOR_WB | PSRAM_SIZE_128Mb | PSRAM_PAGE2048 }, //QFN68 {0, 5, 1022, PSRAM_VENDOR_NONE }, //QFN48 {1, 2, 1023, PSRAM_DEVICE_CLK_200 | PSRAM_VENDOR_WB | PSRAM_SIZE_32Mb | PSRAM_PAGE128 }, //QFN48 {1, 1, 1024, PSRAM_VENDOR_NONE }, //QFN48 {1, 5, 1025, PSRAM_VENDOR_NONE }, //QFN48 {0, 6, 1026, PSRAM_VENDOR_NONE }, //QFN68 {0, 7, 1027, PSRAM_VENDOR_NONE }, //QFN68 {0xFF, 0xFF, 0xFFFF, PSRAM_DEVICE_CLK_NotClear | PSRAM_VENDOR_NotClear }, //debug package };
Check the value of Boot_SocClk_Info_Idx and the clock info in
ameba_bootcfg.c
.// for kr4/km4, max 400MHz under 1.0v, max 200MHz under 0.9v // for dsp, max 500MHz under 1.0v, max 400MHz under 0.9v // CPUPLL(PLLM)/DSPPLL(PLLD) can be 330MHz~660MHz // All CLKDIV range is [1, 16] SocClk_Info_TypeDef SocClk_Info[] = { /* PLLM_CLK, PLLD_CLK, Vol_Type, CPU_CKD, PSRAMC_CKD*/ {PLL_600M, PLL_500M, CORE_VOL_0P9, CLKDIV(3) | ISPLLM, CLKDIV(2) | ISPLLM}, /*0.9V, PSRAM-166M 8720E QFN48*/ {PLL_600M, PLL_500M, CORE_VOL_1P0, CLKDIV(3) | ISPLLM, CLKDIV(2) | ISPLLM}, /*1.0V, PSRAM-166M 8720E QFN48*/ {PLL_400M, PLL_500M, CORE_VOL_1P0, CLKDIV(2) | ISPLLM, CLKDIV(1) | ISPLLM}, /*1.0V, PSRAM-200M*/ {PLL_480M, PLL_500M, CORE_VOL_1P0, CLKDIV(2) | ISPLLM, CLKDIV(1) | ISPLLD}, /*1.0V, PSRAM-250M 8726E QFN68*/ }; /** * @brief SocClk_Info select * Boot_SocClk_Info_Idx valid value is [0, 3] and 0xFF * when Boot_SocClk_Info_Idx is 0xFF, set socclk by chipinfo Automatically * when Boot_SocClk_Info_Idx is [0, 3], set socclk by SocClk_Info[Boot_SocClk_Info_Idx] */ u8 Boot_SocClk_Info_Idx = 0xFF;
If Boot_SocClk_Info_Idx is not 0xFF, the bootloader will set the SoC clock defined by
SocClk_Info[Boot_SocClk_Info_Idx]
.If Boot_SocClk_Info_Idx is 0xFF (default), the bootloader will set the SoC clock automatically according to the embedded PSRAM type.
For example, if bdnumer is 0x1010, the PSRAM can run under 166MHz, and the bootloader will use
SocClk_Info[1]. CLKDIV(3) | ISPLLM
, means the clocks KM4/KR4 equal to PLLM/3.PSRAM type
PSRAM speed
SocClk_Info[x]
Clock Info
No PSRAM
SocClk_Info[0]
PLLM: 600MHz
PLLD: 500MHz
KM4/KR4: 200MHz
With PSRAM
≤166MHz
SocClk_Info[1]
PLLM: 600MHz
PLLD: 500MHz
KM4/KR4: 200MHz
With PSRAM
≤200MHz
SocClk_Info[2]
PLLM: 400MHz
PLLD: 500MHz
KM4/KR4: 200MHz
With PSRAM
≤250MHz
SocClk_Info[3]
PLLM: 480MHz
PLLD: 500MHz
KM4/KR4: 240MHz
Refer to one of the following methods to change the SoC clock if needed.
Keep the Boot_SocClk_Info_Idx 0xFF, and only change the clock info of
SocClk_Info[x]
to set the clocks of PLLM/PLLD and CPUs.Modify the Boot_SocClk_Info_Idx to [0, 3], and then define your own clock info in
SocClk_Info[Boot_SocClk_Info_Idx]
.
Note
Consider the limitations of the hardware and do not set the clock info illogically.
Example
Change CPU_CKD of
SocClk_Info[2]
to CLKDIV(1) if CPU is needed to run faster.SocClk_Info_TypeDef SocClk_Info[] = { /* PLLM_CLK, PLLD_CLK, Vol_Type, CPU_CKD, PSRAMC_CKD*/ {PLL_600M, PLL_500M, CORE_VOL_0P9, CLKDIV(3) | ISPLLM, CLKDIV(2) | ISPLLM}, /*0.9V, PSRAM-166M 8720E QFN48*/ {PLL_600M, PLL_500M, CORE_VOL_1P0, CLKDIV(3) | ISPLLM, CLKDIV(2) | ISPLLM}, /*1.0V, PSRAM-166M 8720E QFN48*/ {PLL_400M, PLL_500M, CORE_VOL_1P0, CLKDIV(2) | ISPLLM, CLKDIV(1) | ISPLLM}, /*1.0V, PSRAM-200M*/ {PLL_480M, PLL_500M, CORE_VOL_1P0, CLKDIV(2) | ISPLLM, CLKDIV(1) | ISPLLD}, /*1.0V, PSRAM-250M 8726E QFN68*/ }; /** * @brief SocClk_Info select * Boot_SocClk_Info_Idx valid value is [0, 3] and 0xFF * when Boot_SocClk_Info_Idx is 0xFF, set socclk by chipinfo Automatically * when Boot_SocClk_Info_Idx is [0, 3], set socclk by SocClk_Info[Boot_SocClk_Info_Idx] */ u8 Boot_SocClk_Info_Idx = 0xFF;
Based on the configuration, the clock of KM4/KR4 is 400MHz, PSRAM controller is 400MHz (twice the PSRAM), and core power is 1.0V. The clocks of left modules will be set to a reasonable value by software automatically based on their maximum speeds.
Note
The PLLD can be disabled if you do not need it work.
Re-build the project and download the new image again.
Boot_Log_En
The bootloader log is enabled by default and can be disabled through Boot_Log_En.
/**
* @brif boot log enable or disable.
* FALSE: disable
* TRUE: enable
*/
u8 Boot_Log_En = TRUE;
Boot_Agg_En
The Boot_Agg_En is used with Trace Tool to sort out boot logs from different cores. It can be enabled through Boot_Agg_En.
/**
* @brif Loguart AGG enable or disable
* FALSE: disable
* TRUE: enable
*/
u8 Boot_Agg_En = FALSE;
Note
Refer to Chapter Trace Tool for more information.
GitHub
The KM4 boots at 150MHz at the BootROM Stage, and switches to a higher frequency during the bootloader Stage.
There are some limitations when changing the SoC clock:
Clock |
Cut |
Frequency |
Core voltage |
Note |
---|---|---|---|---|
PLLM |
330MHz ~ 660MHz |
|||
PLLD |
330MHz ~ 660MHz |
Can not exceed the maximum frequency of DSP clock |
||
KM4/KR4 |
A-Cut |
≤200MHz |
0.9V |
|
KM4/KR4 |
A-Cut |
≤240MHz |
1.0V |
|
KM4/KR4 |
B-Cut |
≤300MHz |
0.9V |
|
KM4/KR4 |
B-Cut |
≤400MHz |
1.0V |
SoC & PSRAM Clock Set Flow
(Optional) Find out the speed limit of embedded PSRAM device, if not sure.
Print the value of
ChipInfo_BDNum()
function, which will get the chip info from OTP.Refer to PSRAM type in Chip_Info[] in
\component\soc\amebalite\lib\ram_common\ameba_chipinfo_lib.c
.
For example, if bdnumer is 0x1010, the PSRAM can run under 200MHz.
const CHIPINFO_TypeDef Chip_Info[] = { //subnum pkgnum bdnumer psram type {0, 2, 1010, PSRAM_DEVICE_CLK_200 | PSRAM_VENDOR_WB | PSRAM_SIZE_32Mb | PSRAM_PAGE128 }, //QFN48 {0, 3, 1011, PSRAM_DEVICE_CLK_250 | PSRAM_VENDOR_WB | PSRAM_SIZE_256Mb | PSRAM_PAGE1024 }, //QFN68 {0, 1, 1012, PSRAM_VENDOR_NONE }, //QFN48 {0, 0, 1014, PSRAM_DEVICE_CLK_NotClear | PSRAM_VENDOR_NotClear }, //QFN144 debug package {1, 2, 1015, PSRAM_DEVICE_CLK_200 | PSRAM_VENDOR_WB | PSRAM_SIZE_32Mb | PSRAM_PAGE128 }, //QFN48 {1, 1, 1016, PSRAM_VENDOR_NONE }, //QFN48 {0, 4, 1019, PSRAM_DEVICE_CLK_250 | PSRAM_VENDOR_WB | PSRAM_SIZE_128Mb | PSRAM_PAGE2048 }, //QFN68 {0, 5, 1022, PSRAM_VENDOR_NONE }, //QFN48 {1, 2, 1023, PSRAM_DEVICE_CLK_200 | PSRAM_VENDOR_WB | PSRAM_SIZE_32Mb | PSRAM_PAGE128 }, //QFN48 {1, 1, 1024, PSRAM_VENDOR_NONE }, //QFN48 {1, 5, 1025, PSRAM_VENDOR_NONE }, //QFN48 {0, 6, 1026, PSRAM_VENDOR_NONE }, //QFN68 {0, 7, 1027, PSRAM_VENDOR_NONE }, //QFN68 {0xFF, 0xFF, 0xFFFF, PSRAM_DEVICE_CLK_NotClear | PSRAM_VENDOR_NotClear }, //debug package };
Check the value of Boot_SocClk_Info_Idx and the clock info in
ameba_bootcfg.c
.// for kr4/km4, max 400MHz under 1.0v, max 200MHz under 0.9v // for dsp, max 500MHz under 1.0v, max 400MHz under 0.9v // CPUPLL(PLLM)/DSPPLL(PLLD) can be 330MHz~660MHz // All CLKDIV range is [1, 16] SocClk_Info_TypeDef SocClk_Info[] = { /* PLLM_CLK, PLLD_CLK, Vol_Type, CPU_CKD, PSRAMC_CKD*/ {PLL_600M, PLL_500M, CORE_VOL_0P9, CLKDIV(3) | ISPLLM, CLKDIV(2) | ISPLLM}, /*0.9V, PSRAM-166M 8720E QFN48*/ {PLL_600M, PLL_500M, CORE_VOL_1P0, CLKDIV(3) | ISPLLM, CLKDIV(2) | ISPLLM}, /*1.0V, PSRAM-166M 8720E QFN48*/ {PLL_400M, PLL_500M, CORE_VOL_1P0, CLKDIV(2) | ISPLLM, CLKDIV(1) | ISPLLM}, /*1.0V, PSRAM-200M*/ {PLL_480M, PLL_500M, CORE_VOL_1P0, CLKDIV(2) | ISPLLM, CLKDIV(1) | ISPLLD}, /*1.0V, PSRAM-250M 8726E QFN68*/ }; /** * @brief SocClk_Info select * Boot_SocClk_Info_Idx valid value is [0, 3] and 0xFF * when Boot_SocClk_Info_Idx is 0xFF, set socclk by chipinfo Automatically * when Boot_SocClk_Info_Idx is [0, 3], set socclk by SocClk_Info[Boot_SocClk_Info_Idx] */ u8 Boot_SocClk_Info_Idx = 0xFF;
If Boot_SocClk_Info_Idx is not 0xFF, the bootloader will set the SoC clock defined by
SocClk_Info[Boot_SocClk_Info_Idx]
.If Boot_SocClk_Info_Idx is 0xFF (default), the bootloader will set the SoC clock automatically according to the embedded PSRAM type.
For example, if bdnumer is 0x1010, the PSRAM can run under 166MHz, and the bootloader will use
SocClk_Info[1]. CLKDIV(3) | ISPLLM
, means the clocks KM4/KR4 equal to PLLM/3.PSRAM type
PSRAM speed
SocClk_Info[x]
Clock Info
No PSRAM
SocClk_Info[0]
PLLM: 600MHz
PLLD: 500MHz
KM4/KR4: 200MHz
With PSRAM
≤166MHz
SocClk_Info[1]
PLLM: 600MHz
PLLD: 500MHz
KM4/KR4: 200MHz
With PSRAM
≤200MHz
SocClk_Info[2]
PLLM: 400MHz
PLLD: 500MHz
KM4/KR4: 200MHz
With PSRAM
≤250MHz
SocClk_Info[3]
PLLM: 480MHz
PLLD: 500MHz
KM4/KR4: 240MHz
Refer to one of the following methods to change the SoC clock if needed.
Keep the Boot_SocClk_Info_Idx 0xFF, and only change the clock info of
SocClk_Info[x]
to set the clocks of PLLM/PLLD and CPUs.Modify the Boot_SocClk_Info_Idx to [0, 3], and then define your own clock info in
SocClk_Info[Boot_SocClk_Info_Idx]
.
Note
Consider the limitations of the hardware and do not set the clock info illogically.
Example
Change CPU_CKD of
SocClk_Info[2]
to CLKDIV(1) if CPU is needed to run faster.SocClk_Info_TypeDef SocClk_Info[] = { /* PLLM_CLK, PLLD_CLK, Vol_Type, CPU_CKD, PSRAMC_CKD*/ {PLL_600M, PLL_500M, CORE_VOL_0P9, CLKDIV(3) | ISPLLM, CLKDIV(2) | ISPLLM}, /*0.9V, PSRAM-166M 8720E QFN48*/ {PLL_600M, PLL_500M, CORE_VOL_1P0, CLKDIV(3) | ISPLLM, CLKDIV(2) | ISPLLM}, /*1.0V, PSRAM-166M 8720E QFN48*/ {PLL_400M, PLL_500M, CORE_VOL_1P0, CLKDIV(2) | ISPLLM, CLKDIV(1) | ISPLLM}, /*1.0V, PSRAM-200M*/ {PLL_480M, PLL_500M, CORE_VOL_1P0, CLKDIV(2) | ISPLLM, CLKDIV(1) | ISPLLD}, /*1.0V, PSRAM-250M 8726E QFN68*/ }; /** * @brief SocClk_Info select * Boot_SocClk_Info_Idx valid value is [0, 3] and 0xFF * when Boot_SocClk_Info_Idx is 0xFF, set socclk by chipinfo Automatically * when Boot_SocClk_Info_Idx is [0, 3], set socclk by SocClk_Info[Boot_SocClk_Info_Idx] */ u8 Boot_SocClk_Info_Idx = 0xFF;
Based on the configuration, the clock of KM4/KR4 is 400MHz, PSRAM controller is 400MHz (twice the PSRAM), and core power is 1.0V. The clocks of left modules will be set to a reasonable value by software automatically based on their maximum speeds.
Note
The PLLD can be disabled if you do not need it work.
Re-build the project and download the new image again.
Boot_Log_En
The bootloader log is enabled by default and can be disabled through Boot_Log_En.
/**
* @brif boot log enable or disable.
* FALSE: disable
* TRUE: enable
*/
u8 Boot_Log_En = TRUE;
Boot_Agg_En
The Boot_Agg_En is used with Trace Tool to sort out boot logs from different cores. It can be enabled through Boot_Agg_En.
/**
* @brif Loguart AGG enable or disable
* FALSE: disable
* TRUE: enable
*/
u8 Boot_Agg_En = FALSE;
Note
Refer to Chapter Trace Tool for more information.
GitHub
The KM4 boots at 200MHz at the BootRom Stage, and switches to a higher frequency during the bootloader Stage.
There are some limitations when changing the SoC clock:
TBD
ameba_flashcfg
This section introduces the Flash-related configurations including speed, read mode, layout and protect mode.
GitHub
Flash_Speed
Flash runs half as fast as the SPI Flash controller.
By default, the speed of the SPI Flash controller is divided by the PLL, and the speed of the SPI Flash controller shall be less than SPIC_CLK_LIMIT
(208MHz).
If the Flash needs to run slower, change the value of Flash_Speed
(SPIC0) or Data_Flash_Speed
(SPIC1).
const u16 Flash_Speed = CLKDIV(2);
const u16 Data_Flash_Speed = CLKDIV(2);
Value of Flash_Speed |
Description |
Flash baudrate |
---|---|---|
CLKDIV(10) |
Flash baudrate will be 1/10 of PLL |
PLL/20 |
CLKDIV(9) |
Flash baudrate will be 1/9 of PLL |
PLL/18 |
CLKDIV(8) |
Flash baudrate will be 1/8 of PLL |
PLL/16 |
CLKDIV(7) |
Flash baudrate will be 1/7 of PLL |
PLL/14 |
CLKDIV(6) |
Flash baudrate will be 1/6 of PLL |
PLL/12 |
CLKDIV(5) |
Flash baudrate will be 1/5 of PLL |
PLL/10 |
CLKDIV(4) |
Flash baudrate will be 1/4 of PLL |
PLL/8 |
CLKDIV(3) |
Flash baudrate will be 1/3 of PLL |
PLL/6 |
CLKDIV(2) |
Flash baudrate will be 1/2 of PLL |
PLL/4 |
Flash_ReadMode
Value of Flash_ReadMode |
Description |
---|---|
0xFFFF |
Address & Data 4-bit mode |
0x7FFF |
Just data 4-bit mode |
0x3FFF |
Address & Data 2-bit mode |
0x1FFF |
Just data 2-bit mode |
0x0FFF |
1-bit mode |
Note
If the configured read mode is not supported, other modes would be searched until finding out the appropriate mode.
Flash_Layout
The default Flash layout in the SDK are illustrated in Chapter Flash Layout. If you want to modify the Flash layout, refer to Section Flash Layout Modification Guide.
Flash Protect Enable
For more information about this function, refer to Section Flash Protection Mechanism .
Flash Pinmap
For more information about pinmap configuration, refer to User Manual (Chapter I/O Control).
GitHub
Flash_Speed
Value of Flash_Speed |
Description |
Flash baudrate |
---|---|---|
0xFFFF |
Flash baudrate will be 1/20 of PLLM |
PLLM/20 |
0x7FFF |
Flash baudrate will be 1/18 of np core clock |
PLLM/18 |
0x3FFF |
Flash baudrate will be 1/16 of np core clock |
PLLM/16 |
0x1FFF |
Flash baudrate will be 1/14 of np core clock |
PLLM/14 |
0xFFF |
Flash baudrate will be 1/12 of np core clock |
PLLM/12 |
0x7FF |
Flash baudrate will be 1/10 of np core clock |
PLLM/10 |
0x3FF |
Flash baudrate will be 1/8 of np core clock |
PLLM/8 |
0x1FF |
Flash baudrate will be 1/6 of np core clock |
PLLM/6 |
0xFF |
Flash baudrate will be 1/4 of np core clock |
PLLM/4 |
Note
Refer to ameba_bootcfg for details about PLLM.
The maximum clock of Flash is 120MHz. The initial flow will check whether the configured speed is higher than the maximun one or not.
Other value is not supported.
Flash_ReadMode
Value of Flash_ReadMode |
Description |
---|---|
0xFFFF |
Address & Data 4-bit mode |
0x7FFF |
Just data 4-bit mode |
0x3FFF |
Address & Data 2-bit mode |
0x1FFF |
Just data 2-bit mode |
0x0FFF |
1-bit mode |
Note
If the configured read mode is not supported, other modes would be searched until finding out the appropriate mode.
Flash_Layout
The default Flash layout in the SDK are illustrated in Chapter Flash Layout. If you want to modify the Flash layout, refer to Section Flash Layout Modification Guide.
Flash Protect Enable
For more information about this function, refer to Section Flash Protection Mechanism .
Flash Pinmap
For more information about pinmap configuration, refer to User Manual (Chapter I/O Control).
GitHub
Flash_Speed
Value of Flash_Speed |
Description |
Flash baudrate |
---|---|---|
0xFFFF |
Flash baudrate will be 1/20 of PLLM |
PLLM/20 |
0x7FFF |
Flash baudrate will be 1/18 of np core clock |
PLLM/18 |
0x3FFF |
Flash baudrate will be 1/16 of np core clock |
PLLM/16 |
0x1FFF |
Flash baudrate will be 1/14 of np core clock |
PLLM/14 |
0xFFF |
Flash baudrate will be 1/12 of np core clock |
PLLM/12 |
0x7FF |
Flash baudrate will be 1/10 of np core clock |
PLLM/10 |
0x3FF |
Flash baudrate will be 1/8 of np core clock |
PLLM/8 |
0x1FF |
Flash baudrate will be 1/6 of np core clock |
PLLM/6 |
0xFF |
Flash baudrate will be 1/4 of np core clock |
PLLM/4 |
Note
Refer to ameba_bootcfg for details about PLLM.
The maximum clock of Flash is 120MHz. The initial flow will check whether the configured speed is higher than the maximun one or not.
Other value is not supported.
Flash_ReadMode
Value of Flash_ReadMode |
Description |
---|---|
0xFFFF |
Address & Data 4-bit mode |
0x7FFF |
Just data 4-bit mode |
0x3FFF |
Address & Data 2-bit mode |
0x1FFF |
Just data 2-bit mode |
0x0FFF |
1-bit mode |
Note
If the configured read mode is not supported, other modes would be searched until finding out the appropriate mode.
Flash_Layout
The default Flash layout in the SDK are illustrated in Chapter Flash Layout. If you want to modify the Flash layout, refer to Section Flash Layout Modification Guide.
Flash Protect Enable
For more information about this function, refer to Section Flash Protection Mechanism .
Flash Pinmap
For more information about pinmap configuration, refer to User Manual (Chapter I/O Control).
GitHub
Flash_Speed
Flash runs half as fast as the SPI Flash controller.
TBD
Flash_ReadMode
Value of Flash_ReadMode |
Description |
---|---|
0xFFFF |
Address & Data 4-bit mode |
0x7FFF |
Just data 4-bit mode |
0x3FFF |
Address & Data 2-bit mode |
0x1FFF |
Just data 2-bit mode |
0x0FFF |
1-bit mode |
Note
If the configured read mode is not supported, other modes would be searched until finding out the appropriate mode.
Flash_Layout
The default Flash layout in the SDK are illustrated in Chapter Flash Layout. If you want to modify the Flash layout, refer to Section Flash Layout Modification Guide.
Flash Protect Enable
For more information about this function, refer to Section Flash Protection Mechanism .
Flash Pinmap
For more information about pinmap configuration, refer to User Manual (Chapter I/O Control).
ameba_boot_trustzonecfg
TBD
ameba_pinmapcfg
TBD
ameba_sleepcfg
GitHub
Wakeup Mask Setup
For sleep mode, only one CPU is required to wake up to execute the program in some situations. The wakeup mask module is designed to implement this function. By setting a wakeup mask, you can choose to wake up only one CPU core. If KM4 is chosen, KM0 will be waked up first and then KM0 will resume KM4.
Users can set the wakeup attribute in sleep_wevent_config[]
in ameba_sleepcfg.c
to choose which CPU you want to wake up.
The wakeup attribute of each wakeup source can be set to WAKEUP_KM4 or WAKEUP_KM0 or WAKEUP_NULL,
respectively indicating that this wakeup source is only to wake up KM4, or wake up KM0, or not used as a wakeup source.
/* Wakeup entry can be set to WAKEUP_NULL/WAKEUP_KM4/WAKEUP_KM0 */
WakeEvent_TypeDef sleep_wevent_config[] = {
// Module Wakeup
{WAKE_SRC_SDIO, WAKEUP_NULL},
{WAKE_SRC_AON_WAKEPIN, WAKEUP_NULL},
{WAKE_SRC_AON_TIM, WAKEUP_NULL},
{WAKE_SRC_Keyscan, WAKEUP_NULL},
{WAKE_SRC_PWR_DOWN, WAKEUP_NULL},
{WAKE_SRC_BOR, WAKEUP_NULL},
{WAKE_SRC_ADC, WAKEUP_NULL},
{WAKE_SRC_RTC, WAKEUP_NULL},
{WAKE_SRC_CTOUCH, WAKEUP_NULL},
{WAKE_SRC_I2C1, WAKEUP_NULL},
{WAKE_SRC_I2C0, WAKEUP_NULL},
{WAKE_SRC_GPIOB, WAKEUP_NULL},
{WAKE_SRC_GPIOA, WAKEUP_NULL},
{WAKE_SRC_UART_LOG, WAKEUP_NULL},
{WAKE_SRC_UART2_BT, WAKEUP_NULL},
{WAKE_SRC_UART1, WAKEUP_NULL},
{WAKE_SRC_UART0, WAKEUP_NULL},
{WAKE_SRC_pmc_timer1, WAKEUP_KM0}, /* Internal use, do not change it*/
{WAKE_SRC_pmc_timer0, WAKEUP_KM4}, /* Internal use, do not change it*/
{WAKE_SRC_Timer7, WAKEUP_NULL},
{WAKE_SRC_Timer6, WAKEUP_NULL},
{WAKE_SRC_Timer5, WAKEUP_NULL},
{WAKE_SRC_Timer4, WAKEUP_NULL},
{WAKE_SRC_IPC_KM4, WAKEUP_KM4}, /* IPC can only wake up KM4, do not change it*/
{WAKE_SRC_BT_WAKE_HOST, WAKEUP_NULL},
{WAKE_SRC_KM4_WAKE_IRQ, WAKEUP_KM0}, /* Internal use, do not change it*/
{WAKE_SRC_WIFI_FTSR_MAILBOX, WAKEUP_KM0}, /* Wi-Fi wakeup, do not change it*/
{WAKE_SRC_WIFI_FISR_FESR_IRQ, WAKEUP_KM0}, /* Wi-Fi wakeup, do not change it*/
{0xFFFFFFFF, WAKEUP_NULL},
};
AON Wakepin Configuration
AON wakepin is one of the peripherals that can be set as a wakeup source.
SoC has two AON wakepins (PB30
and PB31
), which can be configured in sleep_wakepin_config[]
in ameba_sleepcfg.c
.
The config attribute can be set to DISABLE_WAKEPIN or HIGH_LEVEL_WAKEUP or LOW_LEVEL_WAKEUP, meaning not wake up, or GPIO level high will wake up, or GPIO level low will wake up respectively.
/* can be used by sleep mode & deep sleep mode */
/* config can be set to DISABLE_WAKEPIN/HIGH_LEVEL_WAKEUP/LOW_LEVEL_WAKEUP */
WAKEPIN_TypeDef sleep_wakepin_config[] = {
// wakepin config
{WAKEPIN_0, DISABLE_WAKEPIN}, /* WAKEPIN_0 corresponding to _PB_30 */
{WAKEPIN_1, DISABLE_WAKEPIN}, /* WAKEPIN_1 corresponding to _PB_31 */
{0xFFFFFFFF, DISABLE_WAKEPIN},
};
Note
By default, AON_WAKEPIN_IRQ will not be enabled in
sleep_wakepin_config[]
, and users need to enable it by themselves.The wakeup mask will not be set in
sleep_wakepin_config[]
. If wakepin is used for sleep mode, WAKE_SRC_AON_WAKEPIN entry needs to be set insleep_wevent_config[]
.
Clock and Voltage Configuration
The XTAL, OSC4M state, and sleep mode voltage are configurable in ps_config[]
in ameba_sleepcfg.c
.
Users can use this configuration for peripherals that need XTAL or OSC4M on in sleep mode.
PSCFG_TypeDef ps_config = {
.keep_OSC4M_on = FALSE, /* Keep OSC4M on or off for sleep */
.xtal_mode_in_sleep = XTAL_OFF, /* Set XTAL mode during sleep mode, see enum xtal_mode_sleep for details */
.sleep_to_08V = FALSE, /* Default sleep to 0.7V, setting this option to TRUE will sleep to 0.8V */
};
Sleep mode Configuration
Application software can set sleep mode to CG or PG by calling
pmu_set_sleep_type(uint32_t type)()
.Users can get CPU’s sleep mode by calling
pmu_get_sleep_type()
.
Note
KM0 and KM4 are in the same power domain, so they will have the same sleep type, thus
pmu_set_sleep_type()
should be set to KM4, and KM0 will follow KM4’s sleep mode type.Sleep mode is set to PG by default. If users want to change the sleep type,
pmu_set_sleep_type()
needs to be called before sleep.
GitHub
To enable a specific wakeup source, the corresponding status in array sleep_wevent_config[]
in ameba_sleepcfg.c
should be set. Each module can be set to WAKEUP_NULL/WAKEUP_NP/WAKEUP_AP/WAKEUP_DSP
. For example, if the WAKE_SRC_AON_WAKEPIN
module is set to WAKEUP_NP, it means that when the system is in sleep mode, KR4 will be woken up at the time that an aon_wakepin interrupt happens.
Wakeup Mask Setup
/*wakeup attribute can be set to WAKEUP_NULL/WAKEUP_NP/WAKEUP_AP/WAKEUP_DSP*/
WakeEvent_TypeDef sleep_wevent_config[] = {
// Module wakeup
{WAKE_SRC_VAD, WAKEUP_NULL},
{WAKE_SRC_AON_WAKEPIN, WAKEUP_NULL},
{WAKE_SRC_AON_TIM, WAKEUP_NULL},
{WAKE_SRC_PWR_DOWN, WAKEUP_NULL},
{WAKE_SRC_BOR, WAKEUP_NULL},
{WAKE_SRC_ADC, WAKEUP_NULL},
{WAKE_SRC_AON_RTC, WAKEUP_NULL},
{WAKE_SRC_SPI1, WAKEUP_NULL},
{WAKE_SRC_SPI0, WAKEUP_NULL},
{WAKE_SRC_CTOUCH, WAKEUP_NULL},
{WAKE_SRC_GPIOB, WAKEUP_NULL},
{WAKE_SRC_GPIOA, WAKEUP_NULL},
{WAKE_SRC_UART_LOG, WAKEUP_AP},
{WAKE_SRC_UART3, WAKEUP_NULL},
{WAKE_SRC_UART2, WAKEUP_NULL},
{WAKE_SRC_UART1, WAKEUP_NULL},
{WAKE_SRC_UART0, WAKEUP_NULL},
{WAKE_SRC_Timer7, WAKEUP_NULL},
{WAKE_SRC_Timer6, WAKEUP_NULL},
{WAKE_SRC_Timer5, WAKEUP_NULL},
{WAKE_SRC_Timer4, WAKEUP_NULL},
{WAKE_SRC_Timer3, WAKEUP_NULL},
{WAKE_SRC_Timer2, WAKEUP_NULL},
{WAKE_SRC_Timer1, WAKEUP_NULL},
{WAKE_SRC_Timer0, WAKEUP_NULL},
{WAKE_SRC_WDG0, WAKEUP_NULL},
{WAKE_SRC_BT_WAKE_HOST, WAKEUP_NULL},
{WAKE_SRC_AP_WAKE, WAKEUP_NULL},
{WAKE_SRC_WIFI_FTSR_MAILBOX, WAKEUP_NP},
{WAKE_SRC_WIFI_FISR_FESR, WAKEUP_NP},
{0xFFFFFFFF, WAKEUP_NULL},
};
AON Wakepin Configuration
AON wakepin is one of the peripherals that can be set as a wakeup source. SoC has two AON wakepins (PA0 and PA1), which can be configured in sleep_wakepin_config[]
in ameba_sleepcfg.c
.
The config attribute can be set to DISABLE_WAKEPIN or HIGH_LEVEL_WAKEUP or LOW_LEVEL_WAKEUP, meaning not wake up, or GPIO level high will wake up, or GPIO level low will wake up respectively.
/* can be used by sleep mode & deep sleep mode */
/* config can be set to DISABLE_WAKEPIN/HIGH_LEVEL_WAKEUP/LOW_LEVEL_WAKEUP */
WAKEPIN_TypeDef sleep_wakepin_config[] = {
// wakepin config
{WAKEPIN_0, DISABLE_WAKEPIN}, /* WAKEPIN_0 corresponding to _PA_0 */
{WAKEPIN_1, DISABLE_WAKEPIN}, /* WAKEPIN_1 corresponding to _PA_1 */
{0xFFFFFFFF, DISABLE_WAKEPIN},
};
Note
By default, AON_WAKEPIN_IRQ will not be enabled in
sleep_wakepin_config[]
, and users need to enable it by themselves.The wakeup mask will not be set in
sleep_wakepin_config[]
. If wakepin is used for sleep mode, WAKE_SRC_AON_WAKEPIN entry needs to be set insleep_wevent_config[]
.
Clock and Voltage Configuration
The XTAL, OSC4M state, and sleep mode voltage are configurable in ps_config[]
in ameba_sleepcfg.c
.
Users can use this configuration for peripherals that need XTAL or OSC4M on in sleep mode.
PSCFG_TypeDef ps_config = {
.keep_OSC4M_on = FALSE, /* keep OSC4M on or off for sleep */
.xtal_mode_in_sleep = XTAL_OFF, /* set xtal mode during sleep mode, see enum xtal_mode_sleep for detail */
};
Sleep Type Configuration
Application software can set sleep mode to CG or PG by calling pmu_set_sleep_type(uint32_t type)()
, and users can get CPU’s sleep mode by calling pmu_get_sleep_type()
.
Note
KR4 and KM4 are in the same power domain, so they will have the same sleep type, thus
pmu_set_sleep_type()
should be set to AP, and NP will follow AP’s sleep mode type.Sleep mode is set to PG by default. If users want to change the sleep type,
pmu_set_sleep_type()
needs to be called before sleep.
GitHub
To enable a specific wakeup source, the corresponding status in array sleep_wevent_config[]
in ameba_sleepcfg.c
should be set. Each module can be set to WAKEUP_NULL/WAKEUP_NP/WAKEUP_AP
. For example, if the WAKE_SRC_AON_WAKEPIN
module is set to WAKEUP_NP, it means that when the system is in sleep mode, KR4 will be woken up at the time that an aon_wakepin interrupt happens.
Wakeup Mask Setup
/*wakeup attribute can be set to WAKEUP_NULL/WAKEUP_NP/WAKEUP_AP/WAKEUP_DSP*/
WakeEvent_TypeDef sleep_wevent_config[] = {
// Module wakeup
{WAKE_SRC_VAD, WAKEUP_NULL},
{WAKE_SRC_AON_WAKEPIN, WAKEUP_NULL},
{WAKE_SRC_AON_TIM, WAKEUP_NULL},
{WAKE_SRC_PWR_DOWN, WAKEUP_NULL},
{WAKE_SRC_BOR, WAKEUP_NULL},
{WAKE_SRC_ADC, WAKEUP_NULL},
{WAKE_SRC_AON_RTC, WAKEUP_NULL},
{WAKE_SRC_SPI1, WAKEUP_NULL},
{WAKE_SRC_SPI0, WAKEUP_NULL},
{WAKE_SRC_CTOUCH, WAKEUP_NULL},
{WAKE_SRC_GPIOB, WAKEUP_NULL},
{WAKE_SRC_GPIOA, WAKEUP_NULL},
{WAKE_SRC_UART_LOG, WAKEUP_AP},
{WAKE_SRC_UART3, WAKEUP_NULL},
{WAKE_SRC_UART2, WAKEUP_NULL},
{WAKE_SRC_UART1, WAKEUP_NULL},
{WAKE_SRC_UART0, WAKEUP_NULL},
{WAKE_SRC_Timer7, WAKEUP_NULL},
{WAKE_SRC_Timer6, WAKEUP_NULL},
{WAKE_SRC_Timer5, WAKEUP_NULL},
{WAKE_SRC_Timer4, WAKEUP_NULL},
{WAKE_SRC_Timer3, WAKEUP_NULL},
{WAKE_SRC_Timer2, WAKEUP_NULL},
{WAKE_SRC_Timer1, WAKEUP_NULL},
{WAKE_SRC_Timer0, WAKEUP_NULL},
{WAKE_SRC_WDG0, WAKEUP_NULL},
{WAKE_SRC_BT_WAKE_HOST, WAKEUP_NULL},
{WAKE_SRC_AP_WAKE, WAKEUP_NULL},
{WAKE_SRC_WIFI_FTSR_MAILBOX, WAKEUP_NP},
{WAKE_SRC_WIFI_FISR_FESR, WAKEUP_NP},
{0xFFFFFFFF, WAKEUP_NULL},
};
AON Wakepin Configuration
AON wakepin is one of the peripherals that can be set as a wakeup source. SoC has two AON wakepins (PA0 and PA1), which can be configured in sleep_wakepin_config[]
in ameba_sleepcfg.c
.
The config attribute can be set to DISABLE_WAKEPIN or HIGH_LEVEL_WAKEUP or LOW_LEVEL_WAKEUP, meaning not wake up, or GPIO level high will wake up, or GPIO level low will wake up respectively.
/* can be used by sleep mode & deep sleep mode */
/* config can be set to DISABLE_WAKEPIN/HIGH_LEVEL_WAKEUP/LOW_LEVEL_WAKEUP */
WAKEPIN_TypeDef sleep_wakepin_config[] = {
// wakepin config
{WAKEPIN_0, DISABLE_WAKEPIN}, /* WAKEPIN_0 corresponding to _PA_0 */
{WAKEPIN_1, DISABLE_WAKEPIN}, /* WAKEPIN_1 corresponding to _PA_1 */
{0xFFFFFFFF, DISABLE_WAKEPIN},
};
Note
By default, AON_WAKEPIN_IRQ will not be enabled in
sleep_wakepin_config[]
, and users need to enable it by themselves.The wakeup mask will not be set in
sleep_wakepin_config[]
. If wakepin is used for sleep mode, WAKE_SRC_AON_WAKEPIN entry needs to be set insleep_wevent_config[]
.
Clock and Voltage Configuration
The XTAL, OSC4M state, and sleep mode voltage are configurable in ps_config[]
in ameba_sleepcfg.c
.
Users can use this configuration for peripherals that need XTAL or OSC4M on in sleep mode.
PSCFG_TypeDef ps_config = {
.keep_OSC4M_on = FALSE, /* keep OSC4M on or off for sleep */
.xtal_mode_in_sleep = XTAL_OFF, /* set xtal mode during sleep mode, see enum xtal_mode_sleep for detail */
};
Sleep Type Configuration
Application software can set sleep mode to CG or PG by calling pmu_set_sleep_type(uint32_t type)()
, and users can get CPU’s sleep mode by calling pmu_get_sleep_type()
.
Note
KR4 and KM4 are in the same power domain, so they will have the same sleep type, thus
pmu_set_sleep_type()
should be set to AP, and NP will follow AP’s sleep mode type.Sleep mode is set to PG by default. If users want to change the sleep type,
pmu_set_sleep_type()
needs to be called before sleep.
GitHub
Wakeup Mask Setup
For sleep mode, only one CPU is required to wake up to execute the program in some situations. The wakeup mask module is designed to implement this function. By setting a wakeup mask, you can choose to wake up only one CPU core. If KM4 is chosen, KM0 will be waked up first and then KM0 will resume KM4. And if CA32 is chosen, KM0 will be waked up first and then KM0 will resume KM4, and CA32 will be resumed at last.
Users can set the wakeup attribute in sleep_wevent_config[]
in ameba_sleepcfg.c
to choose which CPU you want to wake up.
The wakeup attribute of each wakeup source can be set to WAKEUP_KM4 or WAKEUP_KM0 or WAKEUP_NULL,
respectively indicating that this wakeup source is only to wake up KM4, or wake up KM0, or not used as a wakeup source.
/*wakeup attribute can be set to WAKEUP_NULL/WAKEUP_LP/WAKEUP_NP/WAKEUP_AP*/
WakeEvent_TypeDef sleep_wevent_config[] = {
// Module wakeup
{WAKE_SRC_nFIQOUT1_OR_nIRQOUT1, WAKEUP_NULL},
{WAKE_SRC_nFIQOUT0_OR_nIRQOUT0, WAKEUP_NULL},
{WAKE_SRC_BT_WAKE_HOST, WAKEUP_NULL},
{WAKE_SRC_AON_WAKEPIN, WAKEUP_NULL},
{WAKE_SRC_UART2, WAKEUP_NULL},
{WAKE_SRC_UART1, WAKEUP_NULL},
{WAKE_SRC_UART0, WAKEUP_NULL},
{WAKE_SRC_SPI1, WAKEUP_NULL},
{WAKE_SRC_SPI0, WAKEUP_NULL},
{WAKE_SRC_IPC_AP, WAKEUP_AP}, /* do not change it */
{WAKE_SRC_IPC_NP, WAKEUP_NP}, /* do not change it*/
{WAKE_SRC_VADBT_OR_VADPC, WAKEUP_NULL},
{WAKE_SRC_PWR_DOWN, WAKEUP_LP},
{WAKE_SRC_BOR, WAKEUP_NULL},
{WAKE_SRC_ADC, WAKEUP_NULL},
{WAKE_SRC_CTOUCH, WAKEUP_NULL},
{WAKE_SRC_RTC, WAKEUP_NULL},
{WAKE_SRC_GPIOC, WAKEUP_NULL},
{WAKE_SRC_GPIOB, WAKEUP_NULL},
{WAKE_SRC_GPIOA, WAKEUP_NULL},
{WAKE_SRC_UART_LOG, WAKEUP_NULL},
{WAKE_SRC_Timer7, WAKEUP_NULL},
{WAKE_SRC_Timer6, WAKEUP_NP},
{WAKE_SRC_Timer5, WAKEUP_NULL},
{WAKE_SRC_Timer4, WAKEUP_NULL},
{WAKE_SRC_Timer3, WAKEUP_NULL},
{WAKE_SRC_Timer2, WAKEUP_NULL},
{WAKE_SRC_Timer1, WAKEUP_NULL},
{WAKE_SRC_Timer0, WAKEUP_NULL},
{WAKE_SRC_WDG0, WAKEUP_NULL},
{WAKE_SRC_AP_WAKE, WAKEUP_NULL},
{WAKE_SRC_NP_WAKE, WAKEUP_NULL},
{WAKE_SRC_AON_TIM, WAKEUP_NULL},
{WAKE_SRC_WIFI_FTSR_MAILBOX, WAKEUP_LP}, /* Wi-Fi wakeup, do not change it*/
{WAKE_SRC_WIFI_FISR_FESR, WAKEUP_LP}, /* Wi-Fi wakeup, do not change it*/
{0xFFFFFFFF, WAKEUP_NULL}, /* Table end */
};
AON Wakepin Configuration
AON wakepin is one of the peripherals that can be set as a wakeup source.
SoC has four AON wakepins (PB21
, PB22
, PB23
and PB24
), which can be configured in sleep_wakepin_config[]
in ameba_sleepcfg.c
.
The config attribute can be set to DISABLE_WAKEPIN or HIGH_LEVEL_WAKEUP or LOW_LEVEL_WAKEUP, meaning not wake up, or GPIO positive pulse will wake up, or GPIO negative pulse will wake up respectively.
/* can be used by sleep mode & deep sleep mode */
/* config can be set to DISABLE_WAKEPIN/HIGH_LEVEL_WAKEUP/LOW_LEVEL_WAKEUP */
WAKEPIN_TypeDef sleep_wakepin_config[] = {
// wakepin config
{WAKEPIN_0, DISABLE_WAKEPIN}, /* WAKEPIN_0 corresponding to _PB_21 */
{WAKEPIN_1, DISABLE_WAKEPIN}, /* WAKEPIN_1 corresponding to _PB_22 */
{WAKEPIN_2, DISABLE_WAKEPIN}, /* WAKEPIN_2 corresponding to _PB_23 */
{WAKEPIN_3, DISABLE_WAKEPIN}, /* WAKEPIN_3 corresponding to _PB_24 */
{0xFFFFFFFF, DISABLE_WAKEPIN}, /* Table end */
}
Note
PB23
andPB24
is for loguart trx by default, ifPB23
andPB24
is needed to wake up system from dslp, contact realtek for help. Active and sleep mode of pin is controlled by pinmap config, changepmap_func[]
inameba_pinmapcfg.c
if needed.By default, AON_WAKEPIN_IRQ will not be enabled in
sleep_wakepin_config[]
, and users need to enable it by themselves.The wakeup mask will not be set in
sleep_wakepin_config[]
. If wakepin is used for sleep mode, WAKE_SRC_AON_WAKEPIN entry needs to be set insleep_wevent_config[]
.
Clock and Voltage Configuration
The XTAL, OSC4M state are configurable in ps_config[]
in ameba_sleepcfg.c
. Users can use this configuration for peripherals that need XTAL or OSC4M on in sleep mode.
PSCFG_TypeDef ps_config = {
.km0_tickles_debug = TRUE,/* if open WIFI FW, should close it, or beacon will lost in WOWLAN */
.km0_pll_off = TRUE,
.km0_audio_vad_on = FALSE,
#if defined(CONFIG_CLINTWOOD ) && CONFIG_CLINTWOOD
.km0_config_psram = FALSE, /* if device enter sleep mode or not, false for keep active */
.km0_sleep_withM4 = FALSE,
#else
.km0_config_psram = TRUE, /* if device enter sleep mode or not, false for keep active */
.km0_sleep_withM4 = TRUE,
#endif
.keep_OSC4M_on = FALSE,
.xtal_mode_in_sleep = XTAL_OFF,
.swr_mode_in_sleep = SWR_PFM,
};
ameba_wifi_country_code_table_usrcfg
TBD
ameba_wifi_power_table_usrcfg
TBD
ameba_wificfg
TBD