LWMesh : WSNDemo end device doesn't sleep

Go To Last Post
11 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am trying to demonstrate the sleep function in the WSNDemo.  I load the example project and I only change the APP_ADDR in config.h to 0x8005.  I want to change APP_SENDING_INTERVAL and see that the end device sleeps for that amount of time.

 

I should be able to notice the sleeping by seeing the LED stay off for APP_SENDING_INTERVAL number of milliseconds right?  Even if there is no "coordinator" device, just the end device being the only powered-on device? 

 

I'm not seeing this.  The LED does its on/off pattern periodically and the period does not change with APP_SENDING_INTERVAL.

I've tried it with a "coordinator" but the end device still doesn't sleep so I figure I can ignore the networking stuff and just get the standalone device to sleep.

 

Using the debugger, it does stop at a breakpoint in the RTC callback, so it seems like it's working but it seems like the callback is instantly getting called.

 

I'm using a SAMD20 Xplained Pro, and a Wireless Xplained Pro Zigbit with the ATZB-RF-212B.  

 

Any feedback is appreciated, thanks!

Steve

 

 

Last Edited: Fri. Oct 16, 2015 - 12:26 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

thanks for the link and sorry if I am missing something obvious.... but none of those search results have the answer.  Perhaps specify which thread you were referring to?  Or ask me to give more details?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Was sure there's been a discussion on this recently.

 

Does this one help?

https://www.avrfreaks.net/forum/l...

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

nope, that discussion is about getting sleep times longer than 1 minute.  I can't get the SAMD20 to sleep at all.

I'll describe and then repeat the steps to recreate the problem, just to double check that I'm not being stupid.

Connect the SAMD20 Xplained Pro to the computer, Atmel Studio recognizes it and opens that tab.

Click New Example Project... Create a WSNDemo example application using the Wireless Xplained Pro Zigbit with the 212b tranceiver.

Open config.h and change APP_ADDR to 0x8005

Run the application

Change APP_SENDING_INTERVAL, see if sleep is happening.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Standalone version of LwMesh has fake sleep. But that will still create proper intervals.

 

But since you are mentioning RTC, I assume you are using LwMesh from ASF, in which case you are on your own, I have no idea what ASF is doing.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK I'm not familiar with exactly what ASF is.  Please correct me if I'm wrong:

So there's the ASF wizard where I can select modules to be included in my project, and LWMesh is one of those modules.  I'm not talking about that, I'm talking about creating an example project.  File -> New -> Example Project.  What you're saying is that the WSNDemo example project is also part of ASF, and so you don't know what's happening there.

 

=====

OK I just looked up the WSNDemo in the standalone LWMesh.  It is different.  Here is a snippet from the standalone WSNDemo.

    case APP_STATE_SLEEP:
    {
      HAL_LedClose();
      HAL_Sleep(APP_SENDING_INTERVAL);
      appState = APP_STATE_WAKEUP;
    } break;

 

 

and here is the corresponding snippet from the ASF WSNDemo

 

    case APP_STATE_SLEEP:
    {
        sm_sleep(APP_SENDING_INTERVAL / 1000);
        appState = APP_STATE_WAKEUP;
    }

 

sm_sleep() does stuff with the RTC and eventually executes the DSB and WFI instructions.

 

 

Well... that starts to make sense.  I wonder if the ASF version of WSNDemo for SAMD20 and 212B just simply doesn't work.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

It is quite possible. There is a lot of stuff in ASF that does not work.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well dang, looks like I have to reinvent the wheel.

 

I need real sleep, not fake sleep... and I suppose this discussion is now unrelated to LWMesh.

 

Thanks!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

You have two options - invest your time into writing code that you know works or invest your time into debugging ASF and still have no idea what is going on in the end, even if you manage to get it working.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

that's hilarious!  I'll take option 1.  

 

That's pretty much what I was thinking but wasn't exactly sure because I haven't used ASF or LWMesh before, so thanks for telling me now!