nRF51822

1. 开发环境搭建

在这里插入图片描述

1.1 安装pack

MDK5在框架上做了调整,增加了许多新的特征。MDK5分成了MDK内核和software pack两部分,其内核部分仍然包括编译器、编辑器、安装包和调试跟踪,而sofrware pack又包括Device、CMSIS和MDK professional Midware。

对于nRF51822 我们需要安装NordicSemiconductor.nRF_DeviceFamilyPack。
Pack8.11.1 & Pack8.5.0 都需要安装
Pack8.5.0 基础外设试验需要用到
Pack8.11.1+ SDK12.2 开发BLE应用用到

Pack Download links

2. nRF51822 Power management (POWER)

2.1 System OFF mode

system off mode是最深省电模式。 在此模式下,系统的核心功能已关闭,所有正在进行的任务都将终止。 唯一有效的机制在这种模式下响应是复位和唤醒机制。
在系统关闭模式下保留一个或多个RAM块
可以通过以下方式进行唤醒:
1、GPIO信号
2、LPCOMP模块
3、复位中唤醒

在进入系统关闭模式之前,用户必须确保所有正在进行的EasyDMA交易已完成。 这通常是通过确保在进入系统关闭时启用EasyDMA的外围设备未激活来实现的。

void recover_state()
{
    uint32_t            loop_count = 0;
    if ((NRF_POWER->GPREGRET >> 4) == RESET_MEMORY_TEST_BYTE)
    {
        // Take the loop_count value.
        loop_count          = (uint8_t)(NRF_POWER->GPREGRET & 0xFUL);
        NRF_POWER->GPREGRET = 0;
    }

    loop_count++;
    NRF_POWER->GPREGRET = ( (RESET_MEMORY_TEST_BYTE << 4) | loop_count);

    tx_payload.data[1] = loop_count << 4;
}
void system_off( void )
{
#ifdef NRF51
    NRF_POWER->RAMON |= (POWER_RAMON_OFFRAM0_RAM0Off << POWER_RAMON_OFFRAM0_Pos) |
                        (POWER_RAMON_OFFRAM1_RAM1Off << POWER_RAMON_OFFRAM1_Pos);
#endif //NRF51
#ifdef NRF52
    NRF_POWER->RAM[0].POWER = RAM_RETENTION_OFF;
    NRF_POWER->RAM[1].POWER = RAM_RETENTION_OFF;
    NRF_POWER->RAM[2].POWER = RAM_RETENTION_OFF;
    NRF_POWER->RAM[3].POWER = RAM_RETENTION_OFF;
    NRF_POWER->RAM[4].POWER = RAM_RETENTION_OFF;
    NRF_POWER->RAM[5].POWER = RAM_RETENTION_OFF;
    NRF_POWER->RAM[6].POWER = RAM_RETENTION_OFF;
    NRF_POWER->RAM[7].POWER = RAM_RETENTION_OFF;
#endif //NRF52

    // Turn off LEDs before sleeping to conserve energy.
    bsp_board_leds_off();

    // Set nRF5 into System OFF. Reading out value and looping after setting the register
    // to guarantee System OFF in nRF52.
    NRF_POWER->SYSTEMOFF = 0x1;
    (void) NRF_POWER->SYSTEMOFF;
    while (true);
}

2.2 Emulated System OFF mode

如果设备处于调试接口模式,将模拟系统关闭以确保在系统关闭期间可以使用调试所需的所有必需资源,有关详细信息,请参阅DIF章节。 调试所需的资源包括以下关键组件:DIF,CLOCK,POWER,NVMC,MPU,CPU,CODE和RAM。 由于CPU在仿真系统关闭模式下保持打开状态,因此建议在进入系统关闭后直接添加无限循环,以防止CPU执行通常不应执行的代码。

2.3 System ON mode

System ON mode,CPU可以处于活动状态或休眠状态。 CPU通过执行CPU指令集中的WFI或WFE指令进入休眠状态。 在WFI休眠模式下,如果在NVIC中启用了相关中断,则CPU将因中断请求而被唤醒。 在WFE休眠模式下,无论NVIC中是否启用相关中断,CPU都会因中断请求而被唤醒。
子功率模式
在CPU休眠期间,在系统开启模式下,系统可以驻留在以下两种子电源模式之一:
•持续延迟
• 低电量
在恒定延迟模式下*(有关更多信息,请参阅特定于器件的产品规范)*,CPU唤醒延迟和PPI任务响应将保持不变并保持最小值。这可以通过在睡眠期间强制启用一组基本资源来保护,有关强制使用哪些资源的详细信息,请参阅设备特定的产品规范。具有恒定且可预测的等待时间的优点将以增加功耗为代价。通过触发CONSTLAT任务来选择恒定延迟模式。
在低功耗模式下,第44页的系统开启模式中描述的自动电源管理系统将是最有效的并且可以节省最多电量。具有低功率的优点将以具有不同的CPU唤醒延迟和PPI任务响应为代价。通过触发LOWPWR任务选择低功耗模式。
当系统进入ON模式时,默认情况下,它将处于低功耗子功耗模式。

  \brief   Wait For Interrupt
  \details Wait For Interrupt is a hint instruction that suspends execution until one of a number of events occurs.
 */
#define __WFI                             __wfi
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
nrf51822中文参考手册,nRF51822 是一款集成nRF51x系列无线收发器的超低功耗的片上系统 (Soc) , 包含一个32位ARM Cortex-M0 CPU , flash 存储器和模拟、数字外设。NORDIC SEMICONDUCTOR nRF51822 Product Specification v1.3 Liability disclaimer Nordic Semiconductor ASa reserves the right to make changes without further notice to the product to improve reliability, function or design. Nordic Semiconductor asa does not assume any liability arising out of the application or use of any product or circuits described herein ife support applications Nordic Semiconductor's products are not designed for use in life support appliances, devices, or systems where malfunction of these products can reasonably be expected to result in personal injury. Nordic Semiconductor ASa customers using or selling these products for use in such applications do so at their own risk and agree to fully indemnify Nordic Semiconductor ASA for any damages resulting from such improper use or sale Contact details Foryournearestdistributorpleasevisitwww.nordicsemi.com Information regarding product updates, downloads, and technical support can be accessed through your My Page account on our home page Main office: Otto Nielsens veg 12 Mailing address: Nordic Semiconductor 7052 Trondheim P.O. Box 2336 Norway 7004 Trondhe Phone:+4772898900 Norway 4772898989 画N远 NS-EN ISO 9001 CERTIFICATEDFIRM RoHS and reach statement Nordic semiconductor's products meet the requirements of Directive 2002/95/EC of the European Parliament and of the Council on the restriction of Hazardous Substances(roHS)and the requirements of the reach regulation(EC 1907/2006)on Registration, Evaluation, Authorization and Restriction of Chemicals. The SvHC(Substances of Very High Concern) candidate list is continually being updated Complete hazardous substance reports material composition reports and latest version of nordics reach statementcanbefoundonourwebsitewww.nordicsemicom Page 2 of 67 NORDIC SEMICONDUCTOR nRF51822 Product Specification v1.3 Datasheet status Status Description Objective Pro

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

「Thunder Studio」

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值