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.

[参考译文] CC1310:数据包传输时间过长

Guru**** 2482225 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz-group/sub-1-ghz/f/sub-1-ghz-forum/1210978/cc1310-packet-transmission-time-is-too-long

器件型号:CC1310

嗨、团队;

根据 TI 15.4中的收集器和传感器例程、我现在要通过传感器、每秒向收集器发送一个包含100个 ADC 数据的数据包。

不过、我发现在实际传输过程中、数据包传输时间远长于一秒、

因此、我想问一下是否有相应的解决方案。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    在传感器部分、我将原来的发送温度数据部分替换为发送100个 ADC 数据。 从代码中可以看到、以下是从传感器到收集器发送数据部分的代码。 可以成功发送数据、但两次传输之间的时间间隔太长、无法完全满足工程要求。

    static void processSensorMsgEvt(void)
    {
    Smsgs_sensorMsg_t sensor;
    uint32_t stat;
    
    memset(&sensor, 0, sizeof(Smsgs_sensorMsg_t));
    
    ApiMac_mlmeGetReqUint32(ApiMac_attribute_diagRxSecureFail, &stat);
    Sensor_msgStats.rxDecryptFailures = (uint16_t)stat;
    
    ApiMac_mlmeGetReqUint32(ApiMac_attribute_diagTxSecureFail, &stat);
    Sensor_msgStats.txEncryptFailures = (uint16_t)stat;
    
    ApiMac_mlmeGetReqArray(ApiMac_attribute_extendedAddress,
    sensor.extAddress);
    
    /* fill in the message */
    sensor.frameControl = configSettings.frameControl;
    if(sensor.frameControl & Smsgs_dataFields_tempSensor)
    {
    
    memcpy(&sensor.tempSensor, &tempSensor,
    sizeof(Smsgs_tempSensorField_t));
    }
    if(sensor.frameControl & Smsgs_dataFields_lightSensor)
    {
    memcpy(&sensor.lightSensor, &lightSensor,
    sizeof(Smsgs_lightSensorField_t));
    }
    if(sensor.frameControl & Smsgs_dataFields_humiditySensor)
    {
    memcpy(&sensor.humiditySensor, &humiditySensor,
    sizeof(Smsgs_humiditySensorField_t));
    }
    if(sensor.frameControl & Smsgs_dataFields_msgStats)
    {
    memcpy(&sensor.msgStats, &Sensor_msgStats,
    sizeof(Smsgs_msgStatsField_t));
    }
    if(sensor.frameControl & Smsgs_dataFields_configSettings)
    {
    sensor.configSettings.pollingInterval = configSettings.pollingInterval;
    sensor.configSettings.reportingInterval = configSettings
    .reportingInterval;
    }
    
    /* inform the user interface */
    Ssf_sensorReadingUpdate(&sensor);
    
    /* send the data to the collector */
    sendSensorMessage(&collectorAddr, &sensor);
    }
    
    static bool sendSensorMessage(ApiMac_sAddr_t *pDstAddr, Smsgs_sensorMsg_t *pMsg)
    {
    bool ret = false;
    uint8_t *pMsgBuf;
    uint16_t len = SMSGS_BASIC_SENSOR_LEN;
    
    /* Figure out the length */
    if(pMsg->frameControl & Smsgs_dataFields_tempSensor)
    {
    len += SMSGS_SENSOR_TEMP_LEN;
    }
    if(pMsg->frameControl & Smsgs_dataFields_lightSensor)
    {
    len += SMSGS_SENSOR_LIGHT_LEN;
    }
    if(pMsg->frameControl & Smsgs_dataFields_humiditySensor)
    {
    len += SMSGS_SENSOR_HUMIDITY_LEN;
    }
    if(pMsg->frameControl & Smsgs_dataFields_msgStats)
    {
    //len += SMSGS_SENSOR_MSG_STATS_LEN;
    len += sizeof(Smsgs_msgStatsField_t);
    }
    if(pMsg->frameControl & Smsgs_dataFields_configSettings)
    {
    len += SMSGS_SENSOR_CONFIG_SETTINGS_LEN;
    }
    
    pMsgBuf = (uint8_t *)Ssf_malloc(len);
    if(pMsgBuf)
    {
    uint8_t *pBuf = pMsgBuf;
    
    *pBuf++ = (uint8_t)Smsgs_cmdIds_sensorData;
    
    memcpy(pBuf, pMsg->extAddress, SMGS_SENSOR_EXTADDR_LEN);
    pBuf += SMGS_SENSOR_EXTADDR_LEN;
    
    pBuf = Util_bufferUint16(pBuf,pMsg->frameControl);
    
    /* Buffer data in order of frameControl mask, starting with LSB */
    if(pMsg->frameControl & Smsgs_dataFields_tempSensor)
    {
    for(int i=0;i<100;i++){
    pBuf = Util_bufferUint16(pBuf, pMsg->tempSensor.ambienceTemp[i]);
    }
    //pBuf = Util_bufferUint16(pBuf, pMsg->tempSensor.ambienceTemp);
    //pBuf = Util_bufferUint16(pBuf, pMsg->tempSensor.objectTemp);
    }
    if(pMsg->frameControl & Smsgs_dataFields_lightSensor)
    {
    pBuf = Util_bufferUint16(pBuf, pMsg->lightSensor.rawData);
    }
    if(pMsg->frameControl & Smsgs_dataFields_humiditySensor)
    {
    pBuf = Util_bufferUint16(pBuf, pMsg->humiditySensor.temp);
    pBuf = Util_bufferUint16(pBuf, pMsg->humiditySensor.humidity);
    }
    if(pMsg->frameControl & Smsgs_dataFields_msgStats)
    {
    pBuf = Util_bufferUint16(pBuf, pMsg->msgStats.joinAttempts);
    pBuf = Util_bufferUint16(pBuf, pMsg->msgStats.joinFails);
    pBuf = Util_bufferUint16(pBuf, pMsg->msgStats.msgsAttempted);
    pBuf = Util_bufferUint16(pBuf, pMsg->msgStats.msgsSent);
    pBuf = Util_bufferUint16(pBuf, pMsg->msgStats.trackingRequests);
    pBuf = Util_bufferUint16(pBuf,
    pMsg->msgStats.trackingResponseAttempts);
    pBuf = Util_bufferUint16(pBuf,
    pMsg->msgStats.trackingResponseSent);
    pBuf = Util_bufferUint16(pBuf, pMsg->msgStats.configRequests);
    pBuf = Util_bufferUint16(pBuf,
    pMsg->msgStats.configResponseAttempts);
    pBuf = Util_bufferUint16(pBuf,
    pMsg->msgStats.configResponseSent);
    pBuf = Util_bufferUint16(pBuf,
    pMsg->msgStats.channelAccessFailures);
    pBuf = Util_bufferUint16(pBuf, pMsg->msgStats.macAckFailures);
    pBuf = Util_bufferUint16(pBuf,
    pMsg->msgStats.otherDataRequestFailures);
    pBuf = Util_bufferUint16(pBuf, pMsg->msgStats.syncLossIndications);
    pBuf = Util_bufferUint16(pBuf, pMsg->msgStats.rxDecryptFailures);
    pBuf = Util_bufferUint16(pBuf, pMsg->msgStats.txEncryptFailures);
    pBuf = Util_bufferUint16(pBuf, Ssf_resetCount);
    pBuf = Util_bufferUint16(pBuf, Ssf_resetReseason);
    pBuf = Util_bufferUint16(pBuf, pMsg->msgStats.joinTime);
    pBuf = Util_bufferUint16(pBuf, pMsg->msgStats.interimDelay);
    pBuf = Util_bufferUint16(pBuf, pMsg->msgStats.numBroadcastMsgRcvd);
    pBuf = Util_bufferUint16(pBuf, pMsg->msgStats.numBroadcastMsglost);
    pBuf = Util_bufferUint16(pBuf, pMsg->msgStats.avgE2EDelay);
    pBuf = Util_bufferUint16(pBuf, pMsg->msgStats.worstCaseE2EDelay);
    }
    if(pMsg->frameControl & Smsgs_dataFields_configSettings)
    {
    pBuf = Util_bufferUint32(pBuf,
    pMsg->configSettings.reportingInterval);
    pBuf = Util_bufferUint32(pBuf,
    pMsg->configSettings.pollingInterval);
    
    }
    
    ret = Sensor_sendMsg(Smsgs_cmdIds_sensorData, pDstAddr, true, len, pMsgBuf);
    if(ret == true){
    LCD_WRITE_STRING("Data Success Send", 2);
    }
    else{
    LCD_WRITE_STRING("Data Success Failed", 2);
    }
    
    Ssf_free(pMsgBuf);
    }
    
    return (ret);
    }
    
    Smsgs_tempSensorField_t修改后的结构
    
    typedef struct _Smsgs_tempsensorfield_t
    {
    /*!
    Ambience Chip Temperature - each value represents a 0.01 C
    degree, so a value of 2475 represents 24.75 C.
    */
    uint16_t ambienceTemp[100];
    /*!
    Object Temperature - each value represents a 0.01 C
    degree, so a value of 2475 represents 24.75 C.
    */
    //int16_t objectTemp;
    } Smsgs_tempSensorField_t;

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Alex:  

    您是否调整了传感器的报告间隔? 您是说此消息的 TX 时间本身超过1秒吗?

    此致、

    SID

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    是的,我调节发送消息的时间间隔,以每秒发送一次数据消息。 具体代码如下:

    /////the part of sensor Configuration of time
    
    /*! Default Polling interval in milliseconds. It will get updated upon reception
    of a config request message */
    #define CONFIG_POLLING_INTERVAL 6000
    /*! PAN Advertisement Solicit trickle timer duration in milliseconds */
    #define CONFIG_PAN_ADVERT_SOLICIT_CLK_DURATION 6000
    /*! PAN Config Solicit trickle timer duration in milliseconds */
    #define CONFIG_PAN_CONFIG_SOLICIT_CLK_DURATION 6000
    /*! Default Reporting Interval - in milliseconds. It will get updated upon
    reception of a config request message */
    #define CONFIG_REPORTING_INTERVAL 1000
    #else
    /*! Default Polling interval in milliseconds. It will get updated upon reception
    of a config request message */
    #define CONFIG_POLLING_INTERVAL 60000
    /*! PAN Advertisement Solicit trickle timer duration in milliseconds */
    #define CONFIG_PAN_ADVERT_SOLICIT_CLK_DURATION 60000
    /*! PAN Config Solicit trickle timer duration in milliseconds */
    #define CONFIG_PAN_CONFIG_SOLICIT_CLK_DURATION 60000
    /*! Default Reporting Interval - in milliseconds. It will get updated upon
    reception of a config request message */
    #define CONFIG_REPORTING_INTERVAL 600000
    
    
    
    
    
    
    
    
    
    
    
    //////the part of collector Configuration of time
    
    /*!
    Reporting Interval - in milliseconds to be set on connected devices using
    configuration request messages
    */
    #define CONFIG_REPORTING_INTERVAL 90000
    /*!
    Polling interval in milliseconds to be set on connected devices using
    configuration request messages. Must be greater than or equal to default
    polling interval set on sensor devices
    */
    #define CONFIG_POLLING_INTERVAL 6000
    /*!
    Time interval in ms between tracking message intervals
    */
    #define TRACKING_DELAY_TIME 60000
    #else
    /*!
    Reporting Interval - in milliseconds to be set on connected devices using
    configuration request messages
    */
    #define CONFIG_REPORTING_INTERVAL 1000
    /*!
    Polling interval in milliseconds to be set on connected devices using
    configuration request messages. Must be greater than or equal to default
    polling interval set on sensor devices
    */
    #define CONFIG_POLLING_INTERVAL 60000
    /*!
    Time interval in ms between tracking message intervals
    */
    #define TRACKING_DELAY_TIME 300000

    通过以下函数'csf_deviceSensorDataUpdate (&pDataInd->srcAddr、pDataInd->RSSI、
    sensorData);"" 打印数据。

    "我发现在两块开发板上编写程序时、首次上电时、可以通过串行端口每秒打印一次 ADC 数据

    但是、在"Configrap:0x1"出现后、两个开发板之间的数据包传输通常变得相对简单

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Alex:

    我认为您的答案不完整。 在 ConfigRsp:0x1之后您看到了什么行为? 设备是否停止响应? 到底发生了什么?

    此致、
    SID

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    嗨、团队:

     对不起,它变得更慢。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Alex:

    我尝试了以下方法。 在默认收集器、传感器项目中、我只将收集器和传感器中的报告间隔更改为1000。  

    这会导致传感器每秒报告一次。 这可以通过绿色 LED 切换间隔来看出。  

    因此、请 检查 是否由于您的应用更改而出现了延迟。

    我建议您首先使用默认应用程序、使报告间隔为1000ms。 然后添加 ADC 数据变化。

    如果由于函数中添加的 for 循环而确实出现了延迟,则可能应该将数据缓冲到该函数之外,并在进程中简单地传输 SensorMsgEvt()

    此致、

    SID

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    谢谢你