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: Meaning of Ssf_ReadingClock(randomNum)

Part Number: LPSTK-CC1352R

Hi everyone.

We are doing some tests with LPSTK-CC1352R with sensor and collector projects. I have one main doubt about the use of the function Ssf_setReadingClock(uint32_t readingTime), defined at ssf.h. I would like to know the reason why the readingTime parameter is set to randomNum at Jdllc_rejoin, processCoordRealign (those two at jdllc.c), processConfigRequest, jdllcJoinedCb and setRDAttrCb (those last three at sensor.c).

I can see that, at Sensor_sendMsg, readingTime is set to reportingInterval, which seems to make sense (the sensors are read at every reporting interval). However, I cannot see why it is set to randomNum in the rest of cases. I would appreciate if you could explan why readingTime is set to randomNum in those cases.

Thank you in advance and best regards,

Mario

  • Hi Mario,

    It's done just to avoid reading all the sensors at once. 

    If you look at how randomNum is defined, it will still fall inside the reporting interval.

  • Hi Marie,

    Thank you for your quick response. Do you mean that every time ssf_setReadingClock(randomNum) is called, a different sensor is read? I think all sensors are read every time it is called, anyway. The readings of the sensors are carried out by the functions "Lpstk_readHumiditySensor", "Lpstk_readLightSensor",etc. and they are called in the function processSensorRead from lpstk.c. So, I am still not getting why ssf_setReadingClock(randomNum) is called.

    Thank you and best regards,

    Mario

  • Hi,

    Could you please provide any feedback about my last post?

    Best regards,

    Mario

  • Hi Mario,

    Ssf_setReadingClock() with setReadingClock(randomNum) is called any time the sensor is sending its first sensor reading to the collector. The reason why the interval is set to a random number is to avoid multiple sensors to send data to the collector at the same time.

    The main reason for calling setReadingClock(randomNum) on these events:

    • Rejoin
    • Coordrealign
    • Config request
    • joinedCb
    • serRDattrCb

     

    In all these events the sensor will be sending its first sensor reading to the collector.

     

    This could mean that the sensor restarted and REJOINED and has been requested a CONFIG message, or the collector Restarted and has REALIGNED, or it is the first boot up and it JOINED for the first time. Basically if you have 5, 10 ,20, 50 of these devices rejoining or joining at the same time and they all set the first reporting interval to the configured interval, you can imagine how many collision would happen, not only that but the collector will be busy joining all these devices at this time and will need some time to do so, and having data messages coming in at the same time will not aid in any way.

     

    This is why the first reporting interval of each sensor that joins are random, this decreases the possibility that all sensors send the data messages at the same time, every time.

    Cheers,

    Marie H.