SLEEP system ON mode and Advertising problem in BLE_app_uart

case BLE_ADV_EVT_IDLE:
init.advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
for (;;)
{
idle_state_handle();
NRF_LOG_INFO("%d", NRF_LOG_PROCESS());
nrf_delay_ms(200);
}

Hi, I'm using softdevice s140, sdk16, example : ble_app_uart
I want to build an application that is the device almost asleep and it will be wakeup when my mobile phone connect or send  data to nRF via BLE
1. I used init.advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE; to advertising continuously instead of  init.advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE; turn off advertising after APP_ADV_DURATION time.
Problem : nRF advertised continously when there are device(mobile phone) connect to nRF, but it will call an event BLE_ADV_EVT_IDLE and can not scan after that.
In my application I commented sleep_mode_enter() function to avoid nRF in deep sleep mode (system OFF mode). But I can not scan nRF after that.
=> I want to connect to nRF again when I disconnect many time to wake nRF up at any time.

2. I think in for(;;) loop I call  idle_state_handle(); so when any event was called (Ex: mobile phone connect to nRF, or an interrupt of any peripheral (Ex :MPU6050)) ) nRF  will be wake up.
And so on ? in my application, following idle_state_handle(); I call NRF_LOG_INFO("%d", NRF_LOG_PROCESS()); and nrf_delay_ms(200);. And in my debug terminal <info> log was showed after 200ms like nRF not in sleep mode.
=> Can you confirm it's right ?



Related