Hi,
can i change the poll rate,QueuedPollRate,ResponsePollRate of END DEVICE and take effect in run-time without reset CC2530ZNP or resart ZIGBEE stack?
I try to change the END DEVICE from sleeping mode to no-sleeping mode for max performance sometime in running,how can i do?
Regards.
Hi Licheng,
You can use NLME_SetPollRate(), NLME_SetQueuedPollRate(), and NLME_SetResponseRate() to change polling rate, queuedpollrate and resplonsepollrate of end device anytime when you need to.
Regards!
YK Chen
YiKai Chen Hi Licheng, You can use NLME_SetPollRate(), NLME_SetQueuedPollRate(), and NLME_SetResponseRate() to change polling rate, queuedpollrate and resplonsepollrate of end device anytime when you need to. Regards! YK Chen
Thank you,but i am using the CC2530ZNP spi interface in the design,does the ZNP support the NLME APIs?As far as i know,it only supports the simple API,AF API and ZDO API.
For these 3 poll rates, you can changes them on the ZNP from the Application Processor (ZAP) side by writing to their corresponding NV item. Use this ZAP API:
uint8 znp_nv_write(uint16 id, uint8 ndx, uint8 len, void *buf)
So for the poll rate:
uin16 newPollRate = 2000; // Poll every 2 seconds.
(void)znp_nv_write(ZCD_NV_POLL_RATE, 0, 2, &newPollRate);
Be careful when changing the poll rates - FFD devices only hold indirect messages for 6-7 seconds by default:
-DNWK_INDIRECT_MSG_TIMEOUT=7
Thanks,
but it seens that this only will take effect after resetting the ZNP chip or restarting the ZSTACK,not immediately.
I agree, it does seem like it would only take effect after a reset, but it is effected immediately as well - take a look at the function MT_SysOsalNVWrite() in mt_sys.c:
/* Set the Z-Globals value of this NV item. */ zgSetItem( nvId, (uint16)nvItemLen, pBuf );
That is the magic line that makes it effective immediately.
Dirty Harry,
thank you very much,i will check the znp codes and have a test about this!And i will be back and verify your answer if it works well.Thank you!
Hello Harry,
I had done the simple test,but the result is that it seens the codes didn't take effect.
My simple codes is something like these:
if((*recvBuf).msgData[4]=='A') { setPollRate(10); }
else if((*recvBuf).msgData[4]==B') { setPollRate(1000); }
I am sure when in running and the ((*recvBuf).msgData[4]=='A') is TRUE,the ‘setPollRate(10)’ had been run,but the CC2530ZNP still kept the default pollRate(1000ms).And if i setPollRate(10) in the znpInit() function,the pollRate could be changed succefully.
So,did i miss something?
Hello - I do not see 'setPollRate()' in the ZAP code base; so perhaps it is your own function and there is a problem in that function? I just re-verified that my suggestion works to dynamically change the POLL_RATE of an end device via the MT API.
Hello,the setPollRate() is the function is the CC2530ZNP mini KIT example codes,
void setPollRate(unsigned int pollRate){ // if ((pollRate == 0) || (pollRate > 65000))// {// znpResult = -1;// return; // }#ifdef ZNP_INTERFACE_VERBOSE printf("Setting ZCD_NV_POLL_RATE to %u\r\n", pollRate);#endif znpBuf[0] = ZB_WRITE_CONFIGURATION_LEN + ZCD_NV_POLL_RATE_LEN; znpBuf[1] = MSB(ZB_WRITE_CONFIGURATION); znpBuf[2] = LSB(ZB_WRITE_CONFIGURATION); znpBuf[3] = ZCD_NV_POLL_RATE; znpBuf[4] = ZCD_NV_POLL_RATE_LEN; znpBuf[5] = LSB(pollRate); znpBuf[6] = MSB(pollRate); znpResult = sendMessage();
}
I found out this function only will take effect after the CC2530ZNP reset or ZSTACK restart.
And i didn't check the ZAP code,because i used ZNP firmware.I do know what is the difference between the ZAP firmware and the ZNP firmware.But in the ZNP firmware codes,i checked the MT_SYS.C and the function MT_SysOsalNVWrite(uint8 *pBuf),according the doucument CC2530ZNP interface, i could not figure out how to use this function to change the poll rate.Could you show me the way with example codes?I appreciate that.
And I already had a solution actually,i modified the MT_SYS.C, and added on my own function with cmd 0x2150,I named this function MT_SysSetPollRate(pBuf).This function would call the NLME_SetPollRate, NLME_SetQueuedPollRate,NLME_SetResponseRate to change the poll rate in run-time and take effect immediately.This is the working way i had found so far.
void MT_SysSetPollRate(uint8 *pBuf){ uint8 str[]="OK"; uint16 val1=1000; uint16 val2=100; uint16 val3=100; /* Skip over RPC header */ pBuf += MT_RPC_FRAME_HDR_SZ; val1 = BUILD_UINT16(pBuf[0], pBuf[1]); val2 = BUILD_UINT16(pBuf[2], pBuf[3]); val3 = BUILD_UINT16(pBuf[4], pBuf[5]); NLME_SetPollRate( val1 ); NLME_SetQueuedPollRate( val2 ); NLME_SetResponseRate( val3 ); /* Build and send back the response */ MT_BuildAndSendZToolResponse(((uint8)MT_RPC_CMD_SRSP | (uint8)MT_RPC_SYS_SYS), MT_SYS_SET_POLL_RATE, 2,str);}
Hello - unfortunately, I do not have any experience working with the ZNP mini-kit code. Although from the snippet that you show, I see that the poll rate is not being changed the way that I recommended, which would be to invoke this via ZAP (ZNP Application Processor, or "host" computer, controlling the ZNP as a network slave device) code:
The body of ZAP code is downloaded from here:
http://www.ti.com/tool/z-stack
swrc173.zip (57.0MB) - contains ZStack-ZAP-MSP430-1.0.4.exe (the ZigBee Applications processor to be used with MSP430 product family).
So, what is znp_nv_write()? It is intuitive from the name: a request to write to an NV item on the ZNP. How to implement a write to NV on the ZNP from the host application via the MT API? Use the MT_SYS_OSAL_NV_WRITE command. The item that we want to write is the poll rate: ZCD_NV_POLL_RATE or item id 0x0024. Let's set it to 5000 instead of the default of 1000.
So building the SREQ MT message should be this:
SOP LEN MT_RPC_CMD_SREQ-MT_RPC_SYS_SYS MT_SYS_OSAL_NV_WRITE ZCD_NV_POLL_RATE Offset Len Value FCS
0xFE 0x06 0x21 0x09 0x24 0x00 0x00 0x02 0x88 0x13 0x93
It helps to look at the files MT.h & MT_RPC.h.
Hi licheng Li
Did you get it working in CC2530 ZNP Mini. I get the following pulses in between my 4 sec transmission intervals:
I want to minimize those mini peaks to say once, between those 4 seconds, any ideas pls help!!!
Iam using CC2530 ZNP Mini
-Sree
Hi, it is the CC2530 ZNP Mini which i am using,and i didn't found any problem.
What code did you use in your problem?
Hi Li,
Iam also using CC2530 ZNP Mini, running simple application code.
I had put up the same question in another forum to which I got the response to consider the the poll rate. Posting one of the posts in that query here:
I read about ZCD_NV_POLL_RATE and figured out, it is set by void setPollRate(unsigned int pollRate) function in znp_interface.c, however amazingly there is no call to that function in Simple Application - End Device code (searched manually and ctrl+F deep search). So I manually included the following lines of code in startZnp (@znp_simpleapp_utils.c) after znpReset
setPollRate(2000); if (znpResult != ZNP_SUCCESS) return -11;/**/
which provides me this plot:
which was earlier, (before the above manual setPollRate(2000) inclusion):
While that is certainly a difference in the plot, I couldnt map the 2000mS, and more importantly, how is that 1Sec interval set by default with no call to setPollRate in original Simple Application - End Device. Atleast, if I know the root of that 1Sec interval and how it is set (since setPollRate is not called exclusively), I could further dig around.