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.

[参考译文] CC1200EMK-868-930:接收我发送的所有数据时遇到问题、具体取决于数据包长度

Guru**** 2555630 points
Other Parts Discussed in Thread: CC1200

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

https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz-group/sub-1-ghz/f/sub-1-ghz-forum/797871/cc1200emk-868-930-problems-receiving-all-of-my-sent-data-dependent-on-the-packet-length

器件型号:CC1200EMK-868-930
主题中讨论的其他器件:CC1200

您好!

我正在使用 ST Nucleo 微控制器来配置和使用 CC1200 EM 将数据传输到另一个连接到 TrxEB 板的 CC1200EM 芯片、该板使用 SmartRF 对数据包进行解码。 根据我使用的固定数据包长度大小、我将获得或多或少的发送总数据。 我使用固定的数据包长度配置。

例如、我正在发送数据包、该数据包的值从0到255不等。 如果我使用长度为6的数据包、我只能从0到114获取数据(总共19个数据包、预期~42个数据包)。 当我使用长度为15的数据包时、我会得到所有数据。 当我在15到15之间使用其他长度时、我不会获取我的所有数据。 在 SmartRF 中、值大于某个点(长度为6的数据包为114)的数据包似乎从未发送、或者由于某种原因无法接收。  

我的应用使用的数据包尺寸较小(每包小于10字节)、并且数据包的尺寸都相同、因此我希望它们配置为固定长度。 这是一个已知问题、还是缺少一些配置来确保发送所有数据。 我使用命令选通寄存器检查错误、并确保在 TX FIFO 错误的情况下返回到发送模式。  

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

    你(们)好

    我从中获取了 cc120x_ease_link 示例  并进行了修改、如下所示:

    #define ISR_ACT_REQUIRED 1
    #define ISR_IDLE 0
    
    #define PKTLEN 6
    #define GPIO3 0x04
    #define GPIO2 0x08
    #define GPIO0 0x80
    
    static uint8 packetSemaphore;
    static uint32 packetCounter、countValue = 0;
    
    static void initmcu (void);
    static void registerConfig (void);
    静态空 runTX (void);
    静态空 createPacket (uint8 randBuffer[]);
    静态空 radioTxISR (void);
    静态空 updateLcd (void);
    静态空 waitU (uint16 usec);
    静态空 waitM (uint16 msec);
    
    空 main (void){
    
    uint8 writeByte;
    
    //初始化 MCU 和外设
    initmc();
    
    //写入无线电寄存器
    registerConfig();
    
    writeByte = 0x00;//固定数据包长度
    cc120xSpiWriteReg (CC120X_PKT_CFG0、writeByte、1);
    
    writeByte = PKTLEN;//长度= PKTLEN
    cc120xSpiWriteReg (CC120X_PKT_LEN、writeByte、1);
    
    //输入 runTX,永不回来
    runTX();
    }
    
    静态空 runTX(void){
    //初始化大小为 PKTLEN + 1的数据包缓冲区
    uint8 txBuffer[PKTLEN]={0};
    
    //将 ISR 函数连接到 GPIO2
    ioPinIntRegister (IO_PIN_PORT_1、GPIO2、&radioTxISR);
    
    //下降沿上的中断
    ioPinIntTypeSet (IO_PIN_PORT_1、GPIO2、IO_PIN_FALLING_EDGE);
    
    //清除 ISR 标志
    ioPinIntClear (IO_PIN_PORT_1、GPIO2);
    
    //启用中断
    ioPinIntEnable (IO_PIN_PORT_1、GPIO2);
    
    //更新 LCD
    updateLcd();
    
    //无限循环
    while (true)
    {
    //更新数据包计数器
    packetCounter = 0;
    countValue = 0;
    
    while (!bspKeyPushed (bsp_key_all));
    
    while (packetCounter++<(256/PKTLEN)){
    for (uint8 i = 0;i < PKTLEN;i++){
    txBuffer[i]= countValue++;
    }
    
    cc120xSpiWriteTxFifo (txBuffer、sizeof (txBuffer));
    
    TrxSpiCmdStrobe (CC120X_STX);
    
    while (packetSemaphore!= ISR_ACT_REQUIRED);
    
    packetSemaphore = ISR_IDLE;
    
    updateLcd();
    候补 Ms(100);
    }
    }
    
    
    静态 void radioTxISR (void){
    
    //设置数据包信标
    packetSemaphore = isr_action_required;
    
    //清除 ISR 标志
    ioPinIntClear (IO_PIN_PORT_1、GPIO2);
    }
    
    静态空 initMCU (void){
    
    //初始化时钟和 I/O
    bspInit (BSP_SYS_CLK_8MHZ);
    
    //初始化 LED
    bspLedInit();
    
    //初始按钮
    bspKeyInit (bsp_key_mode_poll);
    
    //初始化到 LCD 的 SPI 接口(与 SPI 闪存共享)
    bspIoSpiInit (bsp_flash_lcd_spi、bsp_flash_lcd_spi_spd);
    
    //初始化 LCD
    lcdInit();
    
    //实例化连接到 SCLK ~ 4MHz 的收发器射频 SPI 接口
    //输入参数是时钟分频器
    // SCLK 频率= SMCLK/时钟分频器
    trxRfSpiInterfaceInit(2);
    
    //启用全局中断
    _BIS_SR (GIE);
    }
    
    静态空寄存器配置(空){
    
    uint8 writeByte;
    
    //重置无线电
    TrxSpiCmdStrobe (CC120X_SRES);
    
    //将寄存器写入无线电
    for (uint16 I = 0;
    i <(sizeof (preferredSettings)/sizeof (registerSetting_t));i++){
    writeByte = preferredSettings[i].data;
    cc120xSpiWriteReg (preferredSettings[i].addr、&writeByte、1);
    }
    }
    
    静态 void updateLcd (void){
    
    //更新 LDC 缓冲区并发送到屏幕。
    lcdBufferClear (0);
    lcdBufferPrintString (0、"EasyLink Test"、0、eLcdPage0);
    lcdBufferSetHLine (0、0、LCD_cols-1、7);
    lcdBufferPrintString (0、"发送的数据包:"、0、eLcdPage3);
    lcdBufferPrintInt (0、packetCounter、70、eLcdPage4);
    lcdBufferPrintString (0,“数据包 TX”,0,eLcdPage7);
    lcdBufferSetHLine (0、0、LCD_cols-1、55);
    lcdBufferInvertPage (0、0、LCD_cols、eLCDPage7);
    lcdSendBuffer (0);
    }
    
    #pragma optimizing=none
    static void waitU (uint16 usec){//调用5个周期
    
    //我们可以等待的最短时间是3微秒:
    //~1 μ s 用于调用,1用于第一个比较,1用于返回
    while (usec > 3){// 2个周期用于比较
    //跳转2个周期
    NOP(); // nop 为1个周期
    NOP(); // nop 为1个周期
    NOP(); // nop 为1个周期
    NOP(); // nop 为1个周期
    NOP(); // nop 为1个周期
    NOP(); // nop 为1个周期
    NOP(); // nop 为1个周期
    NOP(); // nop 为1个周期
    usec -= 2; //优化减量的1个周期
    }
    } //返回
    
    #pragma optimize=none
    静态空 waitMS (uint16 msec){4个周期
    while (msec-->0){
    waitU(1000);
    }
    }
    

    我在固定数据包长度模式下使用了 SmartRF Studio、并且能够接收所有数据包。

    BR

    Siri

    链接