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.

LAUNCHXL-CC1352P: Adding CoAP POST functionality to a project

Part Number: LAUNCHXL-CC1352P


Hi!

I am now running a project a little bit modified of the temp_sensor example. I know it responds to a CoAP request reporting the temperature value of a sensor, and I'd like to make it working as a client so it can report the temperature value by itself from time to time without needing to receive a GET.

Is there any advice on how to implement it? Is it okay to do this on this example or it would be better to start a new project using the cli_mtd or empty_mtd examples?

Thank you!

  • Hi Eduardo,

    Have you come across that discussion on GitHub?

    https://github.com/orgs/openthread/discussions/9029

    Regards,

    Arthur

  • Hi Eduardo,

    The Thread temp_sensor README includes a section for "Running the example with reporting":

    The Temperature Sensor example has a basic reporting feature. When connected to a network with a Globally Unique Address, the temperature sensor will attempt to post the temperature it reads to the thermostat. To enable this feature you need to setup a Thread network with an NCP connected to a BeagleBone Black and a LaunchPad with the Thermostat Example. Consult the NCP example's README for information on setting up a BeagleBone Black based border router.

    The tempsensor.c code includes logic for the tempSensorReport function and a TIOP_TEMPSENSOR_REPORTING_INTERVAL definition.

    Regards,
    Ryan

  • Hi Ryan!

    and a LaunchPad with the Thermostat Example

    In this case you mean the temp_sensor, correct?

    I have one LP running the ncp_ftd example, another one running the cli_ftd with a Thread network which the NCP has joined. A 3rd LP is running the temp_sensor example and has also joined the network.

    How can I see if the temp_sensor app is reporting the temperature value? Am I able to store the values somehow?

    Regards,

    Eduardo.

  • There is a thermostat example in the Thread folder, you should attempt the basic example configuration before making any changes to suit your application requirements.  The thermostat example will also show how to receive these values, which you will need to replicate for your NCP or CLI and store the values as you determine necessary for your application.  The usage you are requesting lies outside of the Thread stack example operation provided by TI.

    Regards,
    Ryan

  • Ryan,

    Reading the temp_sensor and thermostat examples I understood that the Temperature Sensor reports the values to the Thermostat when using NCP, is that correct?

    If so, I can build a network with the NCP and then join this network with the Thermostat and Temperature Sensor to be able to use the reporting feature? The READMEs were not that clear for me about the working flow.

    Regards,

    Eduardo.

  • The NCP or CLI device is needed to set up the Thread network, then the temperature sensor and thermostat devices must commission into this Thread network before they are able to report application values.  Thus three radio devices are ultimately required.

    Regards,
    Ryan

  • And after they join the Thread network, I suppose they send data to the NCP? Or the tempsensor only reports to the thermostat?

  • "When connected to a network with a Globally Unique Address, the temperature sensor will attempt to post the temperature it reads to the thermostat"

    The temperature sensor reports to the thermostat CoAP.  Do you have a sniffer setup to observe the communication?

    Regards,
    Ryan

  • Hi Ryan,

    Based on our conversation I could understand a bit more about the code and the working flow of the examples. When the temperature sensor is reporting the value to the thermostat, it sends a CoAP POST message, correct?

    A follow up question: you told me:

    The NCP or CLI device is needed to set up the Thread network

    Once the thermostat example is also a FTD, could I modify it to set up the network too? In this case I would only need 2 devices?

    Regards,
    Eduardo.

  • Once the thermostat and temp_sensor are commissioned by NCP, then the NCP can drop off the network; thermostat and temp_sensor would continue communication.  If you want to avoid using the NCP/CLI then you would need to enable the joiner functionality on the thermostat example and add in code to receive user input for the info of the device to-be joined.  The thermostat does not implement "Thread joiner/commissioner", while CLI or NCP do implement it to on-board/commission a device (be it thermostat or temp_sensor). Theoretically thermostat could implement Thread commissioner (it'd basically run a similar sequence of OT function calls as CLI/NCP when the user enters the commissionee info such as EUI64 and PSKD).  Thread requires such a commissioning process for network security reasons.

    Regards,
    Ryan