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怎么读取RSSI?

Other Parts Discussed in Thread: CC1310

CC1310怎么读取RSSI?

  • http://dev.ti.com/tirex/content/simplelink_cc13x0_sdk_1_50_00_08/docs/tidrivers/doxygen/html/_r_f_8h.html#ac3fe0d39243fb6bbefe0216d958a6779

    RF_getRssi()

    int8_t RF_getRssi ( RF_Handle  h )

    Get RSSI value.

    Note
    Calling context : Task/SWI/HWI
    Parameters
    h Handle previously returned by RF_open()
    Returns
    RSSI value. Return value of RF_GET_RSSI_ERROR_VAL indicates error case.
  • 另外需要注意的是收到数据包后,除非bRepeatOk = 1,否则RF将不再处于接收模式。如果不处于接收模式,则无法读取RSSI。如果您想要您收到的数据包的RSSI,您可以从rfc_propRxOutput_t中读取RSSI。

  • 你好,我今天试了一下,但是还是不知道怎么去使用这个函数,老式读出0x80。这个函数应该在什么地方用呢?在接收中断函数里面使用可以吗?

  • 你如果是希望读取接收数据包时的RSSI值,可以直接使用bAppendRssi,然后从rx buffer中读取

    如果你是希望读取当前信道的信号强度,可以将RF设置到RX状态,然后使用RF_getRSSI进行读取

    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 */
        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);
        /* Enter RX mode and stay forever in RX */
    //    RF_EventMask terminationReason = RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropRx,
    //                                               RF_PriorityNormal, &callback,
    //                                               RF_EventRxEntryDone);
        RF_EventMask terminationReason = RF_postCmd(rfHandle, (RF_Op*)&RF_cmdPropRx, RF_PriorityNormal, &callback, RF_EventRxEntryDone);
        while(1)
        {
            value = RF_getRssi(rfHandle);
        }
        switch(terminationReason)
        {
            case RF_EventCmdDone:
                // A radio operation command in a chain finished
                break;
            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 *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 */    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);
        /* Enter RX mode and stay forever in RX *///    RF_EventMask terminationReason = RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropRx,//                                               RF_PriorityNormal, &callback,//                                               RF_EventRxEntryDone);    RF_EventMask terminationReason = RF_postCmd(rfHandle, (RF_Op*)&RF_cmdPropRx, RF_PriorityNormal, &callback, RF_EventRxEntryDone);
        while(1)    {        value = RF_getRssi(rfHandle);    }
        switch(terminationReason)    {        case RF_EventCmdDone:            // A radio operation command in a chain finished            break;        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);}

  • 多谢,想一天不如提一问。。
  • 您好,我想问下这个RSSI的值是十六进制数,还是十进制数字,如何通过串口打印出RSSI值的呢?
  • 寄存器读出的RSSI值是十六进制,你先把串口调通,然后数据从串口输出就行了。可以参考下sdk里的串口例程
  • 您好,用了你的这段代码,但是任然无法读取rssi值,提示RF_GET_RSSI_ERROR_VAL错误,这是什么情况呢?
  • 您好,用RF_getRssi()这个函数需要配置什么其他参数吗?我读出的一直是0x80RF_GET_RSSI_ERROR_VAL?
  • 射频是处于接收状态吗?

  • 是处于接收状态的,请问除了加这个appendrssi字段以外,还需要配置其他参数么?因为加了这个字段后,就无法接受到数据了。

  • 使用bAppendRssi和使用RF_getRssi()是两种不同的获取RSSI值的方式,二选一即可。

    使用bAppendRssi是在每次收到的数据包后面附上接收时的RSSI数值,注意设置接收缓存时,留出足够空间存放RSSI值。

    /* 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) */

    rxDataEntryBuffer[RF_QUEUE_DATA_ENTRY_BUFFER_SIZE(NUM_DATA_ENTRIES,
                                                                                                          MAX_LENGTH,
                                                                                                          NUM_APPENDED_BYTES)];

    使用RF_getRssi()读取当前RSSI值,不需要接收到数据包,只要射频处于接收状态,就可以读到当前信道上的信号强度。

  • 怎么才能设置连续接收模式,用RFstdio设置连续接收,导出的,读取RSSI始终为0x80
  • 请参考rfPacketRx例程,在SDK目录下examples\rtos\CC1310_LAUNCHXL\drivers\rfPacketRx

  • 我是希望在没有收到数据包的情况下,读取底噪的RSSI值,  就像RFstudio里面的连续接收模式,可以一直显示非数据包的背景噪声RSSI值

  • 通过下面的流程进入连续接收模式,但是怎么去读取RSSI,程序会一直在连续接收模式那里循环,无法进入后面的while(1)


    void *mainThread(void *arg0)
    {
    RF_Params rfParams;
    RF_Params_init(&rfParams);

    /* 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_postCmd(rfHandle, (RF_Op*)&RF_cmdRxTest, RF_PriorityNormal, NULL, 0);
    while(1)
    {
    temp=RF_getRssi(rfHandle);
    };
    }

  • 请参考我前面贴出来的示例代码。

  • 已经可以读取了,在rfCarrierWave例程中按上面方法修改,设置为连续接收,然后重新建立另外一个进程来获取RSSI就可以了