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-CC1310:尝试在rfPacketRx中将收到的数据包写入UART,但无法解析奇怪的字符

Guru**** 2581345 points
Other Parts Discussed in Thread: CC1310, CC1000

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

https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz-group/sub-1-ghz/f/sub-1-ghz-forum/1086318/launchxl-cc1310-trying-to-write-received-packet-to-uart-in-rfpacketrx-but-can-t-resolve-weird-characters

部件号:LAUNCHTXL-CC1310
主题中讨论的其他部件:CC1310CC1000

大家好,

我正在处理一个项目,我从CC1310上的旧CC1000发送器接收数据,并在rfPacketRx示例中解包和解码这些数据。

我在观看'packet'表达式时正确地收到了我的数据包。 我应该收到以下十六进制数据包:

66 55 66 A6 A5 59 AA 55 55 55 55 99

下图是我正在观看数据包表达。 当将 我收到的十进制数转换回十六进制时,它们与我的数据包对应,因此我知道它是正确接收的:

但是,当我尝试将数据包变量写入UART时,它会写入char值。 通常这不是问题,但正如您在上看到的,例如packet[2],我收到非常奇怪的值"\xa6",它不是真正的字符值。

我的问题是:如何打印十进制值?  

提前感谢。

KR,

Mirte H

下面是我使用的代码(rfPacketRx.C):

/***** 包括***** /
/*标准C库*/
#include <stdlib.h>
#include <stdint.h>
#include <stddef.h>

/* TI驱动程序*/
#include <ti/drivers/RF/RF.h>
#include <ti/drivers/PIN.h>
#include <ti/drivers/UART.h>
#include <ti/drivers/GPIC.h>

/* Driverlib Header文件*/
#include DeviceFamily_construtPath(driverlib/RF_prop_mailbox.h)

/*主板标题文件*/
包含"Board.h"

/*应用程序头文件*/
#include "RFQueue.h"
包括"SmartRF_settings/SmartRF_settings.h"

/***** 定义***** /

/*数据包RX配置*/
#define data_entry_header_size 15 /*通用数据条目的常量标头大小*/
#define MAX_LENGTH 18 /*对讲机将接受的最大长度字节*/
#define NUM_DATA_entries 20 /*注:目前仅支持两个数据条目*/
#define NUM_appended_bytes 2/*数据条目数据字段将包含:
* 1标头字节(RF_cmdProprx.rxConf.bIncludeHdr = 0x1)
*最多30个有效负载字节
* 1状态字节(RF_cmdProprx.rxConf.bAppendStatus = 0x1)*/

/***** 原型***** /
静态空回调(RF_handle h,RF_CmdHandle ch,RF_EventMask e);

/***** 变量声明***** /
静态RF_Object rfObject;
static RF_handle rfHandle;

/*插针拆装器手柄*/
static PIN_handle ledPinHandle;
static PIN_State ledPinState;

/*缓冲区,包含用于接收数据的所有数据条目。
*需要pragma以确保此缓冲区是4字节对齐的(RF内核的要求)*/
#if defined(__TI_Compiler_version__)
#pragma data_align (rxDataEntryBuffer, 4);
静态uint8_t.
rxDataEntryBuffer[RF_QUEUE_DATA_Entry_BUFFER_SIZE (NUM_DATA_entries,
max_length,
num_appended_bytes)];
#Elif已定义(__IAR_SYSTEMS _ICC__)
#pragma data_alignment = 4
静态uint8_t.
rxDataEntryBuffer[RF_QUEUE_DATA_Entry_BUFFER_SIZE (NUM_DATA_entries,
max_length,
num_appended_bytes)];
#Elif已定义(__GMNU__)
静态uint8_t.
rxDataEntryBuffer[RF_QUEUE_DATA_Entry_BUFFER_SIZE (NUM_DATA_entries,
max_length,
num_appended_bytes)]
__attribute__((已对齐(4)));
#否则
错误不支持此编译器。
#endif

/*接收数据RF内核要填充数据的队列*/
静态数据Queue_t数据队列;
静态RFC_dataEntryGeneral _t* currentDataEntry;
静态uint8_t packetLength;
静态uint8_t* packetDataPointer;


static uint8_t packet[MAX_length + NUM_appended_bytes -1];/*长度字节存储在单独的变量*/中

/*
*应用LED引脚配置表:
*-所有LED板指示灯均熄灭。
*/
PIN_Config pin表[]=

Board_PIN_LED2 | PIN_GPIO输出_EN | PIN_GPIO低| PIN_PushPull | PIN_DRVSTR_MAX,
PIN_TERMINATE
};

/***** 函数定义***** /


void packetToUart(uint8_t pckt[]);


void packetToUart(uint8_t pckt[]){
UART_HANDLE UART;
UART_Params uartParams;

/*调用驱动程序初始化函数*/

UART_INIT();

/*创建数据处理关闭的UART。 */
UART_PARAM_INIT (&uartParams);
uartParams.writeDataMode = UART_DATA_binary;
uartParams.baudrate = 4800;

UART = UART_OPEN (Board_UART0,&uartParams);

IF (UART ==空){
/* UART_OPEN ()失败*/
同时(1);
}


// uint8_t* print[]={&pckt[0]};
UART_WRITE (UART,&pckt[0],12);
UART_WRITE (UART,"\n",2);

}

void *mainThread(void *arg0)

RF_Params rfParams;
rf_params_init(&rfParams);

/* LED针脚开路*/
ledPinHandle = PIN_OPEN (&ledPinState,PinTable);
IF (ledPinHandle ==空)

同时(1);
}

IF( RFQueue_DefineQueue(&dataQueue,
rxDataEntryBuffer,
sizeof(rxDataEntryBuffer),
num_data_entries,
max_length + NUM_appended_bytes))

/*无法为所有数据条目分配空间*/
同时(1);
}

/*修改CMD_PROP_RX命令以满足应用程序需求*/
/*设置接收数据的数据实体队列*/
rf_cmdProprx.pQueue =数据队列;

RF_cmdProprx.pktConf.bRepeatOk = 1;
RF_cmdProprx.pktConf.bRepeatNok = 1;

/*请求访问对讲机*/
#IF已定义(DeviceFamily_CC26X0R2)
rfHandle = RF_OPEN (&rfObject,&RF_prop,(RF_RadioSetup*)&RF_cmdPropRadioSetup,&rfParams);
#否则
rfHandle = RF_OPEN (&rfObject,&RF_prop,(RF_RadioSetup*)&RF_cmdPropRadioDivSetup,&rfParams);
#endif// DeviceFamily_CC26X0R2

/*设置频率*/
RF_postCmd (rfHandle,(RF_Op*)&RF_cmdF,RF_PriorityNormal,NULL,0);

/*进入RX模式并永久保持RX */
RF_EventMask终结符Reason = RF_runCmd (rfHandle,(RF_Op*)&RF_cmdPropRx,
RF_PriorityNormal,回调(&C),
RF_EventRxEntryDone);

交换机(终端原因)

案例RF_EventLastCmdDone:
//独立对讲机操作命令或最后一个对讲机
//链中的操作命令已完成。
中断;
案例RF_EventCmdlet已取消:
//命令在启动之前被取消;可能会导致该问题
//由RF_cancelCmd()或RF_FlushCmd()。
中断;
案例RF_EventCmdlet已中止:
//由RF_cancelCmd()或引起的突然命令终止
// RF_flushCmd()。
中断;
案例RF_EventCmdlet:
//由RF_cancelCmd ()或引起的正常命令终止
// RF_flushCmd()。
中断;
默认:
//未捕获的错误事件
同时(1);
}

UINT32_t cmdStatus =((volatile RF_Op*)&RF_cmdProprx)->状态;
交换机(cmdStatus)

案例PROP_DON_OK:
//通过CRC接收的数据包正常
中断;
案例PROP_DON_RXERR:
//收到数据包时出现CRC错误
中断;
Case PROP_DON_RXTIMEOUT:
//同步搜索时观察到的结束触发器
中断;
案例PROP_DON_Break:
//在接收数据包时,当命令为时,观察到的结束触发器
//配置了endType设置为1
中断;
问题PROP_DON_END_END_END_END:
//在观察结束触发后收到的数据包;如果是
//命令配置为endType设置为0,即结束触发器
//不会终止正在进行的接收
中断;
案例PROP_DON_STOPPED:
//命令启动后收到CMD_STOP,如果找到同步,
//接收数据包
中断;
案例PROP_DON_ABORT:
//命令启动后收到CMD_ABORT
中断;
案例PROP_ERROR_RXBUF:
//没有足够大的RX缓冲区可用于接收到的数据
//数据包的开始
中断;
案例PROP_ERROR_RXFULL:
//接收部分读取时RX缓冲空间不足
中断;
问题PROP_ERROR_PAR:
//观察到的非法参数
中断;
案例PROP_ERROR_NO_SETUP:
//在支持的中发送命令,但未设置对讲机
//模式使用CMD_PROP_RADIO_SETUP或CMD_RADIO_SETUP
中断;
案例PROP_ERROR_NO_FS:
//发送的命令没有对合成器进行编程
中断;
案例PROP_ERROR_RXOVF:
//操作期间观察到RX溢出
中断;
默认:
//未捕获的错误事件-这些可能来自
// rf_mailbox.h中定义的状态池
同时(1);
}

同时(1);
}

void callback (RF_handle h,RF_CmdHandle ch,RF_EventMask e)

IF (E和RF_EventRxEntryDone)


/*切换引脚以指示RX */
PIN_setOutputValue (ledPinHandle,Board_PIN_LED2,
!PIN_getOutputValue(Board_PIN_LED2);

/*获取当前未处理的数据输入*/
currentDataEntry = RFQueue_getDataEntry ();

/*处理分组数据,位于&currentDataEntry -> data:
*-长度是当前配置的第一个字节
*-数据从第二个字节*/开始
packetLength =*(uint8_t*)(&currentDataEntry -> data);
packetDataPointer =(uint8_t*)(&currentDataEntry -> data +1);

/*将有效负载+状态字节复制到数据包变量*/
memcpy (packet,packetDataPointer,(packetLength + 1));

PacketToUart(packet);

RFQueue_nextEntry();
}
}

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

    您可以使用显示驱动程序为您执行格式化。

    有关如何使用驱动程序的信息,请参见SDK中的显示示例:

    您可以执行如下操作:

     // Numbers to be printed
     uint8_t numbers[3] = {10, 15, 20};
     
     uint8_t i = 0;
     
     for (i = 0; i < 3; i++)
      {
         Display_printf(hSerial, i, 0, "%u", numbers[i]);
     }

    Siri

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

    您好,Siri,

    感谢您的回复。 但是,我希望稍后使用格式化的数字对其进行一些计算,我该如何进行?

    您的提示在串行显示屏上有效,但现在我的代码在打印一个值后冻结。 我制作了一个简单的版本,它只打印一个简单的值,并在完成后切换一个LED,但它停留在" Display_printf (hSerial,1,1, "Hello Serial!")";",我似乎不知道如何或为什么。 你有什么想法吗?

    我在 下面附上了我的新rfPacketRX代码。

    再次感谢!

    KR,

    Mirte H

    /***** Includes *****/
    /* Standard C Libraries */
    #include <stdlib.h>
    #include <stdint.h>
    #include <stddef.h>
    
    /* TI Drivers */
    #include <ti/drivers/rf/RF.h>
    #include <ti/drivers/PIN.h>
    //#include <ti/drivers/UART.h>
    #include <ti/drivers/GPIO.h>
    #include <ti/display/Display.h>
    #include <ti/display/DisplayUart.h>
    #include <ti/display/DisplayExt.h>
    #include <ti/display/AnsiColor.h>
    
    /* Driverlib Header files */
    #include DeviceFamily_constructPath(driverlib/rf_prop_mailbox.h)
    
    /* Board Header files */
    #include "Board.h"
    
    /* Application Header files */
    #include "RFQueue.h"
    #include "smartrf_settings/smartrf_settings.h"
    
    /***** Defines *****/
    
    /* Packet RX Configuration */
    #define DATA_ENTRY_HEADER_SIZE 15  /* Constant header size of a Generic Data Entry */
    #define MAX_LENGTH             30 /* Max length byte the radio will accept */
    #define NUM_DATA_ENTRIES       2  /* NOTE: Only two data entries supported at the moment */
    #define NUM_APPENDED_BYTES     2  /* The Data Entries data field will contain:
                                       * 1 Header byte (RF_cmdPropRx.rxConf.bIncludeHdr = 0x1)
                                       * Max 30 payload bytes
                                       * 1 status byte (RF_cmdPropRx.rxConf.bAppendStatus = 0x1) */
    
    
    
    /***** Prototypes *****/
    static void callback(RF_Handle h, RF_CmdHandle ch, RF_EventMask e);
    
    /***** Variable declarations *****/
    static RF_Object rfObject;
    static RF_Handle rfHandle;
    
    /* Pin driver handle */
    static PIN_Handle ledPinHandle;
    static PIN_State ledPinState;
    
    /* 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) */
    #if defined(__TI_COMPILER_VERSION__)
    #pragma DATA_ALIGN (rxDataEntryBuffer, 4);
    static uint8_t
    rxDataEntryBuffer[RF_QUEUE_DATA_ENTRY_BUFFER_SIZE(NUM_DATA_ENTRIES,
                                                      MAX_LENGTH,
                                                      NUM_APPENDED_BYTES)];
    #elif defined(__IAR_SYSTEMS_ICC__)
    #pragma data_alignment = 4
    static uint8_t
    rxDataEntryBuffer[RF_QUEUE_DATA_ENTRY_BUFFER_SIZE(NUM_DATA_ENTRIES,
                                                      MAX_LENGTH,
                                                      NUM_APPENDED_BYTES)];
    #elif defined(__GNUC__)
    static uint8_t
    rxDataEntryBuffer[RF_QUEUE_DATA_ENTRY_BUFFER_SIZE(NUM_DATA_ENTRIES,
                                                      MAX_LENGTH,
                                                      NUM_APPENDED_BYTES)]
                                                      __attribute__((aligned(4)));
    #else
    #error This compiler is not supported.
    #endif
    
    /* Receive dataQueue for RF Core to fill in data */
    static dataQueue_t dataQueue;
    static rfc_dataEntryGeneral_t* currentDataEntry;
    static uint8_t packetLength;
    static uint8_t* packetDataPointer;
    
    
    static uint8_t packet[MAX_LENGTH + NUM_APPENDED_BYTES - 1]; /* The length byte is stored in a separate variable */
    
    
    
    /*
     * Application LED pin configuration table:
     *   - All LEDs board LEDs are off.
     */
    PIN_Config pinTable[] =
    {
        Board_PIN_LED2 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
    
    
    	 Board_PIN_LED1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
    	    PIN_TERMINATE
    };
    
    /***** Function definitions *****/
    
    
    
    
    void packetToUart(uint8_t pckt[]);
    
    
    
    
    void packetToUart(uint8_t pckt[]){
        Display_init();
             Display_Params params;
             Display_Params_init(&params);
    
        Display_Handle hSerial = Display_open(Display_Type_UART, &params);
    
       Display_printf(hSerial, 1, 1,  "Hello Serial!");
    
        Display_close(hSerial);
    
    
    }
    
    
    
    void *mainThread(void *arg0)
    {
        RF_Params rfParams;
        RF_Params_init(&rfParams);
    
    
    
    
    
        /* Open LED pins */
        ledPinHandle = PIN_open(&ledPinState, pinTable);
        if (ledPinHandle == NULL)
        {
            while(1);
        }
    
        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_cmdPropRx.pQueue = &dataQueue;
        /* Discard ignored packets from Rx queue */
    //    RF_cmdPropRx.rxConf.bAutoFlushIgnored = 1;
        /* Discard packets with CRC error from Rx queue */
    //    RF_cmdPropRx.rxConf.bAutoFlushCrcErr = 1;
        /* Implement packet length filtering to avoid PROP_ERROR_RXBUF */
        RF_cmdPropRx.maxPktLen = MAX_LENGTH;
        RF_cmdPropRx.pktConf.bRepeatOk = 1;
        RF_cmdPropRx.pktConf.bRepeatNok = 1;
    
        /* Request access to the radio */
    #if defined(DeviceFamily_CC26X0R2)
        rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdPropRadioSetup, &rfParams);
    #else
        rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdPropRadioDivSetup, &rfParams);
    #endif// DeviceFamily_CC26X0R2
    
        /* Set the frequency */
        RF_postCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0);
    
    
    
        /* Enter RX mode and stay forever in RX */
        RF_EventMask terminationReason = RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropRx,
                                                   RF_PriorityNormal, &callback,
                                                   RF_EventRxEntryDone);
    
        switch(terminationReason)
        {
            case RF_EventLastCmdDone:
                // A stand-alone radio operation command or the last radio
                // operation command in a chain finished.
                break;
            case RF_EventCmdCancelled:
                // Command cancelled before it was started; it can be caused
                // by RF_cancelCmd() or RF_flushCmd().
                break;
            case RF_EventCmdAborted:
                // Abrupt command termination caused by RF_cancelCmd() or
                // RF_flushCmd().
                break;
            case RF_EventCmdStopped:
                // Graceful command termination caused by RF_cancelCmd() or
                // RF_flushCmd().
                break;
            default:
                // Uncaught error event
                while(1);
        }
    
        uint32_t cmdStatus = ((volatile RF_Op*)&RF_cmdPropRx)->status;
        switch(cmdStatus)
        {
            case PROP_DONE_OK:
                // Packet received with CRC OK
                break;
            case PROP_DONE_RXERR:
                // Packet received with CRC error
                break;
            case PROP_DONE_RXTIMEOUT:
                // Observed end trigger while in sync search
                break;
            case PROP_DONE_BREAK:
                // Observed end trigger while receiving packet when the command is
                // configured with endType set to 1
                break;
            case PROP_DONE_ENDED:
                // Received packet after having observed the end trigger; if the
                // command is configured with endType set to 0, the end trigger
                // will not terminate an ongoing reception
                break;
            case PROP_DONE_STOPPED:
                // received CMD_STOP after command started and, if sync found,
                // packet is received
                break;
            case PROP_DONE_ABORT:
                // Received CMD_ABORT after command started
                break;
            case PROP_ERROR_RXBUF:
                // No RX buffer large enough for the received data available at
                // the start of a packet
    
                break;
            case PROP_ERROR_RXFULL:
                // Out of RX buffer space during reception in a partial read
    
                break;
    
            case PROP_ERROR_PAR:
                // Observed illegal parameter
                break;
            case PROP_ERROR_NO_SETUP:
                // Command sent without setting up the radio in a supported
                // mode using CMD_PROP_RADIO_SETUP or CMD_RADIO_SETUP
                break;
            case PROP_ERROR_NO_FS:
                // Command sent without the synthesizer being programmed
                break;
            case PROP_ERROR_RXOVF:
                // RX overflow observed during operation
    
                break;
            default:
                // Uncaught error event - these could come from the
                // pool of states defined in rf_mailbox.h
                while(1);
        }
    
        while(1);
    }
    
    void callback(RF_Handle h, RF_CmdHandle ch, RF_EventMask e)
    {
        if (e & RF_EventRxEntryDone)
        {
    
    
            /* Toggle pin to indicate RX */
            PIN_setOutputValue(ledPinHandle, Board_PIN_LED2,
                               !PIN_getOutputValue(Board_PIN_LED2));
    
            /* Get current unhandled data entry */
            currentDataEntry = RFQueue_getDataEntry();
    
            /* Handle the packet data, located at &currentDataEntry->data:
             * - Length is the first byte with the current configuration
             * - Data starts from the second byte */
            packetLength      = *(uint8_t*)(&currentDataEntry->data);
            packetDataPointer = (uint8_t*)(&currentDataEntry->data + 1);
    
            /* Copy the payload + the status byte to the packet variable */
            memcpy(packet, packetDataPointer, (packetLength + 1));
    
            packetToUart(packet);
      PIN_setOutputValue(ledPinHandle, Board_PIN_LED1,
                               !PIN_getOutputValue(Board_PIN_LED1));
            RFQueue_nextEntry();
    
    
    
        }
    }

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

    回叫中不能有阻塞呼叫:

    请参见下面我修改的rfPacketRX示例:

    /*
     * Copyright (c) 2019, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
    
    /***** Includes *****/
    /* Standard C Libraries */
    #include <stdlib.h>
    
    /* TI Drivers */
    #include <ti/drivers/rf/RF.h>
    #include <ti/drivers/PIN.h>
    #include <ti/display/Display.h>
    
    /* Driverlib Header files */
    #include DeviceFamily_constructPath(driverlib/rf_prop_mailbox.h)
    
    /* Board Header files */
    #include "Board.h"
    
    /* Application Header files */
    #include "RFQueue.h"
    #include "smartrf_settings/smartrf_settings.h"
    
    /* BIOS Header files */
    #include <ti/sysbios/BIOS.h>
    #include <ti/sysbios/knl/Semaphore.h>
    #include <ti/sysbios/knl/Task.h>
    
    /***** Defines *****/
    
    /* Packet RX Configuration */
    #define DATA_ENTRY_HEADER_SIZE 8  /* Constant header size of a Generic Data Entry */
    #define MAX_LENGTH             30 /* Max length byte the radio will accept */
    #define NUM_DATA_ENTRIES       2  /* NOTE: Only two data entries supported at the moment */
    #define NUM_APPENDED_BYTES     2  /* The Data Entries data field will contain:
                                       * 1 Header byte (RF_cmdPropRx.rxConf.bIncludeHdr = 0x1)
                                       * Max 30 payload bytes
                                       * 1 status byte (RF_cmdPropRx.rxConf.bAppendStatus = 0x1) */
    
    
    
    /***** Prototypes *****/
    static void callback(RF_Handle h, RF_CmdHandle ch, RF_EventMask e);
    
    /***** Variable declarations *****/
    static RF_Object rfObject;
    static RF_Handle rfHandle;
    
    /* Pin driver handle */
    static PIN_Handle ledPinHandle;
    static PIN_State ledPinState;
    
    /* 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) */
    #if defined(__TI_COMPILER_VERSION__)
    #pragma DATA_ALIGN (rxDataEntryBuffer, 4);
    static uint8_t
    rxDataEntryBuffer[RF_QUEUE_DATA_ENTRY_BUFFER_SIZE(NUM_DATA_ENTRIES,
                                                      MAX_LENGTH,
                                                      NUM_APPENDED_BYTES)];
    #elif defined(__IAR_SYSTEMS_ICC__)
    #pragma data_alignment = 4
    static uint8_t
    rxDataEntryBuffer[RF_QUEUE_DATA_ENTRY_BUFFER_SIZE(NUM_DATA_ENTRIES,
                                                      MAX_LENGTH,
                                                      NUM_APPENDED_BYTES)];
    #elif defined(__GNUC__)
    static uint8_t
    rxDataEntryBuffer[RF_QUEUE_DATA_ENTRY_BUFFER_SIZE(NUM_DATA_ENTRIES,
                                                      MAX_LENGTH,
                                                      NUM_APPENDED_BYTES)]
                                                      __attribute__((aligned(4)));
    #else
    #error This compiler is not supported.
    #endif
    
    /* Receive dataQueue for RF Core to fill in data */
    static dataQueue_t dataQueue;
    static rfc_dataEntryGeneral_t* currentDataEntry;
    static uint8_t packetLength;
    static uint8_t* packetDataPointer;
    
    static uint8_t packet[MAX_LENGTH + NUM_APPENDED_BYTES - 1]; /* The length byte is stored in a separate variable */
    
    /* RX Semaphore */
    static Semaphore_Struct rxSemaphore;
    static Semaphore_Handle rxSemaphoreHandle;
    
    /*
     * Application LED pin configuration table:
     *   - All LEDs board LEDs are off.
     */
    PIN_Config pinTable[] =
    {
        Board_PIN_LED2 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
    	PIN_TERMINATE
    };
    
    /***** Function definitions *****/
    
    void *mainThread(void *arg0)
    {
        RF_Params rfParams;
        RF_Params_init(&rfParams);
    
        /* Initialize RX semaphore */
        Semaphore_construct(&rxSemaphore, 0, NULL);
        rxSemaphoreHandle = Semaphore_handle(&rxSemaphore);
    
        Display_Params params;
        Display_Params_init(&params);
        params.lineClearMode = DISPLAY_CLEAR_BOTH;
        Display_Handle uartDisplayHandle = Display_open(Display_Type_UART, &params);
    
        /* Open LED pins */
        ledPinHandle = PIN_open(&ledPinState, pinTable);
        if (ledPinHandle == NULL)
        {
            while(1);
        }
    
        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_cmdPropRx.pQueue = &dataQueue;
        /* Discard ignored packets from Rx queue */
        RF_cmdPropRx.rxConf.bAutoFlushIgnored = 1;
        /* Discard packets with CRC error from Rx queue */
        RF_cmdPropRx.rxConf.bAutoFlushCrcErr = 1;
        /* Implement packet length filtering to avoid PROP_ERROR_RXBUF */
        RF_cmdPropRx.maxPktLen = MAX_LENGTH;
        RF_cmdPropRx.pktConf.bRepeatOk = 1;
        RF_cmdPropRx.pktConf.bRepeatNok = 1;
    
        /* Request access to the radio */
    #if defined(DeviceFamily_CC26X0R2)
        rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdPropRadioSetup, &rfParams);
    #else
        rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdPropRadioDivSetup, &rfParams);
    #endif// DeviceFamily_CC26X0R2
    
        /* Set the frequency */
        RF_postCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0);
    
        /* Enter RX mode and stay forever in RX */
        RF_postCmd(rfHandle, (RF_Op*)&RF_cmdPropRx, RF_PriorityNormal, &callback, RF_EventRxEntryDone);
    
        while(1)
        {
            uint8_t i;
    
            Semaphore_pend(rxSemaphoreHandle, BIOS_WAIT_FOREVER);
            Display_printf(uartDisplayHandle, 0, 0, "%s", "Packet:");
            for (i = 0; i < packetLength; i++)
             {
                Display_printf(uartDisplayHandle, i+1, 0, "%u", packet[i]);
            }
        }
    }
    
    void callback(RF_Handle h, RF_CmdHandle ch, RF_EventMask e)
    {
        if (e & RF_EventRxEntryDone)
        {
            /* Toggle pin to indicate RX */
            PIN_setOutputValue(ledPinHandle, Board_PIN_LED2,
                               !PIN_getOutputValue(Board_PIN_LED2));
    
            /* Get current unhandled data entry */
            currentDataEntry = RFQueue_getDataEntry();
    
            /* Handle the packet data, located at &currentDataEntry->data:
             * - Length is the first byte with the current configuration
             * - Data starts from the second byte */
            packetLength      = *(uint8_t*)(&currentDataEntry->data);
            packetDataPointer = (uint8_t*)(&currentDataEntry->data + 1);
    
            /* Copy the payload + the status byte to the packet variable */
            memcpy(packet, packetDataPointer, (packetLength + 1));
    
            RFQueue_nextEntry();
    
            Semaphore_post(rxSemaphoreHandle);
        }
    }
    

    Siri

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

    您好,Siri,

    到目前为止,您的帮助非常大,我非常感谢!  

    我已复制您的代码并将所需的BIOS和XDC文件添加到包含中,但在构建rfPacketRX时收到以下错误:

    undefined                          first referenced
      symbol                                in file     
     ---------                          ----------------
     ti_sysbios_knl_Semaphore_construct ./rfPacketRx.obj
     ti_sysbios_knl_Semaphore_pend__E   ./rfPacketRx.obj
     ti_sysbios_knl_Semaphore_post__E   ./rfPacketRx.obj
     
    error #10234-D: unresolved symbols remain
    error #10010: errors encountered during linking; "rfPacketRx_CC1310_LAUNCHXL_nortos_ccs.out" not built
     
    >> Compilation failure
    makefile:156: recipe for target 'rfPacketRx_CC1310_LAUNCHXL_nortos_ccs.out' failed
    gmake[1]: *** [rfPacketRx_CC1310_LAUNCHXL_nortos_ccs.out] Error 1
    makefile:152: recipe for target 'all' failed
    gmake: *** [all] Error 2
    

    有什么办法解决这个问题? 我已经在网上和semaphore.H文件中挖掘了,但我不知道什么是错误的。

    我的屏幕截图包括:

    此致,

    Mirte H

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

    如果您正在运行nortos,我的代码将不起作用。 请参见rfWakeOnRadioTX_nortos示例,了解如何使用nortos完成信号。

    Siri

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

    嗨Siri,

    我还没有让我的UART代码运行,但我确信,现在您已经为我提供了如此多的帮助。

    愚蠢地说,我刚才注意到,当我使用基本的RFpacketRX代码时,我不会连续地接收数据包。 我认为我的数据包大小设置有问题,因为代码冻结在  memcpy(packet, packetDataPointer,(packetLength +1));。  以下是有关我的数据包的一些信息:

    我希望收到以下数据包:  

    9999 9999 9999 9999 9999 9999 66 66 55 6A 56 69 55 66 55 5A 65 55 55 55 55 5A 56 A5 A9

    其中 9999 9999 9999 9999 9999 9999 9999 66是收割台, 66 55 6A 56 69 55 55 5A 65 55 55 55 55 5A 56 A5 A9是我的有效负载。

    我使用 100万 66 作为我的同步字词。

    在SmartRF中,我使用了导出后用于CCS的以下数据包设置:

    固定长度:19

    同步字:0x9999.9966万

    同步字长度:32位

    前导码字节:5

    地址检查

    有效负载中未包含序列号

    通过这些设置,我每次都以SMART RF方式接收数据包:

    在rfPacketRX nortos中使用这些设置时,我收到一个数据包,然后我的代码在 memcpy(packet, packetDataPointer,(packetLength +1))处冻结;   

    我的数据包设置有什么问题?

    下面是我的rfPacketRX:

    /***** Includes *****/
    /* Standard C Libraries */
    #include <stdlib.h>
    
    /* TI Drivers */
    #include <ti/drivers/rf/RF.h>
    #include <ti/drivers/PIN.h>
    
    /* Driverlib Header files */
    #include DeviceFamily_constructPath(driverlib/rf_prop_mailbox.h)
    
    /* Board Header files */
    #include "Board.h"
    
    /* Application Header files */
    #include "RFQueue.h"
    #include "smartrf_settings/smartrf_settings.h"
    
    /***** Defines *****/
    
    /* Packet RX Configuration */
    #define DATA_ENTRY_HEADER_SIZE 9  /* Constant header size of a Generic Data Entry */
    #define MAX_LENGTH             19 /* Max length byte the radio will accept */
    #define NUM_DATA_ENTRIES       2  /* NOTE: Only two data entries supported at the moment */
    #define NUM_APPENDED_BYTES     2  /* The Data Entries data field will contain:
                                       * 1 Header byte (RF_cmdPropRx.rxConf.bIncludeHdr = 0x1)
                                       * Max 30 payload bytes
                                       * 1 status byte (RF_cmdPropRx.rxConf.bAppendStatus = 0x1) */
    
    
    
    /***** Prototypes *****/
    static void callback(RF_Handle h, RF_CmdHandle ch, RF_EventMask e);
    
    /***** Variable declarations *****/
    static RF_Object rfObject;
    static RF_Handle rfHandle;
    
    /* Pin driver handle */
    static PIN_Handle ledPinHandle;
    static PIN_State ledPinState;
    
    /* 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) */
    #if defined(__TI_COMPILER_VERSION__)
    #pragma DATA_ALIGN (rxDataEntryBuffer, 4);
    static uint8_t
    rxDataEntryBuffer[RF_QUEUE_DATA_ENTRY_BUFFER_SIZE(NUM_DATA_ENTRIES,
                                                      MAX_LENGTH,
                                                      NUM_APPENDED_BYTES)];
    #elif defined(__IAR_SYSTEMS_ICC__)
    #pragma data_alignment = 4
    static uint8_t
    rxDataEntryBuffer[RF_QUEUE_DATA_ENTRY_BUFFER_SIZE(NUM_DATA_ENTRIES,
                                                      MAX_LENGTH,
                                                      NUM_APPENDED_BYTES)];
    #elif defined(__GNUC__)
    static uint8_t
    rxDataEntryBuffer[RF_QUEUE_DATA_ENTRY_BUFFER_SIZE(NUM_DATA_ENTRIES,
                                                      MAX_LENGTH,
                                                      NUM_APPENDED_BYTES)]
                                                      __attribute__((aligned(4)));
    #else
    #error This compiler is not supported.
    #endif
    
    /* Receive dataQueue for RF Core to fill in data */
    static dataQueue_t dataQueue;
    static rfc_dataEntryGeneral_t* currentDataEntry;
    static uint8_t packetLength;
    static uint8_t* packetDataPointer;
    
    
    static uint8_t packet[MAX_LENGTH + NUM_APPENDED_BYTES - 1]; /* The length byte is stored in a separate variable */
    
    /*
     * Application LED pin configuration table:
     *   - All LEDs board LEDs are off.
     */
    PIN_Config pinTable[] =
    {
        Board_PIN_LED2 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
    	PIN_TERMINATE
    };
    
    /***** Function definitions *****/
    
    void *mainThread(void *arg0)
    {
        RF_Params rfParams;
        RF_Params_init(&rfParams);
    
        /* Open LED pins */
        ledPinHandle = PIN_open(&ledPinState, pinTable);
        if (ledPinHandle == NULL)
        {
            while(1);
        }
    
        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_cmdPropRx.pQueue = &dataQueue;
        /* Discard ignored packets from Rx queue */
        RF_cmdPropRx.rxConf.bAutoFlushIgnored = 1;
        /* Discard packets with CRC error from Rx queue */
      //  RF_cmdPropRx.rxConf.bAutoFlushCrcErr = 1;
        /* Implement packet length filtering to avoid PROP_ERROR_RXBUF */
        RF_cmdPropRx.maxPktLen = MAX_LENGTH;
        RF_cmdPropRx.pktConf.bRepeatOk = 1;
        RF_cmdPropRx.pktConf.bRepeatNok = 1;
    
        /* Request access to the radio */
    #if defined(DeviceFamily_CC26X0R2)
        rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdPropRadioSetup, &rfParams);
    #else
        rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdPropRadioDivSetup, &rfParams);
    #endif// DeviceFamily_CC26X0R2
    
        /* Set the frequency */
        RF_postCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0);
    
        /* Enter RX mode and stay forever in RX */
        RF_EventMask terminationReason = RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropRx,
                                                   RF_PriorityNormal, &callback,
                                                   RF_EventRxEntryDone);
    
        switch(terminationReason)
        {
            case RF_EventLastCmdDone:
                // A stand-alone radio operation command or the last radio
                // operation command in a chain finished.
                break;
            case RF_EventCmdCancelled:
                // Command cancelled before it was started; it can be caused
                // by RF_cancelCmd() or RF_flushCmd().
                break;
            case RF_EventCmdAborted:
                // Abrupt command termination caused by RF_cancelCmd() or
                // RF_flushCmd().
                break;
            case RF_EventCmdStopped:
                // Graceful command termination caused by RF_cancelCmd() or
                // RF_flushCmd().
                break;
            default:
                // Uncaught error event
                while(1);
        }
    
        uint32_t cmdStatus = ((volatile RF_Op*)&RF_cmdPropRx)->status;
        switch(cmdStatus)
        {
            case PROP_DONE_OK:
                // Packet received with CRC OK
                break;
            case PROP_DONE_RXERR:
                // Packet received with CRC error
                break;
            case PROP_DONE_RXTIMEOUT:
                // Observed end trigger while in sync search
                break;
            case PROP_DONE_BREAK:
                // Observed end trigger while receiving packet when the command is
                // configured with endType set to 1
                break;
            case PROP_DONE_ENDED:
                // Received packet after having observed the end trigger; if the
                // command is configured with endType set to 0, the end trigger
                // will not terminate an ongoing reception
                break;
            case PROP_DONE_STOPPED:
                // received CMD_STOP after command started and, if sync found,
                // packet is received
                break;
            case PROP_DONE_ABORT:
                // Received CMD_ABORT after command started
                break;
            case PROP_ERROR_RXBUF:
                // No RX buffer large enough for the received data available at
                // the start of a packet
                break;
            case PROP_ERROR_RXFULL:
                // Out of RX buffer space during reception in a partial read
                break;
            case PROP_ERROR_PAR:
                // Observed illegal parameter
                break;
            case PROP_ERROR_NO_SETUP:
                // Command sent without setting up the radio in a supported
                // mode using CMD_PROP_RADIO_SETUP or CMD_RADIO_SETUP
                break;
            case PROP_ERROR_NO_FS:
                // Command sent without the synthesizer being programmed
                break;
            case PROP_ERROR_RXOVF:
                // RX overflow observed during operation
                break;
            default:
                // Uncaught error event - these could come from the
                // pool of states defined in rf_mailbox.h
                while(1);
        }
    
        while(1);
    }
    
    void callback(RF_Handle h, RF_CmdHandle ch, RF_EventMask e)
    {
        if (e & RF_EventRxEntryDone)
        {
            /* Toggle pin to indicate RX */
            PIN_setOutputValue(ledPinHandle, Board_PIN_LED2,
                               !PIN_getOutputValue(Board_PIN_LED2));
    
            /* Get current unhandled data entry */
            currentDataEntry = RFQueue_getDataEntry();
    
            /* Handle the packet data, located at &currentDataEntry->data:
             * - Length is the first byte with the current configuration
             * - Data starts from the second byte */
            packetLength      = *(uint8_t*)(&currentDataEntry->data);
            packetDataPointer = (uint8_t*)(&currentDataEntry->data + 1);
    
            /* Copy the payload + the status byte to the packet variable */
            memcpy(packet, packetDataPointer, (packetLength + 1));
    
            RFQueue_nextEntry();
        }
    }
    

    和我的SmartRFsettings.C

    //*********************************************************************************
    // Generated by SmartRF Studio version 2.24.0 (build#328)
    // The applied template is compatible with CC13x0 SDK version 2.10.xx.xx or newer.
    // Device: CC1310 Rev. B (2.1).
    //
    //*********************************************************************************
    
    
    //*********************************************************************************
    // Parameter summary
    // RX Address0: 0xAA
    // RX Address1: 0xBB
    // RX Address Mode: No address check
    // Frequency: 433.94063 MHz
    // Data Format: Serial mode disable 
    // Deviation: 25.000 kHz
    // Fixed Packet Length: 20
    // Packet Length Config: Fixed
    // Max Packet Length: 19
    // Packet Data: 255 
    // RX Filter BW: 98 kHz
    // Symbol Rate: 4.80042 kBaud
    // Sync Word Length: 32 Bits 
    // TX Power: 0 dBm
    // Whitening: No whitening 
    
    #include "smartrf_settings.h"
    
    #include DeviceFamily_constructPath(rf_patches/rf_patch_cpe_genfsk.h)
    #include DeviceFamily_constructPath(rf_patches/rf_patch_rfe_genfsk.h)
    
    // TI-RTOS RF Mode Object
    RF_Mode RF_prop =
    {
        .rfMode = RF_MODE_PROPRIETARY_SUB_1,
        .cpePatchFxn = &rf_patch_cpe_genfsk,
        .mcePatchFxn = 0,
        .rfePatchFxn = &rf_patch_rfe_genfsk
    };
    
    
    // Overrides for CMD_PROP_RADIO_DIV_SETUP
    uint32_t pOverrides[] =
    {
     // override_use_patch_prop_genfsk.xml
        // PHY: Use MCE ROM bank 4, RFE RAM patch
        MCE_RFE_OVERRIDE(0,4,0,1,0,0),
        // override_synth_prop_863_930_div5.xml
        // Synth: Set recommended RTRIM to 7
        HW_REG_OVERRIDE(0x4038,0x0037),
        // Synth: Set Fref to 4 MHz
        (uint32_t)0x000684A3,
        // Synth: Configure fine calibration setting
        HW_REG_OVERRIDE(0x4020,0x7F00),
        // Synth: Configure fine calibration setting
        HW_REG_OVERRIDE(0x4064,0x0040),
        // Synth: Configure fine calibration setting
        (uint32_t)0xB1070503,
        // Synth: Configure fine calibration setting
        (uint32_t)0x05330523,
        // Synth: Set loop bandwidth after lock to 20 kHz
        (uint32_t)0x0A480583,
        // Synth: Set loop bandwidth after lock to 20 kHz
        (uint32_t)0x7AB80603,
        // Synth: Configure VCO LDO (in ADI1, set VCOLDOCFG=0x9F to use voltage input reference)
        ADI_REG_OVERRIDE(1,4,0x9F),
        // Synth: Configure synth LDO (in ADI1, set SLDOCTL0.COMP_CAP=1)
        ADI_HALFREG_OVERRIDE(1,7,0x4,0x4),
        // Synth: Use 24 MHz XOSC as synth clock, enable extra PLL filtering
        (uint32_t)0x02010403,
        // Synth: Configure extra PLL filtering
        (uint32_t)0x00108463,
        // Synth: Increase synth programming timeout (0x04B0 RAT ticks = 300 us)
        (uint32_t)0x04B00243,
        // override_phy_rx_aaf_bw_0xd.xml
        // Rx: Set anti-aliasing filter bandwidth to 0xD (in ADI0, set IFAMPCTL3[7:4]=0xD)
        ADI_HALFREG_OVERRIDE(0,61,0xF,0xD),
        // override_phy_gfsk_rx.xml
        // Rx: Set LNA bias current trim offset to 3
        (uint32_t)0x00038883,
        // Rx: Freeze RSSI on sync found event
        HW_REG_OVERRIDE(0x6084,0x35F1),
        // override_phy_gfsk_pa_ramp_agc_reflevel_0x1a.xml
        // Tx: Configure PA ramping setting (0x41). Rx: Set AGC reference level to 0x1A.
        HW_REG_OVERRIDE(0x6088,0x411A),
        // Tx: Configure PA ramping setting
        HW_REG_OVERRIDE(0x608C,0x8213),
        // override_phy_rx_rssi_offset_5db.xml
        // Rx: Set RSSI offset to adjust reported RSSI by +5 dB (default: 0), trimmed for external bias and differential configuration
        (uint32_t)0x00FB88A3,
        (uint32_t)0xFFFFFFFF
    };
    
    
    // CMD_PROP_RADIO_DIV_SETUP
    // Proprietary Mode Radio Setup Command for All Frequency Bands
    rfc_CMD_PROP_RADIO_DIV_SETUP_t RF_cmdPropRadioDivSetup =
    {
     .commandNo = 0x3807,
         .status = 0x0000,
         .pNextOp = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
         .startTime = 0x00000000,
         .startTrigger.triggerType = 0x0,
         .startTrigger.bEnaCmd = 0x0,
         .startTrigger.triggerNo = 0x0,
         .startTrigger.pastTrig = 0x0,
         .condition.rule = 0x1,
         .condition.nSkip = 0x0,
         .modulation.modType = 0x1,
         .modulation.deviation = 0x20,
         .symbolRate.preScale = 0xF,
         .symbolRate.rateWord = 0xC08,
         .symbolRate.decimMode = 0x0,
         .rxBw = 0x24,
         .preamConf.nPreamBytes = 0x5,
         .preamConf.preamMode = 0x0,
         .formatConf.nSwBits = 0x18,
         .formatConf.bBitReversal = 0x0,
         .formatConf.bMsbFirst = 0x1,
         .formatConf.fecMode = 0x0,
         .formatConf.whitenMode = 0x0,
         .config.frontEndMode = 0x0,
         .config.biasMode = 0x1,
         .config.analogCfgMode = 0x0,
         .config.bNoFsPowerUp = 0x0,
         .txPower = 0x0EC1,
         .pRegOverride = pOverrides,
         .centerFreq = 0x01B1,
         .intFreq = 0x8000,
         .loDivider = 0x0A
    };
    
    
    // CMD_FS
    // Frequency Synthesizer Programming Command
    rfc_CMD_FS_t RF_cmdFs =
    {
     .commandNo = 0x0803,
       .status = 0x0000,
       .pNextOp = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
       .startTime = 0x00000000,
       .startTrigger.triggerType = 0x0,
       .startTrigger.bEnaCmd = 0x0,
       .startTrigger.triggerNo = 0x0,
       .startTrigger.pastTrig = 0x0,
       .condition.rule = 0x1,
       .condition.nSkip = 0x0,
       .frequency = 0x01B1,
       .fractFreq = 0xE7CD,
       .synthConf.bTxMode = 0x0,
       .synthConf.refFreq = 0x0,
       .__dummy0 = 0x00,
       .__dummy1 = 0x00,
       .__dummy2 = 0x00,
       .__dummy3 = 0x0000
    };
    
    
    // CMD_PROP_RX
    // Proprietary Mode Receive Command
    rfc_CMD_PROP_RX_t RF_cmdPropRx =
    {
     .commandNo = 0x3802,
     .status = 0x0000,
     .pNextOp = 0, // INSERT APPLICABLE POINTER: (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.bVarLen = 0x0,
     .pktConf.bChkAddress = 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,
     .syncWord = 0x99999966,
     .maxPktLen = 0x13,
     .address0 = 0xAA,
     .address1 = 0xBB,
     .endTrigger.triggerType = 0x1,
     .endTrigger.bEnaCmd = 0x0,
     .endTrigger.triggerNo = 0x0,
     .endTrigger.pastTrig = 0x0,
     .endTime = 0x00000000,
     .pQueue = 0, // INSERT APPLICABLE POINTER: (dataQueue_t*)&xxx
     .pOutput = 0 // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
    };
    
    
    // CMD_PROP_TX
    // Proprietary Mode Transmit Command
    rfc_CMD_PROP_TX_t RF_cmdPropTx =
    {
     .commandNo = 0x3801,
        .status = 0x0000,
        .pNextOp = 0, // INSERT APPLICABLE POINTER: (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.bVarLen = 0x0,
        .pktLen = 0x14,
        .syncWord = 0x99999966,
        .pPkt = 0 // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
    };
    
    

    再次感谢!

    此致,

    Mirte H

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

    如果您使用的 是固定数据包长度模式,则需要更改回调(您正在读取长度字节,如果您使用的是固定数据包长度=,则显然不需要该字节

    Siri