|
SDK工程下simple Server工程,程序修改如下: \examples\ble_app_simple_server\keil_hs6621x_flash_xip_armclang 1)使能DCDC/Deep Sleep(main.c) static void ble_stack_config(void)
{
// Disable WDT
wdt_enable(0);
// Enable DCDC
pmu_dcdc_enable(true);
// Power down xtal32k in deep sleep mode
pmu_32k_enable_in_deep_sleep(true);//使能deep sleep
// Select 32k clock for stack
//pmu_xtal32k_change_param(15, 1);
pmu_select_32k(PMU_32K_SEL_RC);
// xtal32m param
pmu_xtal32m_change_param(15);
// ultra sleep mode enable
co_power_ultra_sleep_mode_enable(false);//关闭ultra sleep
// Enable sleep, SWD will be closed.
co_power_sleep_enable(true);
}2)广播间隔修改 (app.c) 快速广播间隔 0x0028*0.625=25ms 慢速广播间隔 0x0c80*0.625 =2000ms #define APP_ADV_FAST_INTERVAL 0x0028 /**< Fast advertising interval (in units of 0.625 ms. This value corresponds to 25 ms.). */ #define APP_ADV_SLOW_INTERVAL 0x0C80 /**< Slow advertising interval (in units of 0.625 ms. This value corrsponds to 2 seconds). */ #define APP_ADV_FAST_TIMEOUT 1 /**< The duration of the fast advertising period (in seconds). max 655, or 0 is no timeout*/ #define APP_ADV_SLOW_TIMEOUT 0 /**< The duration of the slow advertising period (in seconds). max 655. or 0 is no timeout*/ 3)使能慢广播 static void appm_advertising_init(void)
{
struct app_adv_modes_config_tag adv_config;
adv_config.whitelist_enabled = false;
adv_config.directed_enabled = false;
adv_config.directed_timeout = APP_ADV_DIRECTED_TIMEOUT;
adv_config.fast_enabled = true;
adv_config.fast_interval = APP_ADV_FAST_INTERVAL;
adv_config.fast_timeout = APP_ADV_FAST_TIMEOUT;
adv_config.slow_enabled = true;//false;
adv_config.slow_interval = APP_ADV_SLOW_INTERVAL;
adv_config.slow_timeout = APP_ADV_SLOW_TIMEOUT;
appm_adv_init(NULL, &adv_config);
uint8_t default_adv_data[ADV_DATA_LEN - 3];
uint16_t adv_len = 0;
appm_build_adv_data(ADV_DATA_LEN - 3, &adv_len, (uint8_t*)default_adv_data);
appm_adv_set_adv_data((uint8_t*)default_adv_data, adv_len);
//uint8_t res_data[APP_ADV_MAX_LEN];
//uint8_t res_data_len = APP_SCNRSP_DATA_LEN;
//memcpy(res_data, APP_SCNRSP_DATA, sizeof(APP_SCNRSP_DATA));
//appm_adv_set_res_data(res_data, res_data_len);
}4)关闭其它软件定时器 (main.c) int main(void)
{
ble_stack_config();
hardware_init();
rwip_init(RESET_NO_ERROR);
co_power_register_sleep_event(power_sleep_event_handler);
log_debug("running %d\n", pmu_reboot_reason());
dbg_mmi_enable();
appm_init();
//co_timer_set(&simple_timer, 100, TIMER_REPEAT, simple_timer_handler, NULL);
while(1)
{
rwip_schedule();
}
}EVB板图片如下: 6621CGB
6621CMB
固件烧录后,电流如下: 1)6621CGB 底电流
2)6621CGB 平均电流
3)6621CMB 底电流
4)6621CMB 平均电流
|







