Ok, now do the same for all steps of the sending process and see what takes all this time. I don't know what could be taking that long.
Sir, i done the same step for all the process and the results are:
- appSendData() takes 200microseconds
- appInit() takes small amount
But in my sleep condition,
case APP_STATE_PREPARE_TO_SLEEP:
{
PORTD&=~(1<<PD6);
if(!NWK_Busy()){
NWK_SleepReq();
appState = APP_STATE_SLEEP;
}
} break;
case APP_STATE_SLEEP:
{
PORTD|=(1<<PD6);
HAL_Sleep(APP_SENDING_INTERVAL);
appState = APP_STATE_WAKEUP;
} break;
takes 4 milliseconds..
The condition if(!NWK_Busy()) function is taking that much power consumption.. So the ON time of the device is about 4 milliseconds..
I checked the code and realize that a lock bit(nwkIb.lock) is checked during the condition and find that the lock bit is decrement when nwkDataReqConfirm() is called..
Is ma thoughts are correct? And how can i reduce that time?