參與:1

RTL8762A DataTransWithoutDirectio運用省電問題

針對方案:基於Realtek RTL8762AG的BLE智能風衣方案

分享評論舉報
巧虎

巧虎

1 則回答

7得分


最佳解


以下設置DLPS皆以sample project DataTransWithoutDirectio 為範例

 

1.請打開與DLPS相關的Macroboard.h裡頭,如下:

#define CONFIG_DLPS_EN 1

 

請打開關周邊模組的Macro,如下範例

#define USE_UART_DLPS 1

#define USE_ADC_DLPS 1

#define USE_PWM0_DLPS 1

#define USE_I2C0_DLPS 1

 

2.設置wakeup pin

您可以參考範例,在此為UART RX pinDLPS.

UARTInit()

{

system_WakeUp_Pin_Enable(DATA_RX_IN, 0);

}

其他中斷欲出DLPS,請如上設置.

 

3.請在PwrMgr_Init()設置DLPS相關call back範例如下,此在main.c

void PwrMgr_Init()

{

DLPS_IO_Register();

 

if (FALSE == DLPS_ENTER_CHECK_CB_REG(DLPS_DataTransCheck))

{

DBG_BUFFER(MODULE_APP, LEVEL_ERROR, "Error: DLPS_ENTER_CHECK_CB_REG(DLPS_DataTransCheck) failed!\n", 0);

}

 

DLPS_IO_RegUserDlpsEnterCb(DataTrans_DLPS_Enter);

DLPS_IO_RegUserDlpsExitCb(DataTransExitDlpsInit);

LPS_MODE_Set(LPM_DLPS_MODE);

 

/* whether enter DLPS or not when power on */

if (gConfigParam->is_enter_sleep.is_enter_sleep)

{

allowedDataTransEnterDlps = FALSE; /* not enter DLPS when power on */

}

else

{

allowedDataTransEnterDlps = TRUE; /* enter DLPS when power on */

gConfigParam->isSleeping = TRUE;

}

}

 

BOOL DLPS_DataTransCheck():此為每次要進入DLPS前會調用該函數,決定可否進入DLPS.若為false則無法進DLPS

如下範例:

BOOL DLPS_DataTransCheck()

{

return allowedDataTransEnterDlps;

}

void DataTrans_DLPS_Enter():為進入DLPS時保存APPIO Register.

如下範例:

void DataTrans_DLPS_Enter(void)

{

Pad_Config(P3_0, PAD_SW_MODE, PAD_IS_PWRON, PAD_PULL_UP, PAD_OUT_DISABLE, PAD_OUT_LOW);

Pad_Config(P3_1, PAD_SW_MODE, PAD_IS_PWRON, PAD_PULL_UP, PAD_OUT_DISABLE, PAD_OUT_LOW);

}

void DataTransExitDlpsInit():系統跳出DLPS時恢復特定APPIO Register.

如下範例:

void DataTransExitDlpsInit(void)

{

DBG_BUFFER(MODULE_APP, LEVEL_INFO, "DataTransExitDlpsInit", 0);

 

/* reconfig UART register */

Pad_Config(P3_0, PAD_PINMUX_MODE, PAD_IS_PWRON, PAD_PULL_UP, PAD_OUT_DISABLE, PAD_OUT_LOW);

Pad_Config(P3_1, PAD_PINMUX_MODE, PAD_IS_PWRON, PAD_PULL_UP, PAD_OUT_DISABLE, PAD_OUT_LOW);

}

 

4.附件有相關範例UART log App.trace, bin

Key word: BT_MSG_TYPE_CONN_STATE_CHANGE:(2->3) 為建立BLE連線,範例為30秒內無BLE傳輸就會進DLPS

[MODULE_APP] SysOnIntr 為進DLPS

[MODULE_APP] DataTransExitDlpsInit 為出DLPS

[MODULE_APP] ENTER RX TOUT ISR UART RX喚醒, 30秒內無BLE傳輸就會進DLPS

1F
巧虎

巧虎

我要回答