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.

[参考译文] LP-CC1352P7:高级数据包格式

Guru**** 2535250 points


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

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/1563817/lp-cc1352p7-advanced-packet-format

器件型号:LP-CC1352P7


工具/软件:

我正在使用高级数据包格式进行数据发送和接收、但我可以发送的最大数据长度仅为 255 个字节。 根据手册、数据长度不应受限制。 您能告诉我我我的配置是否有问题吗? 配置和用法如下:

RFC_CMD_PROP_TX_ADV_t RF_cmdPropTxs Adv_Long Range_400bps =
  .commandNo = 0x3803
  .status = 0x0000
  .pNextOp = 0//插入适用指针:(UINT8_t*)&xxx
  .StartTime = 0x00000000
  .startTrigger.triggerType = 0x0
  .startTrigger.bEnaCmd = 0x0
  .startTrigger.triggerNo = 0x0
  .startTrigger.pastTrig = 0x0
  .condition.rule = 0x1
  .condition.nSkip = 0x0
  .pktConf.bFsOff = 0x0
  .pktConf.bUseCrc = 0x1
  .pktConf.bCrcIncSw = 0x0
  .pktConf.bCrcIncHdr = 0x0
  .numHdrBits = 0x0
  .pktLen = 0xFF
  .startConf.bExtTxTrig = 0x0
  .startConf.inputMode = 0x0
  .startConf.source = 0x0
  .preTrigger.triggerType = 0x0
  .preTrigger.bEnaCmd = 0x0
  .pretrigger.triggerNo = 0x0
  .pastTrigger.pastTrig = 0x0
  .Pretime = 0x0
  .syncWord = 0xFE6B2840
  .ppkt = 0 //插入适用指针:(Uint8_t*)&xxx
};

RFC_CMD_PROP_RX_ADV_t RF_cmdPropRxr Adv_Long Range_400bps =
  .commandNo = 0x3804
  .status = 0x0000
  .pNextOp = 0//插入适用指针:(UINT8_t*)&xxx
  .StartTime = 0x00000000
  .startTrigger.triggerType = 0x0
  .startTrigger.bEnaCmd = 0x0
  .startTrigger.triggerNo = 0x0
  .startTrigger.pastTrig = 0x0
  .condition.rule = 0x1
  .condition.nSkip = 0x0
  .pktConf.bFsOff = 0x0
  .pktConf.brepeatOk = 0x0
  .pktConf.brepeatNok = 0x0
  .pktConf.bUseCrc = 0x1
  .pktConf.bCrcIncSw = 0x0
  .pktConf.bCrcIncHdr = 0x0
  .pktConf.endType = 0x0
  .pktConf.filterOp = 0x0
  rxConf.bAutoFlushIgnored = 0x0
  .rxConf.bAutoFlushCrcErr = 0x0
  .rxConf.bIncludeHdr = 0x1
  .rxConf.bIncludeCrc = 0x0
  .rxConf.bAppendRssi = 0x0
  .rxConf.bAppendTimestamp = 0x0
  .rxConf.bAppendStatus = 0x1
  .syncWord0 = 0xFE6B2840
  .syncWord1 = 0x0
  .maxPktLen = 0xFF
  .hdrConf.numHdrBits = 0x0
  .hdrConf.lenPos = 0x0
  .hdrConf.numLenBits = 0x0
  .addrConf.addrType = 0x0
  .addrConf.addrSize = 0x0
  .addrConf.addrPos = 0x0
  .addrConf.numAddr = 0x0
  .lenOffset = 0
  .endTrigger.triggerType = 0x1
  .endTrigger.bEnaCmd = 0x0
  .endTrigger.triggerNo = 0x0
  .endTrigger.pastTrig = 0x0
  .EndTime = 0x00000000
  .pAddr = 0
  .pQueue = 0//插入适用指针:(dataQueue_t*)&xxx
  .pOutput = 0 //插入适用的指针:(Uint8_t*)&xxx
};
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

     packet_tx 代码如下所示:

        RF_cmdPropTxAdv.startTriggerType = TRIG_NOW;
        RF_cmdPropTxAdv.numHdrBits = 0
        RF_cmdPropTxAdv.pktLen =(uint8_t)(pktLen))+ 2
        RF_cmdPropTxAdv.pPKt = txPacket;

        
    packet_rx 代码如下所示:

        rf_cmdPropRxAdv.pQueue =&dataQueue;
        RF_cmdPropRxAdv.rxConf.bAutoFlushIgnored = 1
        RF_cmdPropRxAdv.rxConf.bAutoFlushCrcErr = 1
        RF_cmdPropRxAdv.maxPktLen = RADIO_MAX_LENGTH;
        RF_cmdPropRxAdv.pktConf.brepeatOk = 1
        RF_cmdPropRxAdv.pktConf.brepeatNok = 1
        rf_cmdPropRxAdv.pOutput =(uint8_t*)&rxStatisticsProp;

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

    不确定您使用的 PHY(400bps??) 由于 SLR PHY 中的数据速率为 2.5kbps 或 5kbps(它们有一个固定的同步字(不是 0xFE6B2840) ):

    https://www.ti.com/lit/swra642

    假设您使用我们的某个 SLR PHY、则可以使用以下代码来传输长度字节为 2 个字节而不是 1 的数据包:

    TX:

    /***** Includes *****/
    /* Standard C Libraries */
    #include <stdlib.h>
    #include <unistd.h>
    
    /* TI Drivers */
    #include <ti/drivers/rf/RF.h>
    #include <ti/drivers/GPIO.h>
    
    /* Driverlib Header files */
    #include DeviceFamily_constructPath(driverlib/rf_prop_mailbox.h)
    
    /* Board Header files */
    #include "ti_drivers_config.h"
    #include <ti_radio_config.h>
    
    /***** Defines *****/
    
    // Packet TX Configuration
    #define SIZE_OF_LENGHT_FIELD    2
    #define PAYLOAD_LENGTH          400
    
    #define PACKET_INTERVAL         500000  // Set packet interval to 500000 us or 500 ms
    
    static RF_Object rfObject;
    static RF_Handle rfHandle;
    
    static uint8_t packet[SIZE_OF_LENGHT_FIELD + PAYLOAD_LENGTH];
    static uint16_t seqNumber;
    
    void *mainThread(void *arg0)
    {
        RF_Params rfParams;
        RF_Params_init(&rfParams);
    
        GPIO_setConfig(CONFIG_GPIO_GLED, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
    
        GPIO_write(CONFIG_GPIO_GLED, CONFIG_GPIO_LED_OFF);
    
        RF_cmdPropTxAdv.pktLen = PAYLOAD_LENGTH + SIZE_OF_LENGHT_FIELD;
        RF_cmdPropTxAdv.pPkt = packet;
        RF_cmdPropTxAdv.startTrigger.triggerType = TRIG_NOW;
        RF_cmdPropTxAdv.condition.rule = 1;
        RF_cmdPropTxAdv.pktConf.bUseCrc = 1;
    
        // Request access to the radio
        rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdPropRadioDivSetup, &rfParams);
    
        // Set the frequency
        RF_postCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0);
    
        while(1)
        {
            packet[0] = (uint8_t)(PAYLOAD_LENGTH);
            packet[1] = (uint8_t)(PAYLOAD_LENGTH >> 8);
    
            for (uint16_t i = 2; i < PAYLOAD_LENGTH + SIZE_OF_LENGHT_FIELD; i++)
            {
                packet[i] = i - 1;
            }
    
            // Send packet
            RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropTxAdv, RF_PriorityNormal, NULL, 0);
    
            GPIO_toggle(CONFIG_GPIO_GLED);
    
            // Power down the radio
            RF_yield(rfHandle);
    
            // Sleep for PACKET_INTERVAL us
            usleep(PACKET_INTERVAL);
        }
    }

    接收:

    /***** Includes *****/
    /* Standard C Libraries */
    #include <stdlib.h>
    
    /* TI Drivers */
    #include <ti/drivers/rf/RF.h>
    #include <ti/drivers/GPIO.h>
    
    /* Driverlib Header files */
    #include DeviceFamily_constructPath(driverlib/rf_prop_mailbox.h)
    
    /* Board Header files */
    #include "ti_drivers_config.h"
    
    /* Application Header files */
    #include "RFQueue.h"
    #include <ti_radio_config.h>
    
    /***** Defines *****/
    
    #define DATA_ENTRY_HEADER_SIZE 8    // Constant header size of a Generic Data Entry
    #define NUM_DATA_ENTRIES       2    // NOTE: Only two data entries supported at the moment
    
    #define SIZE_OF_LENGHT_FIELD   2
    
    // Optional appended bytes at the end of the packet
    //  -------------------------------------------------------
    //  | CRC1 | CRC0 | RSSI | TS0 | TS1 | TS2 | TS3 | Status |
    //  -------------------------------------------------------
    
    #define CRC                     0   // 2 if .rxConf.bIncludeCrc = 0x1, 0 otherwise
    #define RSSI                    0   // 1 if .rxConf.bAppendRssi = 0x1, 0 otherwise
    #define TIMESTAMP               0   // 4 if .rxConf.bAppendTimestamp = 0x1, 0 otherwise
    #define STATUS                  0   // 1 if .rxConf.bAppendStatus = 0x1, 0 otherwise
    
    #define NUM_APPENDED_BYTES      SIZE_OF_LENGHT_FIELD + CRC + RSSI + TIMESTAMP + STATUS
    
    #define MAX_LENGTH              400 // Max length byte the radio will accept
    
    static void callback(RF_Handle h, RF_CmdHandle ch, RF_EventMask e);
    
    static RF_Object rfObject;
    static RF_Handle rfHandle;
    
    /* Buffer which contains all Data Entries for receiving data.
     * Pragmas are needed to make sure this buffer is 4 byte aligned (requirement from the RF Core) */
    static uint8_t rxDataEntryBuffer[RF_QUEUE_DATA_ENTRY_BUFFER_SIZE(NUM_DATA_ENTRIES,
                                                                     MAX_LENGTH,
                                                                     NUM_APPENDED_BYTES)]
                                                                     __attribute__((aligned(4)));
    // Receive dataQueue for RF Core to fill in data
    dataQueue_t dataQueue;
    rfc_dataEntryGeneral_t* currentDataEntry;
    uint16_t packetLength;
    uint8_t* packetDataPointer;
    rfc_propRxOutput_t rxStatistics;
    
    uint8_t packet[MAX_LENGTH + NUM_APPENDED_BYTES - SIZE_OF_LENGHT_FIELD]; // Length is stored separately
    
    void *mainThread(void *arg0)
    {
        RF_Params rfParams;
        RF_Params_init(&rfParams);
    
        GPIO_setConfig(CONFIG_GPIO_RLED, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
        GPIO_write(CONFIG_GPIO_RLED, CONFIG_GPIO_LED_OFF);
    
        if( RFQueue_defineQueue(&dataQueue,
                                rxDataEntryBuffer,
                                sizeof(rxDataEntryBuffer),
                                NUM_DATA_ENTRIES,
                                MAX_LENGTH + NUM_APPENDED_BYTES))
        {
            // Failed to allocate space for all data entries
            while(1);
        }
    
        // Modify CMD_PROP_RX command for application needs
        // Set the Data Entity queue for received data
        RF_cmdPropRxAdv.pQueue = &dataQueue;
        // Discard ignored packets from Rx queue
        RF_cmdPropRxAdv.rxConf.bAutoFlushIgnored = 1;
        // Discard packets with CRC error from Rx queue
        RF_cmdPropRxAdv.rxConf.bAutoFlushCrcErr = 1;
        // Implement packet length filtering to avoid PROP_ERROR_RXBUF
        RF_cmdPropRxAdv.maxPktLen = MAX_LENGTH;
        RF_cmdPropRxAdv.pktConf.bRepeatOk = 1;
        RF_cmdPropRxAdv.pktConf.bRepeatNok = 1;
        RF_cmdPropRxAdv.pOutput = (uint8_t*)&rxStatistics;
        RF_cmdPropRxAdv.condition.rule = 1;
        RF_cmdPropRxAdv.pktConf.bUseCrc = 0x1;
        RF_cmdPropRxAdv.rxConf.bIncludeHdr = 0x1;
        RF_cmdPropRxAdv.endTrigger.triggerType = 0x1;
        RF_cmdPropRxAdv.pktConf.bCrcIncHdr = 0x1;
        RF_cmdPropRxAdv.hdrConf.numHdrBits = 16;
        RF_cmdPropRxAdv.hdrConf.numLenBits = 16;
    
        // Optional bytes to append:
        RF_cmdPropRxAdv.rxConf.bIncludeCrc = 0x0;
        RF_cmdPropRxAdv.rxConf.bAppendRssi = 0x0;
        RF_cmdPropRxAdv.rxConf.bAppendTimestamp = 0x0;
        RF_cmdPropRxAdv.rxConf.bAppendStatus = 0x0;
    
        // Request access to the radio
        rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdPropRadioDivSetup, &rfParams);
    
        // Set the frequency
        RF_postCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0);
    
        RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropRxAdv, RF_PriorityNormal, &callback, RF_EventRxEntryDone);
    
        while(1);
    }
    
    void callback(RF_Handle h, RF_CmdHandle ch, RF_EventMask e)
    {
        if (e & RF_EventRxEntryDone)
        {
            // Toggle pin to indicate RX
            GPIO_toggle(CONFIG_GPIO_RLED);
    
            // Get current unhandled data entry
            currentDataEntry = RFQueue_getDataEntry();
    
            packetLength = ((uint16_t)((*(uint8_t*)(&currentDataEntry->data+1)) << 8) | (uint16_t)(*(uint8_t*)(&currentDataEntry->data)));
            packetDataPointer = (uint8_t*)(&currentDataEntry->data + SIZE_OF_LENGHT_FIELD);
    
            // Copy the payload and the status bytes to the packet variable
            memcpy(packet, packetDataPointer, (packetLength + NUM_APPENDED_BYTES - SIZE_OF_LENGHT_FIELD));
    
            RFQueue_nextEntry();
        }
    }
    

    代码经过测试、可按预期运行。

    Siri

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

    感谢您的答复,Siri

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

    尊敬的、Siri:

    我们当前正在使用自定义物理层、希望传输 54528 字节。 我们应该如何配置同步字等参数?

    此致。

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

    首先、如果您使用 SLR 模式、则无法更改同步字(请参阅)  

    CC13xx 远距离模式)

    其次、即使您有 2 个可用的长度字节、调制解调器中的内部限制将此限制为 8191 字节(包括标头和 CRC)。

    发送非常长的数据包通常是一个不好的主意、因为“数据包错误率“会随着数据包长度的增加而增加。

    Siri

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

    非常感谢、 Siri

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

    嗨、Siri

    我们使用 “0000:未编码的二进制调制“的 fecMode、是否可以修改同步字? 如何根据“CC13xx 远距离模式“模式 1 设置 64 位同步字?

    此致。

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

    嗨、Siri

    如何发送 8000 字节? 我们对它进行了 750 字节的测试。

    此致。

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

    使用远距离模式 PHY 时无法更改 fecMode。

    您也无法更改同步字。 请阅读我链接到的文档:

    “模式 1 — 传统远距离数据包格式

    模式 1 使用标准前导码序列 (010101..) 然后是 固定的 64 位同步字。 模式 1 中使用的 64 位同步字为 0xFFE_2840_0194_D7BF、LSB 在前。 该同步字不可由用户编程

    Siri

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

    最大长度 需要小于 4096(不是我第一次写入的 8191) 

    这包括 CRC、因此 在 TX 中可以设置

    #define PAYLOAD_LENGTH      4093.

    和 RX 输入

    #define MAX_LENGTH        4093.

    我已使用 2.5kbps SLR 模式对此进行了测试、它可以按预期工作。

    Siri

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

    感谢您的答复、Siri

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

    嗨、Siri

    此外,最大符号速率是多少?

    我们测试了 3200 符号速率、 运行顺利、当符号速率大于它时、例如 48000、会收到大数字错误。

    此致。

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

     应用手册中说明了 LRM 的建议运行限值、我提到过几次 (https://www.ti.com/lit/swra642)

    Siri