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/CC2650: Add timestamp to movement service data

Part Number: CC2650

Tool/software: Code Composer Studio


I have a question regarding the movement service of the CC2650 sensortag. I wanted to add a timestamp to the sneosrdata and I thought to extend the sensor data length in the firmware from 18bytes to 22bytes. I tried it out but it does not work. I even checked out this post :

It was the same problem, and it was not possible. I know that it is possible to oerwrite the magnetometer data what I already did or to create an additional characteristic for the timestamp. I wanted to know is it possible to extend the sensor data length in the firmware, since I need all 3 sensors?

  • Hi,

    You can create a new characteristic for the timestamp. You will have to add it in the attribute table of the relevant service. 

    To learn more about Bluetooth services and characteristics, please see the BLE Custom Profile SimpleLink Academy lab:


  • Hi Marie,

    thank you for your reply and for the hint. This way I already tried and it worked, I was thinking if there is a more elegant way of doing it. Do you know why extending the sensor data length is not possible?

  • It should be possible to extend the characteristic value length. But the Starter app will not be able to decode the new format. How did you try to change the length?

  • Eirik V said:

    It should be possible to extend the characteristic value length. But the Starter app will not be able to decode the new format. How did you try to change the length?

    Hi Eirik V, thank you for response. I did the following changes to extend the length:

    in movementservice.h:

    // Length of sensor data in bytes
    #define MOVEMENT_DATA_LEN             22 //instead of 18 bytes for sensor values, extend to 22 since we have 18Bytes of sensor data + 4 bytes of timestamp

    in movementservice.c:

    // Characteristic Value: data  (18 bytes)
    static uint8_t sensorData[SENSOR_DATA_LEN] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 
                                                   0, 0, 0, 0, 0, 0, 0, 0, 0,
                                                   0, 0, 0, 0
                                                 };  //(18 bytes for data)--> extend it to 22 bytes

    in sensortag_mov.c:

    within void SensorTagMov_processSensorEvent(void):

    else if (mpuIntStatus & MPU_DATA_READY)
              uint32_t timestamp = AONRTCCurrentCompareValueGet(); 
              memcpy(&sensorData[18], &timestamp, 4);

    These are the changes that I did. What do you mean in the starter App it is not possible? I used the example of the ble stack

  • Hello sensortag_fan,

    The data characteristic is used for notifcations which require larger MTU size configured to be able to handle 22 bytes payload. Increasing the size of the ATT_MTU increases the amount of data that can be sent in a single ATT packet. The longest attribute that can be sent in a single packet is (ATT_MTU-1) bytes. Procedures, such as notifications, have additional length restrictions. For notifications 20 bytes is max length for the default MTU size: 

  • Hello Eirik,

    thank you for the information and for the link. It seems to be a very complicated process to extend it. At the moment I am not understanding certain steps in the documentation how to do it. It is not clear where to do this changes in the code

  • You need to define MAX_PDU_SIZE=29 or larger as preprocessor symbol in the application project (both slave and master). Then you must update the MTU in a connection by calling Call GATT_ExchangeMTU()  from the GATT client (usually MASTER device or Central). The procedure is added in SimpleBLECentral_startDiscovery in simple_central.c

  • Hi Eirik,

    thank you for the explanation, the thing is that I am using an Iphone which is getting the data and is acting as master. In the sensortag I think it is not a problem but in the iphone I don't see how to use it there, or if it is supported?

    Can you maybe explain me please why 29 bytes for MTU?

  • The ble stack on the phone probably support it, but you need to sniff the connection to verify if there is an MTU exchange request sent. But you need to increase the MTU size (MAX_PDU_SIZE) in your sensortag project. 

    Its all explained in the users guide link I sent you. 29 bytes will allow a maximum of 22 bytes sent as notification.

  • Ok it means to change MAX_PDU_SIZE in my sensortag project and chdck on the iphone site, if he is doing the MTU exchange. I am reading the user guide, but it means that from the 27bytes of MAX_PDU_SIZE some of the bytes are like header so that only 20 Bytes are left, right? This is what I cannot find in the guide.

    For sniffing, which kind of tool can be used? - I think I can find it undr your tags -- BLE PACKET Sniffer

    I was checking the sensortag cc2650 example for changing MAX_PDU_SIZE to 29 but I cannot find it. I am using the sensortag_cc2650 app.

  • HI I changed the MAX_PDU_SIZE in ble_user_config.h to 29 but it is not working. I was rereading your previous post and you said that I should as preprocessor symbol, do you mean right_click on Sensortag_cc2650_app --> Advanced Options --> Predefined Symbols --> MAX_PDU_SIZE = 29?

  • Yes, It is explained in the Users guide. Please read section Configuring for Larger MTU Values.

  • Okay, thank you for explaining. So instead of changing it directly in the source code I should set up a predefined symbol. I will try it out and I will let you know.

  • I have a question, since the project contains app and stack folder, should I define this MAX_PDU_SIZE in both or only for the application?

    Where can I find the simpleCentral example to see where to call the GATT_ExchangeMTU()?

  • Only the application. It is explained in the Users Guide.

    SimpleBLECentral_startDiscovery -> GATT_ExchangeMTU in