Wake up xbee3 with commissioning button and go into micropython code?

Hi,

I would like to know if it is possible to wake up a sleeping xbee3 (SM=6) with the Commissioning button and, like the RTC wake-up, resume the operation of the micropython code to do other tasks?

Thank you

Syl

There is a sample application in PyCharm for waking a module via a Pin state change. I would suggest looking at that application. I don’t think it uses the commissioning button. But I think you could make the necessary changes in both the code and settings on the radio to allow it to use this pin instead.

Hi @mvut,

Ok tested my code with sleep_now(mytime, pin_wake = None)

This wakes the module when i push commissioning button and micropython comeback tu run. That is good for me.

Now, i need to determine the wake up source.

However, i have an issue with wake_reason() function. I get 2when reason come from commissioning, but always 2 if reason come from RTC_timeout after a second wake up. I expect 0.

It seems firmware do not update de wake_reason value.

Can y give me more informations about this problem ?

Thank you :wink:

What version of the XBee firmware are you working with?

What version of the Micro Python version are you working with?

Xbee firmare is 1014.

Micropython is 3.4.0

Perhaps I should ask what version of the XBee Plugin are you working with?

In PyCharm, Digi xbee 2.1.12

What is your SM command set to?

I’m with SM=6.

I do :

# code before sleep
...
xb = xbee.XBee()
xb.sleep_now(off_dly, False)
# I press commissioning button first then wait sleep_now timeout -> always '2' response
reason = xb.wake_reason()

print(reason)

I think you need to modify your code to include the timeout value and the pin_wake: function.

if input_pin.value() == 0:
    # Sleep for 30 seconds and enable the early wake up with DTR pin.
    print("  - Sleeping for 30 seconds...")
    sleep_ms = xb.sleep_now(30000, True)