Electronics > Beginners

LWMesh -physical sleep

(1/2) > >>

Peili:
Hi,
we are  using  Lwmesh 1_2_1  version. We need to put the device in a sleep for 2 sec.My function called  HAL_Sleep(APP_SENDING_INTERVAL); with APP_SENDING_INTERVAL =2000.
 It will not go for physical  sleep of 2sec. How can i put my device into physical sleep?

ataradov:
You need to go through the whole sequence NWK_Busy() - NWK_SleepReq() - HAL_Sleep(APP_SENDING_INTERVAL) - NWK_WakeupReq(), just like the sample application does.

NWK_SleepReq() prepared the stack to sleep and puts the radio to sleep HAL_Sleep() only puts the MCU to sleep.

Peili:

--- Quote from: ataradov on March 30, 2019, 05:08:16 pm ---You need to go through the whole sequence NWK_Busy() - NWK_SleepReq() - HAL_Sleep(APP_SENDING_INTERVAL) - NWK_WakeupReq(), just like the sample application does.

NWK_SleepReq() prepared the stack to sleep and puts the radio to sleep HAL_Sleep() only puts the MCU to sleep.


--- End quote ---

How can we wake up from HAL_Sleep()? When i  call HAL_Sleep () device goes to sleep and changed the app state to wake up but id didn't wake up..


ataradov:
It wakes up after the set timeout. But generally any way you can wake up the MCU could be used.

Read the datasheet fir details.

Peili:
Hi,
We are using atmega256rfr2 and LwMesh 1_2_1 stack.Now we configure our sleeping device(end device) with Watchdog timer of 2 sec interval. One WDT interrupts get devices just wake up and called appsenddata() twice and got to sleep(HAL_SLEEP()).. So  the device alive only for 125uS. We are trying to read routing table entry to get next hop address(parent address of ED). But, most of the time the ED doesn't deliver the exact parent address(nearest parent address).When we disable the WDT the ED send exact parent address. What to do to get the exact parent address with WDT interval of 2sec/4sec.

The configuration  for End device :

--- Code: ---#define APP_SENDING_INTERVAL      2000
  #define NWK_ROUTE_DEFAULT_SCORE 1
  #define NWK_ROUTE_DISCOVERY_TIMEOUT        200

--- End code ---
[/b]

changed the sleep function in HAL_Sleep() function and the code is  :

--- Code: ---void HAL_Sleep(uint32_t interval)
{
halSleepTimerEvent = false;
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
cli();
while(1){
sleep_enable();
sei();
sleep_cpu();
sleep_disable();
if(halSleepTimerEvent){
return;
}
}

ISR(WDT_vect){
halSleepTimerEvent=true;
    //WDT_Stop();
}


--- End code ---

Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod