Home/Support/Support Forum/Xbee set sleep mode and write changes through java

Xbee set sleep mode and write changes through java

0 votes
Hi, I have a java application configuring all my devices in my ZigBee network. That's done through the coordinator sending remote AT commands to all devices.

I use the MyDiscoveryListener to get all my devices: List<RemoteXBeeDevice> remotes = myXBeeNetwork.getDevices();

Then I use the setParameter command to modify the connected nodes. E.g. remotes.get(i).setParameter("ID", ID);

This works fine until the second to final setting: SM, cyclic sleep mode in my case: remotes.get(i).setParameter("SM", SM_E); When applying the SM it imediately goes to sleep so my final command WR (write changes to NVM) won't apply: remotes.get(i).writeChanges();.

So if a reset occurs I'm never able to sustain the sleep mode in the node (END device). Through the XCTU/UART it's working fine (+++ mode), but that would not be efficient configuring >50 nodes network...

I'm not able to find a solution in documents, web or in this forum, but if anyone has a solution or somewhere to look for a solution it would be perfect. Thanks!
asked Oct 27, 2016 in IEEE 802.15.4 by jrherheim New to the Community (4 points)

Please log in or register to answer this question.

2 Answers

0 votes
 
Best answer
When sending configuration control parameters using remote AT commands, it is a good practice to send your configuration parameters using the Remote Command Options byte set to 0x00. This way, you can send each configuration change command, and get the response, and when all configuration parameters have been sent, the parameters can be applied only at the end. Do this, by sending your last command with the Remote Configuration Command Option byte set to 0x02.

Otherwise, each remote AT command is being applied when it is received, which in your case, when the SM command is received, it immediately applies the SM setting, which causes the module to become and End device.
answered Nov 8, 2016 by gworle Seasoned Professional (153 points)
selected Nov 9, 2016 by jrherheim
Thanks for your reply! This sounds like it'll do the trick, and I'll try it out asap.
0 votes
First of all, Thank you for asking because I accidentally set SP and ST parameters the way that the device would sleep right after sending response and XCTU couldn't discover the device since it would be in sleep mode. Only solution was to set those ST and SP via my java code and your question helped!

to answer your question, you need to specify values in form of byte[]. I am gonna share you this link in case you have hex values and want to convert them.

http://texnological.blogspot.com/2014/01/convert-hex-string-to-byte-array-and.html
answered Aug 20, 2018 by virajsathvara New to the Community (2 points)
...