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.

[参考译文] CC2340R2:为低频时钟选择外部时钟源

Guru**** 2835775 points

Other Parts Discussed in Thread: CC2340R2

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

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/1622146/cc2340r2-selecting-the-external-clock-source-for-low-frequency-clock

器件型号: CC2340R2

您好的团队、

我注意到、在新的 SDK (v9.11) 中、为低频时钟选择外部时钟源的功能发生了变化。 我们必须使用 SDK (v8.40) 复制此函数并在代码中将预期频率更改为 32.768kHz。

我想问的差异是:

1) 为什么现在首先完成多路复用器的设置?

2) LFK 良好中断的设置是新的

3) 启用 LFK 良好中断是新的

您能否详细介绍一下为什么进行这些更改、以及是否对较旧的 SDK (v8.40) 有任何影响?

//From new SDK(Simplink_lowpower_f3_SDK_9_11_00_18)
/*
 *  ======== PowerLPF3_selectEXTLF ========
 */
void PowerLPF3_selectEXTLF(void)
{
    /* Configure EXTLF to the right mux */
    GPIO_setConfigAndMux(PowerLPF3_extlfPin, GPIO_CFG_INPUT, PowerLPF3_extlfPinMux);

    Log_printf(LogModule_Power, Log_INFO, "PowerLPF3_selectEXTLF: EXTLF pin muxing configured");

    /* Set LFINC override to 31.25 kHz.
     *
     * The value is calculated as period in microseconds with 16 fractional
     * bits.
     * The EXTLF runs at 31.25 kHz -> 1 / 31250 Hz = 32 us.
     * 32 * 2^16 = 2097152 = 0x00200000
     */
    HWREG(CKMD_BASE + CKMD_O_LFINCOVR) = 0x00200000 | CKMD_LFINCOVR_OVERRIDE;

    /* Directly switch to EXTLF, LFTICK will be generated by HFOSC until EXTLF
     * is running.
     */
    HWREG(CKMD_BASE + CKMD_O_LFCLKSEL) = CKMD_LFCLKSEL_MAIN_EXTLF;

    /* Set EXTLF qualification function to be called by
     * PowerCC23X0_oscillatorISR(). This function will return true when getting
     * the LFCLKGOOD interrupt.
     */
    PowerLPF3_lfclkQualFxn = PowerCC23X0_extlfQual;

    /* Disallow standby until LF clock is running.
     * The PowerCC23X0_oscillatorISR() function will release the constraint once
     * PowerLPF3_lfclkQualFxn returns true.
     */
    Power_setConstraint(PowerLPF3_DISALLOW_STANDBY);

    /* Enable LFCLKGOOD interrupts */
    HWREG(CKMD_BASE + CKMD_O_IMSET) = CKMD_IMASK_LFCLKGOOD;
}
//From Old SDK (Simplelink_lowpower_f3_sdk_8_40_00_61)
/*
 *  ======== PowerLPF3_selectEXTLF ========
 */
void PowerLPF3_selectEXTLF(void)
{
    /* Set LFINC override to 31.25 kHz.
     *
     * The value is calculated as period in microseconds with 16 fractional
     * bits.
     * The EXTLF runs at 31.25 kHz -> 1 / 31250 Hz = 32 us.
     * 32 * 2^16 = 2097152 = 0x00200000
     */
    HWREG(CKMD_BASE + CKMD_O_LFINCOVR) = 0x00200000 | CKMD_LFINCOVR_OVERRIDE;
 
    /* Set LFCLK to EXTLF */
    HWREG(CKMD_BASE + CKMD_O_LFCLKSEL) = CKMD_LFCLKSEL_MAIN_EXTLF;
 
    /* Configure EXTLF to the right mux */
    GPIO_setConfigAndMux(PowerLPF3_extlfPin, GPIO_CFG_INPUT, PowerLPF3_extlfPinMux);
 
    /* Enable LFCLKGOOD */
    HWREG(CKMD_BASE + CKMD_O_IMSET) = CKMD_IMASK_LFCLKGOOD;
 
    /* Disallow standby until LF clock is running. Otherwise, we will only
     * vector to the ISR after we wake up from standby the next time since the
     * CKM interrupt is purposefully not configured as a wakeup source.
     */
    Power_setConstraint(PowerLPF3_DISALLOW_STANDBY);
 
    Log_printf(LogModule_Power, Log_INFO, "PowerLPF3_selectEXTLF: EXTLF selected");
}

此致、
Luke

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

    更新:

    在今天的测试中,新的 SDK 需要 调用新的 PowerLPF3_selectEXTLF() 函数,否则它将无法检测低频时钟的丢失。  它已从以前的 SDK 更改,我们没有为 SDK 的新版本更新我们的 selectEXTLF() 函数。

    我们使用的外部低频时钟信号频率为 32.768kHz。  PowerLPF3_selectEXTLF() 函数要求 31.25KHz 的时钟信号。 我们创建了一个名为 selectEXTLF() 的函数、该函数与 PowerLPF3_selectEXTLF() 函数完全相同、但它期望的时钟频率为 32.768KHz。

    PowerLPF3_selectEXTLF() 函数现在将本地静态函数设置为 PowerCC23X0_willatorISR 的回调函数  

      /*设置由 PowerCC23X0_willatorISR() 调用的 EXTLF 限定函数。 当获取 LFCLKGOOD 中断时、此函数将返回 true。

    现在我看到了新的 PowerLPF3_selectEXTLF() 函数与 PowerCC23X0.c 文件更加相关、我想知道我是否可以调用现有的 PowerLPF3_selectEXTLF()、然后立即切换到预期的频率。 请参阅下面的:

        PowerLPF3_selectEXTLF();
        /* Set LFINC override to 32.768 kHz.
         * The value is calculated as period in microseconds with 16 fractional bits.
         * The EXTLF runs at 32.768 kHz -> 1 / 32,768 Hz = 30.5176 us.
         * (1 / 32,768) * 2^16 = 2,000,000 = 0x001E8480 */
        HWREG((uint32_t)CKMD_BASE + CKMD_O_LFINCOVR) = 0x001E8480u | CKMD_LFINCOVR_OVERRIDE;


    这意味着在几个时钟周期内该值将设置错误。 是否有任何问题?

    是否可以在调用 PowerLPF3_selectEXTLF() 后更改此寄存器的值?

    可以在不禁用中断或其他任何功能的情况下设置此寄存器吗?

    此致、
    Luke

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

    嗨、Luke、

    感谢您联系我们! 我会看看这个、然后返回给您。

    同时、我简单浏览了一下、似乎较新的 SDK (9.14) 使用的实现与 9.11 中的实现不同。 您是否对后续 SDK 中的实现进行了测试?

    此致、

    Tarek D

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

    尊敬的 Tarek:

    他们下拉了最新版 SDK、并将 PowerCC23x0.c 和.h 文件与 SDK 中的文件 (9_11_00.18) 进行了比较。 只是一项更改、它是与 HFXT 故障有关的。

            /* If a HFXT fault or trackrefloss has occurred, the HFXT is
             * restarted.
             * When the HFXT is started, a "disallow standby" constraint is set, and
             * it is released when the HFXT has started (when getting the AMPSETTLED
             * signal). However, if an HFXT fault occurs while waiting for
             * AMPSETTLED, then the HFXT will be re-started setting a new constraint
             * without releasing the previous one. The constraint will end up
             * getting set twice but only released once (assuming the AMPSETTLED
             * signal is generated after the re-start).
             * To prevent this asymmetry, add a check to release the constraint if
             * the system is still waiting for the AMPSETTLED signal before
             * restarting the HFXT.
             */
            if (((maskedStatus & CKMD_MIS_AMPSETTLED_M) == 0U) &&
                ((HWREG(CKMD_BASE + CKMD_O_IMASK) & CKMD_IMASK_AMPSETTLED_M) == CKMD_IMASK_AMPSETTLED_M))
            {
                Power_releaseConstraint(PowerLPF3_DISALLOW_STANDBY);
            }
     

    他们仍在尝试了解 LFOSC 及其从 32.768kHz 到 32.768kHz 的距离以及因温度漂移的距离。 是否准确到足以支持 BLE 计时、事件等? 器件 48MHz 晶体是否会持续“校正“32kHz RC、以便在运行时保持足够低的漂移? 器件处于睡眠状态且晶体关闭时该怎么办?

    此致、
    Luke

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

    嗨、Luke、

    LFOSC 可用作睡眠时钟、但我强烈建议修改 SCA(睡眠时钟精度)并将其设置为更高的 ppm、因为其准确性不高。

    您可以使用 HCI 命令 HCI_EXT_SetSCACmd() 修改 SCA

    我相信确实会发生校正、如果时钟继续漂移、则会发生“时钟丢失“软复位。

    此致、

    Tarek D

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

    您好、Tarek 和 Luke、

    我注意到这个问题已改为使用 LFOSC、这不是这个问题主题的含义。  我们在相关主题“CC2340R2:内部 LFOSC 精度“中讨论了关于使用 LFOSC 的问题。

    此项与使用外部时钟信号 EXTLF 相关。  如上所述、电源模块中的实现发生了变化  Simplelink_lowpower_f3_sdk_8_40_00_61. With Simplelink_lowpower_f3_sdk_8_40_00_61, we were able to configure this to work with a input frequency of 32.768KHz.

    Now we need to get this to work with the SDK, Simplelink_lowpower_f3_sdk_9_11_00_18.  Above describes the issue we have been running into, loss of the clockloss feature.

    What is the best way to use Simplelink_lowpower_f3_sdk_9_11_00_18 and an external LF clock signal of 32.768KHz?

    Best Regards,

    Rick 

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

    嗨、Rick 和 Luke、

    由于我们已将此对话移至电子邮件、因此我将关闭此主题