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.

CCS/CC2652R: CC2652R: Configure periodic clock to send data via bluetooth

Part Number: CC2652R
Other Parts Discussed in Thread: SYSBIOS

Tool/software: Code Composer Studio

Hi,

I implemented two different versions of a period clock from Ti documentation, but it does not work. Changing the timeout period does not change anything.

http://dev.ti.com/tirex/content/simplelink_cc2640r2_sdk_3_10_00_15/docs/blestack/ble_user_guide/html/ble-stack-tirtos/clocks.html

http://software-dl.ti.com/lprf/simplelink_academy/modules/ble_01_custom_profile/ble_01_custom_profile.html#task-6-ndash-bonus-make-the-update-periodic

Is it possible to set up a periodic clock using the .cfg file? How does it work to send data via bluetooth?

Thanks a lot.

  • Hi

    I will assign someone to look help you out, but in the meantime it would be helpful if you can share information of what exactly you have done and how you are testing/what does not work. Saying that you have implemented two different version of a period clock that does not work does not give us much to work with.

    We also need you to be more specific in your question regarding how does it work to send data via bluetooth.

    BR

    Siri

  • I implemented e.g. the code below into the Project Zero example.

    I activated notifications and I am using an RF sniffer to see all notifications. I assume, that the period of notifications should change if I am changing my sensor data within a clock function. Is that correct?

    #define PZ_MSG_PERIODIC_TIMER   11  /* Timer has expired, set characteristic value */

    // Default timeout of sensordata timer
    #define DEFAULT_SENSORDATA_TIMEOUT            50000  // SOLUTION

    static void ProjectZero_init(void){

     //////////////////////// Clock initialization for periodically sending data ///////////
        // clockParams is only used during init and can be on the stack.
        Clock_Params myClockParams;
        // Insert default params
        Clock_Params_init(&myClockParams);
        // Set a period, so it times out periodically without jitter
        myClockParams.period = DEFAULT_SENSORDATA_TIMEOUT * (1000/Clock_tickPeriod),
        // Initialize the clock object / Clock_Struct previously added globally.
        // Calles callback function myClockSwiFxn when time out
        Clock_construct(&myClock, myClockSwiFxn,
                        0, // Initial delay before first timeout
                        &myClockParams);
        Clock_start(Clock_handle(&myClock)); // start clock to send out data
        //////////////////////////////////////////////////////////

    }

    static void ProjectZero_processApplicationMessage(pzMsg_t *pMsg)
    {
        // Cast to pzCharacteristicData_t* here since it's a common message pdu type.
        pzCharacteristicData_t *pCharData = (pzCharacteristicData_t *)pMsg->pData;

        switch(pMsg->event){

          case PZ_MSG_PERIODIC_TIMER:{ // when timeout, this case will be called, parameter changed and sent

              uint16_t datapoint = counter;
              uint8_t  byte1 = (int)(datapoint/100);
              uint8_t  byte2 = (int) (datapoint- (byte1*100));
              Sensor_data_service_SetParameter(SENSOR_DATA_SERVICE_DATA, SENSOR_DATA_SERVICE_DATA_LEN, &byte1);
              Sensor_data_service_SetParameter(SENSOR_DATA_SERVICE_DATA2, SENSOR_DATA_SERVICE_DATA2_LEN, &byte2);
              Clock_start(Clock_handle(&myClock));
              counter++;

    break;

          }

    }

    }

    /////////////////////////////Callback function ///////////////////

     void myClockSwiFxn(uintptr_t arg0)
    {
      // Can't call blocking TI-RTOS calls or BLE APIs from here.
      // .. Send a message to the Task that something is afoot.
      ProjectZero_enqueueMsg(PZ_MSG_PERIODIC_TIMER, NULL); // Not sending any data here, just a signal
    }
    /////////////////////////////////////////////////////////////////////////////////

     

    This is the sniffer result wich does not change using the periodic clock.

     

     

  • Hi,

    Can you specify the period of the clocks and the connection interval of your BLE link?

    Regards,

  • The minimum connection interval is 15 x 1.25 ms.

    The maximum connection interval is 45 x 1.25 ms.

    Both values were already set up in Project Zero.

    The period of clocks is: ti_sysbios_knl_Clock_tickPeriod__C = (xdc_UInt32)0xa;     and  0xa =10;

    Are these the parameters you need?

  • Hi,

    Please also specify

    - the interval you are observing between two notifications

    - the effective connection interval

    Regards,

  • The interval between two notifications is 676µs.

    I am not sure where to find the effective connection interval. When a retransmission happens, which occures in the next connection interval as far as I know, these two notifications have  ~15ms in between.

    Is it possible to check the effective connection interval using wireshark?

  • Hi,

    Have you find the source of your problem?

    The minimum connection interval is 7.5ms (in your case the CI is between 18.75ms and 56.25ms)... so you cannot notify the central device every 676us...

    Regards,

  • Hi,

    no, I havn't found my problem.

    As I my periodic clock is not working, I can not change the the frequency of sending notifications.

    I added the image of my sniffer which shows 676µs difference between two notifications. I realised, that the unit of the connection interval was ms, so they are 15ms to 40ms. I realised that 4 notifications might be send togather, so that 4 of them reach an connection interval of 15ms.

    I already changed the interval parameter, but there was no difference in the result.

    To test more, it would be helpfull to make my periodic clock working.

  • Hi,

    Have you tried using the ROV (if needed, please see the Debugging chapter of the BLE Stack User's Guide)? What is the status of your periodic clock?

    Have you tried to run your code step by step to verify if 1) the clock is properly created and 2) if the CB is accessed? Have you also tried to create a clock in a simpler project?

    Regards,