Author Topic: LWMesh -physical sleep  (Read 943 times)

0 Members and 1 Guest are viewing this topic.

Offline PeiliTopic starter

  • Regular Contributor
  • *
  • Posts: 108
  • Country: in
LWMesh -physical sleep
« on: March 30, 2019, 09:50:34 am »
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?
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11905
  • Country: us
    • Personal site
Re: LWMesh -physical sleep
« Reply #1 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.
Alex
 

Offline PeiliTopic starter

  • Regular Contributor
  • *
  • Posts: 108
  • Country: in
Re: LWMesh -physical sleep
« Reply #2 on: April 01, 2019, 10:54:11 am »
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.


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..


 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11905
  • Country: us
    • Personal site
Re: LWMesh -physical sleep
« Reply #3 on: April 01, 2019, 04:13:52 pm »
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.
Alex
 

Offline PeiliTopic starter

  • Regular Contributor
  • *
  • Posts: 108
  • Country: in
Re: LWMesh -physical sleep
« Reply #4 on: April 04, 2019, 12:59:01 pm »
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: [Select]
#define APP_SENDING_INTERVAL			     2000
  #define NWK_ROUTE_DEFAULT_SCORE 1
  #define NWK_ROUTE_DISCOVERY_TIMEOUT        200
[/b]

changed the sleep function in HAL_Sleep() function and the code is  :
Code: [Select]
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();
}

 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11905
  • Country: us
    • Personal site
Re: LWMesh -physical sleep
« Reply #5 on: April 04, 2019, 05:23:45 pm »
I have not worked with AVRs in ages, so I have no idea about the actual sleep procedure. My old code just used a regular asynchronous timer for sleep.

But I don't see how this may be related to getting correct entries at all. Sleep should be transparent to the stack.
Alex
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf