Author Topic: [BitCloud] Reset with PDS enabled  (Read 3254 times)

0 Members and 1 Guest are viewing this topic.

Offline danergoTopic starter

  • Regular Contributor
  • *
  • Posts: 111
  • Country: hu
[BitCloud] Reset with PDS enabled
« on: November 25, 2015, 11:12:49 pm »
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 to
Code: [Select]
//Starting network (results in joining to or forming a ZigBee network)
zdoStartReq.ZDO_StartNetworkConf = appZdoStartNetworkConf; //Setting the callback function
ZDO_StartNetworkReq(&zdoStartReq); //Sending a request to the stack

However 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
 

Offline danergoTopic starter

  • Regular Contributor
  • *
  • Posts: 111
  • Country: hu
Re: [BitCloud] Reset with PDS enabled
« Reply #1 on: November 25, 2015, 11:28:23 pm »
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
« Last Edit: November 25, 2015, 11:32:42 pm by danergo »
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11260
  • Country: us
    • Personal site
Re: [BitCloud] Reset with PDS enabled
« Reply #2 on: November 25, 2015, 11:35:47 pm »
So how can I achieve a full restart by code if PDS is enabled? That's the question.

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

Offline danergoTopic starter

  • Regular Contributor
  • *
  • Posts: 111
  • Country: hu
Re: [BitCloud] Reset with PDS enabled
« Reply #3 on: November 26, 2015, 07:28:03 pm »
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: [Select]
//Starting network (results in joining to or forming a ZigBee network)
zdoStartReq.ZDO_StartNetworkConf = appZdoStartNetworkConf; //Setting the callback function
ZDO_StartNetworkReq(&zdoStartReq); //Sending a request to the stack

However, 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
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11260
  • Country: us
    • Personal site
Re: [BitCloud] Reset with PDS enabled
« Reply #4 on: November 26, 2015, 07:40:05 pm »
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.
Alex
 

Offline danergoTopic starter

  • Regular Contributor
  • *
  • Posts: 111
  • Country: hu
Re: [BitCloud] Reset with PDS enabled
« Reply #5 on: November 26, 2015, 07:42:52 pm »
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!
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11260
  • Country: us
    • Personal site
Re: [BitCloud] Reset with PDS enabled
« Reply #6 on: November 26, 2015, 07:46:38 pm »
Anyway,  startInfo's status is ZDO_NO_ENTRY_STATUS.
That'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.

I'm trying the HAL_WarmReset(). What should I check, what do you mean "if that works for your application"?
Mechanically 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.
Alex
 

Offline danergoTopic starter

  • Regular Contributor
  • *
  • Posts: 111
  • Country: hu
Re: [BitCloud] Reset with PDS enabled
« Reply #7 on: November 26, 2015, 08:22:30 pm »
Okay, thank you.

HAL_WarmReset() seems working.

But now I'm really curious of the 0x88 error code.  :)
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11260
  • Country: us
    • Personal site
Re: [BitCloud] Reset with PDS enabled
« Reply #8 on: November 26, 2015, 08:24:07 pm »
But now I'm really curious of the 0x88 error code.  :)
I'll have a look at it when I'm back in the office next week.
Alex
 

Offline danergoTopic starter

  • Regular Contributor
  • *
  • Posts: 111
  • Country: hu
Re: [BitCloud] Reset with PDS enabled
« Reply #9 on: November 26, 2015, 08:25:40 pm »
Sure, no worries and rush.
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11260
  • Country: us
    • Personal site
Re: [BitCloud] Reset with PDS enabled
« Reply #10 on: November 30, 2015, 10:25:14 pm »
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().
Alex
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf