This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2630: Synchronize Timer with Data Requests

Part Number: CC2630
Other Parts Discussed in Thread: Z-STACK, CC1352P, CC2652R,

Hi,

i need to switch on the antenna of my device every time a data request is made. Unfortunately there is no event exposed to the application and this is done on the RF-Core. I'm trying to work with a timer that has the same frequency as the poll rate, but I still need to synchronize them. Is there a way to do this?

Regards,

Philipp

  • What stack are you using?
  • I'm using the Z-Stack HA 1.2.2a
  • Hi Philipp,

    Regarding the implementation, you could try setting a new poll rate (equal to the period of the timer) in your timer event handler.

    Is this the same antenna that the device expects to receive data on, after sending the data request?
    Can you elaborate on the motivation behind this? Perhaps we can find a solution which does not rely on an event happening in the RF core.


    Regards,
    Toby
  • Hi Toby,

    I tried setting the PollRate to 0 and then to the needed Frequency to restart it in sync with the switch. The Problem is that this is not happening fast enough. I'm getting Timeslots to activate ZigBee communication from a separate chip making it necessary to have exact control of the polling. Even though i get these timeslots via an interrupt and try the PollRate resetting in the corresponding event handler, it is still not working.

    Yes it is the same antenna.

    The motivation is that ZigBee shares the antenna with another protocol on a separate chip. The other chip is the master in this architecture and serves Timeslots. I now need to coordinate those timeslots with the data requests. The Timer on the master is not getting in sync with the polling and without setting or getting exact information about the data request timing, I'm not sure how to coordinate it.

    Regards,

    Philipp

  • Hi Philipp,

    What is the current value of your poll rate? Based on your application description it seems to be quite frequent whereas most sleepy end device scenarios desire typically ZED data requests serve as keep-alive messages to their parent and to know if there are any queued messages waiting to be received. So long as neither of these are required each period then it should be possible to miss a few Zigbee timeslots and not directly synchronize with the other protocol.

    This application sounds like it would greatly benefit from the DMM offered on the SimpleLink CC1352P/CC2652R products, there will be Bluetooth + Zigbee examples available early 2019 as part of the SimpleLink SDK.

    Regards,
    Ryan
  • Hi Ryan,

    After joining the network we set a fast polling rate of 500ms for 2 min. After that we continue with a poll rate of 7s. Yes I agree, missing some timeslots wouldn't be critical to our application. But right now I'm not even able to sync the data-requests with my timeslots or re-sync them constantly.

    I attached the Power Amplifier Control to the Z-Stack. Would it be possible to get an interrupt in the application whenever the CTX pin is switched by the Z-Stack? This would be an possible indication for an outgoing data-reqeust.

    Regards,

    Philipp
  • I haven't deeply investigated this but have you tried adding a MAC_MLME_POLL_CNF case to MAC_CbackEvent of zmac_cb.c?

    Regards,
    Ryan
  • Thank you for providing more context.

    The MAC_MLME_POLL_CNF mentioned by Ryan seems promising. This should confirm that the poll request has been acknowledged and can help with signalling.

    For times when high responsiveness of the CC2630 is required, I'd suggest giving antenna access to the CC2630 for longer timeslots until that period of time is over. The CC2630 can signal the master afterwards.

    For times when the CC2630 does not need the antenna as often, then you don't necessarily need to set a periodic poll. The master knows of the 7 second polling, thus it can signal and hand antenna access to the CC2630. The CC2630 can use NLME_setPollRate(1), which will send a MAC data request once. Then CC2630 can signal the master when it's done using the antenna.
  • The MAC_MLME_POLL_CNF event is happening on the MAC layer though. How can I affect my application with this event?

    So you suggest to dectivate the automatic polling and send single data requests triggered by a timer?

    I tried to use NLME_setPollRate(1) in my app.c but received an compile error :
    Error[Pe256]: invalid redeclaration of type name "osal_event_hdr_t" (declared at line 67 of "C:\ti\simplelink\zstack_home_1_2_2a_TI_RTOS_2_21\Projects\zstack\HomeAutomation\msti_rebuild\CC26xx\..\..\..\common\CC26xx\appport\AF.h") C:\ti\simplelink\zstack_home_1_2_2a_TI_RTOS_2_21\Components\osal\include\OSAL.h 116
  • I envision that the timer for the single data requests would be on the master, while the slave would send out single data requests when signaled by the master. Looking more deeply into the software, this will be more involved than I initially anticipated (likely will need to create a new zstackapi).

    If this feature were implemented, would it fulfill the requirements of your application?
  • Yes the timer is running on the master and such an API would enable us to fulfill the requirements.

    Regards Philipp

  • There's a quick way to implement this feature. It actually uses an existing API and slight modifications to the zstacktask.c of the ZStack Core project.

    In the processSysConfigWriteReq function of zstacktask.c, replace

    if ( pPtr->pReq->has_pollRate )
    {
          zgPollRate = (uint16)pPtr->pReq->pollRate;
          osal_nv_write( ZCD_NV_POLL_RATE, 0, sizeof(zgPollRate), &zgPollRate );
    }

    with

    if ( pPtr->pReq->has_pollRate )
    {
    #ifdef APP_SINGLE_POLL
          if ( pPtr->pReq->pollRate == 1 )
          { 
              NLME_SetPollRate(1); // one time poll
          }
          else
          {
            zgPollRate = (uint16)pPtr->pReq->pollRate;
            osal_nv_write( ZCD_NV_POLL_RATE, 0, sizeof(zgPollRate), &zgPollRate );
          }
    #else
          zgPollRate = (uint16)pPtr->pReq->pollRate;
          osal_nv_write( ZCD_NV_POLL_RATE, 0, sizeof(zgPollRate), &zgPollRate );
    #endif
    }

    Make sure to predefine APP_SINGLE_POLL and rebuild the ZStack Core project to enable the changes.

    At this point I'll assume that you've successfully connected the CC2630 to a Zigbee network and have turned off automatic polling.
    Then, you'd need an interrupt handler in your application to handle the "ready" signal from the master. In this interrupt handler, you would set an event, similar to the following:

    static void readySignalHandler()
    {
        events |= SINGLE_POLL;
    
        // notify application of this event
        Semaphore_post(sem);
    }

    In your application loop where you wait for ICall messages (for example, Switch_process() for the SampleSwitch), you would handle the event as follows:

    if (events & SINGLE_POLL)
    {
        zstack_sysConfigWriteReq_t writeReq = {0};
        writeReq.has_pollRate = true;
        writeReq.pollRate = 1;
        Zstackapi_sysConfigWriteReq(zswEntity, &writeReq);
    }

    Essentially the processSysConfigWriteReq function is now taking a special case into consideration: a poll rate value of 1 will trigger a one time poll.

    I've initially verified expected functionality. Let us know if this works on your end.

  • Thank you very much for the great support! This workaround was easys to implement and works very well