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.

[参考译文] CC1352P:无法停止 CMD_TX_TEST 命令

Guru**** 2478765 points


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

https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz-group/sub-1-ghz/f/sub-1-ghz-forum/1345389/cc1352p-cannot-stop-cmd_tx_test-command

器件型号:CC1352P

您好!

我正在使用7.40.00.77版 SimpleLink SDK 开发面向 CC1352的应用。  该应用的其中一种模式是在接收到特定串行命令时以指定时间发送 CW 音调。  我可以使用 CMD_TX_TEST 命令成功将 CC1352置于 CW 模式。  该器件需要退出 CW 模式以响应另一个串行命令。  我正在尝试使用 CMD_ABORT 停止 CMD_TX_TEST 操作、但它会继续返回 RF_StatCmdDoneError、而不会停止 CMD_TX_TEST 操作。  使用 CMD_PROP_RADIO_DIV_SETUP_PA 和 CMD_FS 命令可以正确配置 CC1352。  作为完整性检查、我尝试在器件配置后发出 CMD_ping 命令; 但是、该命令还会返回 RF_StatCmdDoneError。  我是否有配置错误? 或者是否有更好的方法来停止 CW 测试模式?

这是 CC1352初始化代码。

int32_t
cc1352_rf_init(void)
{
    // Initialize default RF parameters.
    RF_Params rf_params;
    RF_Params_init(&rf_params);

    if (pthread_mutex_init(&rf_lock,
                           NULL) != 0)
    {
        return -2;
    }

    // Open handle to radio with properties and sysconfig setup.
    rf_handle = RF_open(&rfObject,
                        &RF_prop,
                        (RF_RadioSetup*)&RF_cmdPropRadioDivSetup,
                        &rf_params);

    if (rf_handle == NULL)
    {
        return -1;
    }

    // Tune radio to default freq from sysconfig setup.
    RF_runCmd(rf_handle,
              (RF_Op*)&RF_cmdFs,
              RF_PriorityNormal,
              NULL,
              0);

    // Check radio is configured correctly.
    if ((RF_cmdFs.status != DONE_OK) ||
        (RF_cmdPropRadioDivSetup.status != PROP_DONE_OK))
    {
        return -3;
    }

    // Sanity check.  CMD_PING also returns RF_StatCmdDoneError.
    RF_Stat status = RF_runDirectCmd(rf_handle,
                                     CMD_PING);

    return 0;
}

以下是将 CC1352置于 CW 测试模式的代码。

int32_t
cc1352_rf_cw_tone(void)
{
    RF_Handle *hdl = cc1352_rf_get_handle();

    RF_cmdTxTest.config.bUseCw = 1;

    if (hdl)
    {
        RF_postCmd(*hdl,
                  (RF_Op*)&RF_cmdTxTest,
                  RF_PriorityNormal,
                  NULL,
                  0);

        cc1352_release_handle();

        // Should return 2 (ACTIVE) if TX test mode started successfully.
        return (int32_t)RF_cmdTxTest.status;
    }
    else
    {
        return -1;
    }
}

以下是发出 CMD_ABORT 命令的代码。

int32_t
cc1352_rf_stop(void)
{
    RF_Handle *hdl = cc1352_rf_get_handle();

    if (hdl)
    {
        RF_Stat status = RF_runDirectCmd(*hdl,
                                         CMD_ABORT);
                                         //CMD_PING);

        cc1352_release_handle();

        return 0;
    }
    else
    {
        return -1;
    }
}

谢谢。

杰夫

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

     当您要取消命令时、应该使用 RF_CancelCmd 命令。

    要取消 TX 测试指示、您需要 使用"abort whiden"

    下面是 SDK 中 rfCarrierWave 示例的修改版本、展示了如何在按下按钮时取消 TX:

    // TI Drivers
    #include <ti/drivers/Power.h>
    #include <ti/drivers/rf/RF.h>
    #include <ti/drivers/GPIO.h>
    
    // Board Header files
    #include "ti_drivers_config.h"
    
    // Application Header files
    #include <ti_radio_config.h>
    
    // POSIX Header files
    #include <pthread.h>
    #include <semaphore.h>
    
    static RF_Object rfObject;
    static RF_Handle rfHandle;
    static RF_CmdHandle txHandle;
    
    // BTN-1 Semaphore
    static sem_t buttonSemaphore;
    
    
    void buttonCallbackFunction(uint_least8_t index)
    {
        CPUdelay((uint32_t)((48000000/3)*0.050f));
        if (!GPIO_read(index))
        {    
            sem_post(&buttonSemaphore);
        }
    }
    
    void *mainThread(void *arg0)
    {
        int retc;
    
        // Configure the radio for Proprietary mode
        RF_Params rfParams;
        RF_Params_init(&rfParams);
    
        GPIO_setConfig(CONFIG_GPIO_BTN_1, GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_FALLING);
        GPIO_setCallback(CONFIG_GPIO_BTN_1, buttonCallbackFunction);
        GPIO_enableInt(CONFIG_GPIO_BTN_1);
    
        retc = sem_init(&buttonSemaphore, 0, 0);
        if (retc != 0) 
        {
            while (1);
        }
    
        // Explicitly configure CW (1) or Modulated (0). Default modulated mode is PRBS-15.
        RF_cmdTxTest.config.bUseCw = 1;
    
        // Request access to the radio
        rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdPropRadioDivSetup, &rfParams);
    
        // Send CMD_FS and wait until it has completed
        RF_runCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0);
    
        // Send CMD_TX_TEST which sends forever
        txHandle = RF_postCmd(rfHandle, (RF_Op*)&RF_cmdTxTest, RF_PriorityNormal, NULL, 0);
    
        retc = sem_wait(&buttonSemaphore);
        if (retc == -1)
        {
            while (1);
        }
    
        RF_cancelCmd(rfHandle, txHandle, 0); // 1: Stop gracefully, 0: abort abruptly
    
        while(1);
    }

    Siri

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

    很抱歉响应延迟。  是的、RF_cancelCmd 命令解决了我的问题。

    谢谢。

    杰夫