51822蓝牙笔记之时钟和功耗的关系

The softdevice needs a low-frequency clock to be able to do the protocol timing. With this enum, you tell the softdevice what kind of clock source you use, and the accuracy of it. In general you have 3 options for this source://有三个时钟源可以选择

  • 1、外部晶振:External crystal: Using an external 32.768 kHz crystal is the option that gives the lowest current consumption(提供最低功耗. If you have this on your board, you should use it. You have to choose the appropriate accuracy for your crystal, so that the softdevice can take the accuracy into consideration to know how much the clock may drift over a certain period. It will use this information to make sure it compensates correctly and wakes up the chip just when needed.

Enums used for this mode with softdevice: NRF_CLOCK_LFCLKSRC_XTAL_x_PPM, where x is the accuracy of your crystal.

When not using softdevice, external 32kHz crystal is started with the following code:

When not using a softdevice, starting external 32kHz crystal is done with the following code:

    NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos);
    NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
    NRF_CLOCK->TASKS_LFCLKSTART = 1;

    // Wait for the low frequency clock to start
    while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0) {}
    NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
  • 2、内部RC振荡器  :Internal RC oscillator: The chip have an internal RC oscillator that has an accuracy of 250 ppm when calibrated. The only thing you can choose through this enum for the RC is the calibration interval. As given in the nRF51822 PS, the accuracy is specified when the temperature is relatively stable, and it is calibrated every 4 seconds(每四秒校准一次), so this is the calibration interval that should be used for most (all?) applications.

When the RC is calibrated, the 16 MHz clock must run while calibration is ongoing, which causes an increase in the average current consumption of about 6-7 µA with a 4 s interval. The RC also uses more current than a crystal, so the total increase will most likely be 8-10 µA, compared with a 20 ppm crystal.

       Enums used for this mode: NRF_CLOCK_LFCLKSRC_RC_250_PPM_xMS_CALIBRATION, where x is the wanted calibration interval, typically 4000 ms.

In recent SDK's, there has been added options with calibration relative to temperature change which has the enum NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_xMS_CALIBRATION. This will have lower current consumption than NRF_CLOCK_LFCLKSRC_RC_250_PPM_xMS_CALIBRATION options as the RC is only calibrated if there is a temperature change of 0.5 deg C or more. The frequency drift of the RC is in fact a result of temperature change. The internal TEMP peripheral on the nRF51 is used to make a temperature measurement. If there is a temperature change of 0.5 deg C or greater since the last calibration, then the nRF51 is re-calibrated. If the temperature change is <0.5 deg C, then the RC is not calibrated. The calibration of the RC takes 17ms but measuring the temperature only takes 35us, which explains why measuring the temperature consumes less current then when calibrating. If there are frequent temperature changes, the current consumption increase will be worst case 8-10 uA compared to a 20ppm crystal. If there are infrequent temperature changes, then the current consumption increase is around ~2uA best case compared to a 20ppm crystal.(当温度改变的时候,选择校准精度20ppm,功耗会浪费最低2ua  最高10ua)

  • 3、由16M高速时钟分频合成:A synthesized 32.768 kHz clock: This tells the softdevice to use the 16 MHz clock to synthesize a low-frequency clock. Since the low-frequency clock is used in the sleeping periods between for example conneciton evetns, this means that the 16 MHz must always run, giving a substantial increase in current consumption (most likely mA average current consumption instead of µA)(使用合成意味着16M高速运行,将增加功耗从uA到mA).         In general, there should never be a reason to use this clock source, and you should always be able to use the RC oscilator instead of the synthesized clock.
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值