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.

LPSTK-CC1352R: FIXED IDENTIFICATION Of a sensor

Part Number: LPSTK-CC1352R
when a sensor disconnects then reconnects to the CC1352P1 collector launchpad, the sensor address changes!

I want a sensor to keep the same identity or address after each connection to a collector to facilitate its monitoring and identify it quickly because I store temperature and humidity values...in a database and if the address of the sensor changes, the values ​​will not be reliable to use

any solution please?
  • Hi,

    I am assuming you are using TI 15.4 stack.

    You can use the extended 64 bit address instead of the short 16 bit address. The extended address is unique and constant for each device.

    You can retrieve device info including the extended address using Csf_getDevice.

    Regards,
    Nikolaj

  • more details please , I did not understand well , I tried it does not work
  • Hi,

    I want to make sure that I understand you correctly. This is what I am assuming you collector application is currently doing (please correct me if I am wrong):

    When the collector receives a sensor data message from a sensor, it is retrieving the source address from the message, and stores the sensor data in the database for that given address.

    How are you currently retrieving the the source address?

    Thanks,
    Nikolaj

  • currently i am using the project "collector_CC1352P1_LAUNCHXL_tirtos7_ccs" which is located in :(Resource Explorer>Examples->TI 15.4-Stack->collector->CCS Compiler).
    
    the csf_getDevice function is used to assign an address by incrementation (the first sensor has the address 0x0001, the second has 0x0002 ... if I dissect the first and I associate it a second time with the same collector, it will obtain a different address at 0x0001 .
    
    you will have a solution to have an identifier or a fixed address for each sensor.
  • Hi,

    I don't think I fully understand your setup. csf_getDevice is not used to assign addresses it is only used to retrieve device info.

    Please take a look at below modified Csf_deviceSensorDataUpdate() function (found in csf.c). This modification shows how you can retrieve the extended 64-bit address. Please focus on line 24 to 35.

    /*!
     The application calls this function to indicate that a device
     has reported sensor data.
    
     Public function defined in csf.h
     */
    void Csf_deviceSensorDataUpdate(ApiMac_sAddr_t *pSrcAddr, int8_t rssi,
                                    Smsgs_sensorMsg_t *pMsg)
    {
    #ifndef POWER_MEAS
        LED_toggle(gGreenLedHandle);
    #endif /* endif for POWER_MEAS */
    #ifndef CUI_DISABLE
        if(pMsg->frameControl & Smsgs_dataFields_bleSensor)
        {
            CUI_statusLinePrintf(csfCuiHndl, deviceStatusLine, "ADDR:%2x%2x%2x%2x%2x%2x, UUID:0x%04x, "
                                 "ManFac:0x%04x, Length:%d, Data:0x%02x", pMsg->bleSensor.bleAddr[5],
                                 pMsg->bleSensor.bleAddr[4], pMsg->bleSensor.bleAddr[3], pMsg->bleSensor.bleAddr[2],
                                 pMsg->bleSensor.bleAddr[1], pMsg->bleSensor.bleAddr[0], pMsg->bleSensor.uuid,
                                 pMsg->bleSensor.manFacID, pMsg->bleSensor.dataLength, pMsg->bleSensor.data[0]);
        }
        else
        {
            Llc_deviceListItem_t devItem;
            Csf_getDevice(pSrcAddr, &devItem);
            CUI_statusLinePrintf(csfCuiHndl, deviceStatusLine, "Sensor - Addr=%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x, Temp=%d, RSSI=%d",
                                 devItem.devInfo.extAddress[7],
                                 devItem.devInfo.extAddress[6],
                                 devItem.devInfo.extAddress[5],
                                 devItem.devInfo.extAddress[4],
                                 devItem.devInfo.extAddress[3],
                                 devItem.devInfo.extAddress[2],
                                 devItem.devInfo.extAddress[1],
                                 devItem.devInfo.extAddress[0],
                                 pMsg->tempSensor.ambienceTemp, rssi);
    #ifdef LPSTK
            CUI_statusLinePrintf(csfCuiHndl, lpstkDataStatusLine, "Humid=%d, Light=%d, Accl=(%d, %d, %d, %d, %d), Hall=%d",
                                 pMsg->humiditySensor.humidity, pMsg->lightSensor.rawData,
                                 pMsg->accelerometerSensor.xAxis, pMsg->accelerometerSensor.yAxis,
                                 pMsg->accelerometerSensor.zAxis, pMsg->accelerometerSensor.xTiltDet,
                                 pMsg->accelerometerSensor.yTiltDet,
                                 pMsg->hallEffectSensor.fluxLevel);
    #endif
        }
        CUI_statusLinePrintf(csfCuiHndl, numJoinDevStatusLine, "%x", getNumActiveDevices());
    #endif /* CUI_DISABLE */
    
    #if defined(MT_CSF)
        MTCSF_sensorUpdateIndCB(pSrcAddr, rssi, pMsg);
    #endif /* endif for MT_CSF */
    }

    Using this code with the default collector example, and the default sensor example, I get the following output over UART:

    Please note the address for the sensor is the extended (64-bit) address "00:12:4b:00:1c:a1:b6:fa". This address is unique and constant for the sensor. 

    You can use code similar to line 24-35 in above code snippet to retrieve the extended address in your project.

    Regards,
    Nikolaj