- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I add sleep_configuration in sample mesh_battery_server. I modified these codes:
1. pin config:
wiced_platform_gpio_t platform_gpio_pins[]=
{
[PLATFORM_GPIO_0] = {WICED_P00, WICED_GPIO},
[PLATFORM_GPIO_1] = {WICED_P01, WICED_SPI_1_MISO},
[PLATFORM_GPIO_2] = {WICED_P07, WICED_SPI_1_CS},
[PLATFORM_GPIO_3] = {WICED_P17, WICED_GPIO},
[PLATFORM_GPIO_4] = {WICED_P25, WICED_I2C_1_SCL},
[PLATFORM_GPIO_5] = {WICED_P28, WICED_SPI_1_MOSI},
[PLATFORM_GPIO_6] = {WICED_P29, WICED_I2C_1_SDA},
[PLATFORM_GPIO_7] = {WICED_P33, WICED_UART_2_TXD},
[PLATFORM_GPIO_8] = {WICED_P34, WICED_UART_2_RXD},
[PLATFORM_GPIO_9] = {WICED_P38, WICED_SPI_1_CLK},
};
2. init flow
g_sleepNow = WICED_FALSE;
wiced_hal_i2c_init();
wiced_hal_pspi_init(SPI1, SPI_MASTER, INPUT_PIN_PULL_UP, 0x00261C01, 1000000, SPI_MSB_FIRST, SPI_SS_ACTIVE_LOW, SPI_MODE_3, WICED_P07);
wiced_result_t result;
wiced_sleep_config_t sleep_config = { 0 };
sleep_config.sleep_mode = WICED_SLEEP_MODE_NO_TRANSPORT;
sleep_config.device_wake_mode = WICED_SLEEP_WAKE_ACTIVE_HIGH;
sleep_config.device_wake_source = WICED_SLEEP_WAKE_SOURCE_GPIO;
sleep_config.device_wake_gpio_num = WICED_P17;
sleep_config.host_wake_mode = WICED_SLEEP_WAKE_ACTIVE_HIGH;
sleep_config.sleep_permit_handler = battery_server_sleep_hanlder;
result = wiced_sleep_configure(&sleep_config);
3. sleep handler
static uint32_t battery_server_sleep_hanlder(wiced_sleep_poll_type_t type)
{
uint32_t ret = WICED_SLEEP_NOT_ALLOWED;
WICED_BT_TRACE(".");
switch(type)
{
case WICED_SLEEP_POLL_SLEEP_PERMISSION:
if( g_sleepNow == WICED_TRUE )
{
ret = WICED_SLEEP_ALLOWED_WITH_SHUTDOWN;
WICED_BT_TRACE("$");
//ret = WICED_SLEEP_ALLOWED_WITHOUT_SHUTDOWN;
}
break;
case WICED_SLEEP_POLL_TIME_TO_SLEEP:
if( g_sleepNow != WICED_TRUE )
{
ret = 0;
}
else
{
WICED_BT_TRACE("@");
ret = WICED_SLEEP_MAX_TIME_TO_SLEEP;
}
break;
}
return ret;
}
4. button INT handler:
wiced_bool_t mesh_app_interrupt_handler(void* user_data, uint8_t pin)
{
WICED_BT_TRACE("mesh_app_interrupt_handler\r\n");
g_sleepNow = WICED_TRUE;
wiced_bt_start_advertisements(BTM_BLE_ADVERT_OFF, 0, NULL);
wiced_bt_ble_observe(WICED_FALSE, 0,NULL);
wiced_bt_ble_scan(BTM_BLE_SCAN_TYPE_NONE, 0, NULL);
return WICED_TRUE;
}
5. comments out the PERIODIC timer in mesh_application.c
When I push the USR BTN (P00), I saw the current lower down to nearly 400uA, the terminal ouputs the string which are in the function -> battery_server_sleep_hanlder.
I attach a video named 1-activemode_to_sleep,mp4 ,
But , after a few minutes( 3 minutes or 7 minutes, 11 minutes, 20 minutes, I tried serveral times), The VBAT current will increase to 1.94mA, and the terminal will output nothing. Then I push the USR BTN again, The board will reboot......
I also record a video named 2-dead_to_reboot,mp4.
Another attacment file named QCOM_LOG.txt record the ouput strings.
what I described above will occur in other mesh samples.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Nick,
Not sure you are working on this now.
1. a PERIODIC timer will prevent chip into SDS mode but only PDS mode, right?
A) Yes
2. It seems the mesh_samples will not enter SDS mode? (because I can see VBAT=0mA in other samples, but never saw 0mA in mesh samples. )
A) It should work. Have you tried it on latest WICED studio 6.2?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
1. a PERIODIC timer will prevent chip into SDS mode but only PDS mode, right?
2. It seems the mesh_samples will not enter SDS mode? (because I can see VBAT=0mA in other samples, but never saw 0mA in mesh samples. )
3.
static uint32_t battery_server_sleep_hanlder(wiced_sleep_poll_type_t type)
{
uint32_t ret = WICED_SLEEP_NOT_ALLOWED;
WICED_BT_TRACE(".")
Why the red line will always output in the other samples , such asMotion Sensor Project with CYW20719/CYW20735, but not ouput in the mesh samples?
And, after stopping scan&adv, it will be called!... ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello, any expert here can help me to resolve this problem?
Thanks very much!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thank you mifo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Nick,
Not sure you are working on this now.
1. a PERIODIC timer will prevent chip into SDS mode but only PDS mode, right?
A) Yes
2. It seems the mesh_samples will not enter SDS mode? (because I can see VBAT=0mA in other samples, but never saw 0mA in mesh samples. )
A) It should work. Have you tried it on latest WICED studio 6.2?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi anpm,
Thanks for your reply. These problems have been replied in Mycases. This thread can be closed, Thanks again.