[BitCloud] Reset with PDS enabled - Page 1
Forum section: electronics / general

author: danergo
author_rank: Regular Contributor
timestamp: November 25, 2015, 11:12:49 pm
content: Hi!I'm trying to use PDS with a bit more clever way. I just have a C and an R.After they found each other, I can send messages from C to R and back. That's good.Then, I reset the R which needs about 1 second to restore everything from the flash, and C can immediately send messages to R and also R back to C. That's also very good.However if I reset the C, R will never know that something has happened, so I decided to use a timer which periodically pings the C with ACK required and if no ACK comes, it resets itself.(This runs only on R.)So this is good, ACK is not coming after I reset C, so my code drops me back toCode://Starting network (results in joining to or forming a ZigBee network)zdoStartReq.ZDO_StartNetworkConf = appZdoStartNetworkConf; //Setting the callback functionZDO_StartNetworkReq(&zdoStartReq); //Sending a request to the stackHowever this code tries again with PDS but I would need a complete rescan of channels etc in here.So how can I achieve a full restart by code if PDS is enabled? That's the question.Thank you,danergo

author: danergo
author_rank: Regular Contributor
timestamp: November 25, 2015, 11:28:23 pm
content: A good solution is to enable PDS in C as well.Anyway, PDS loading can be simply disabled in application on restart.However in this case R can't reconnect to C.So the question is still up.danergo

author: ataradov
author_rank: Super Contributor
timestamp: November 25, 2015, 11:35:47 pm
content: Quote from: danergo on November 25, 2015, 11:12:49 pmYou can actually do "PDS_DeleteAll(false);" to reset network parameters to a factory new state, which will force new network connection on the next attempt.

author: danergo
author_rank: Regular Contributor
timestamp: November 26, 2015, 07:28:03 pm
content: Hi, thank you.I'm a bit closer now, but something seems still missing.If I add this "PDS_DeleteAll(false);" to the code, it resets the network parameters, however, after that,this code snippet is not able to succeed:Code://Starting network (results in joining to or forming a ZigBee network)zdoStartReq.ZDO_StartNetworkConf = appZdoStartNetworkConf; //Setting the callback functionZDO_StartNetworkReq(&zdoStartReq); //Sending a request to the stackHowever, after all of this, if I reset the CPU with the RST button, it then scans and connects successfully after a few seconds (clearly not with PDS, which is good).So now I just need something that can simulate or whatever the RST.Thank you,danergo

author: ataradov
author_rank: Super Contributor
timestamp: November 26, 2015, 07:40:05 pm
content: Yeah, I was afraid of that. I've actually never seen this code used not followed by immediate HAL_WarmReset(). If that works for your application, then it is the easiest way out.If not, then you can try to do ZDO_ResetNetworkReq() right after the PDS reset. And then do network join. But I'm not 100% sure that even that will force all the components to read out new values.

author: danergo
author_rank: Regular Contributor
timestamp: November 26, 2015, 07:42:52 pm
content: Anyway, startInfo's status is ZDO_NO_ENTRY_STATUS.I'm trying the HAL_WarmReset(). What should I check, what do you mean "if that works for your application"?Thank you!

author: ataradov
author_rank: Super Contributor
timestamp: November 26, 2015, 07:46:38 pm
content: Quote from: danergo on November 26, 2015, 07:42:52 pmThat's weird. I'll need to be at work to look at the source code to know when this may happen. I've never seen this status code returned.Quote from: danergo on November 26, 2015, 07:42:52 pmMechanically it will work, since it just resets the MCU and essentially equivalent yo what you do with the reset button. But sudden reset may cause problems for other components of the system. If this is not the case, and your system can tolerate short reset of the MCU, then just go with reset. It is definitely the cleanest solution from the stack state consistency point of view.

author: danergo
author_rank: Regular Contributor
timestamp: November 26, 2015, 08:22:30 pm
content: Okay, thank you.HAL_WarmReset() seems working.But now I'm really curious of the 0x88 error code.

author: ataradov
author_rank: Super Contributor
timestamp: November 26, 2015, 08:24:07 pm
content: Quote from: danergo on November 26, 2015, 08:22:30 pmI'll have a look at it when I'm back in the office next week.

author: danergo
author_rank: Regular Contributor
timestamp: November 26, 2015, 08:25:40 pm
content: Sure, no worries and rush.

author: ataradov
author_rank: Super Contributor
timestamp: November 30, 2015, 10:25:14 pm
content: It must be some mistake. ZDO_NO_ENTRY_STATUS (0x88) is never used in context of network joining. It is only used for binding and there is no way it can be returned in ZDO_StartNetworkConf().