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.

[参考译文] CC2642R:输出时钟的计时器

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

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/1199409/cc2642r-timer-to-output-the-clock

器件型号:CC2642R

您好!  

客户 需要主时钟(1-20MHz)来运行 ADC。 CC2642芯片是否有时钟输出? 客户如何实现这一目标?

谢谢

Jon  

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

    您好、Jon、

    下面是我之前使用的一些代码、用于配置计时器以在 CC2642/CC2652/CC1352/CC1312和类似器件上输出时钟。

    #define CLOCK_PIN_ID (IOID_23)
    #define CLOCK_FREQ   (12000000U)
    
    ////////////// OPEN
    
        GPTimerCC26XX_Params params;
        GPTimerCC26XX_Params_init(&params);
        params.width          = GPT_CONFIG_32BIT;
        params.mode           = GPT_MODE_PERIODIC_UP;
        params.debugStallMode = GPTimerCC26XX_DEBUG_STALL_OFF;
        timerHandle = GPTimerCC26XX_open(GPT_IDX, &params);
    
        /* Ensure that GPTImer was opened successfully */
        if(timerHandle == NULL)
        {
            return false;
        }
    
        /* Configure GPTimer to set clear pin initially and toggle on timeout */
        HWREG(timerHandle->hwAttrs->baseAddr + GPT_O_TAMR) |= GPT_TBMR_TCACT_CLRTOG_ON_TO;
    
        /* Set pin MUX based on GPTimer index */
        IOCPortConfigureSet(CLOCK_PIN_ID, GPTimerCC26XX_getPinMux(timerHandle),
                            IOC_IOMODE_NORMAL);
        
    
    ////////////// START
    
        /* Depend on XOSC_HF for precise clocks */
        Power_setDependency(PowerCC26XX_XOSC_HF);
    
        /* Set timer divider as fraction on CPU frequency */
        ClockP_FreqHz freqHz;
        ClockP_getCpuFreq(&freqHz);
        GPTimerCC26XX_Value loadVal = ((uint32_t)(freqHz.lo) / (2*CLOCK_FREQ)) - 1;
        GPTimerCC26XX_setLoadValue(timerHandle, loadVal);
    
        /* Start the Timer */
        GPTimerCC26XX_start(timerHandle);
    
    
    
    ////////////// STOP
    
            /* Stop the timer from running */
            GPTimerCC26XX_stop(timerHandle);
    
            /* XOSC_HF is no longer needed as clock is not running */
            Power_releaseDependency(PowerCC26XX_XOSC_HF);
            
            
    ////////////// CLOSE
    
            /* Close the timer instance */
            GPTimerCC26XX_close(timerHandle);
            timerHandle = NULL;

    我希望这将有所帮助、

    此致、

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

    Clement、谢谢。 如果出现任何问题、我将重新打开此主题。