This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to put the system in off mode nrf51822

Hello,

I want to measure the current in system off mode. I am flashing the S110 softdevice and bootloader in the nrf51822 chip. Using BLE i am flashing an application code which does nothing but calls the function sd_power_system_off(). When we measure the current the it is about 1mA. We are using the Insight SIP evaluation kit. Also after flashing the code we restarted the system and removed the debugger.

Could you please guide us as to where we are wrong.

Thanks & Regards, Sumit Singhal

Parents
  • Hi,

    The code is as below:

    /* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved.
     *
     * Use of this source code is governed by a BSD-style license that can be
     * found in the license.txt file.
     */
    #include <stdbool.h>
    #include <stdint.h>
    #include "nrf.h"
    #include "nrf_gpio.h"
    #include "boards.h"
    
    #define BTN_PRESSED 0
    #define BTN_RELEASED 1
    
    int main(void)
    {
        // Configure BUTTON0 as a regular input
        nrf_gpio_cfg_input(0, NRF_GPIO_PIN_NOPULL);
        
        // Configure BUTTON1 with SENSE enabled 
        nrf_gpio_cfg_sense_input(1, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_SENSE_LOW);
        
        // Configure the LED pins as outputs
        nrf_gpio_range_cfg_output(LED_START, LED_STOP);
        
        nrf_gpio_pin_set(2);
        
        // If desired, change the RAM retention parameters:
        NRF_POWER->RAMON = POWER_RAMON_ONRAM0_RAM0On   << POWER_RAMON_ONRAM0_Pos
                         | POWER_RAMON_ONRAM1_RAM1On   << POWER_RAMON_ONRAM1_Pos
                         | POWER_RAMON_OFFRAM0_RAM0Off << POWER_RAMON_OFFRAM0_Pos
                         | POWER_RAMON_OFFRAM1_RAM1Off << POWER_RAMON_OFFRAM1_Pos;
        
        while(1)
        {     
            // If BUTTON0 is pressed..
            if(nrf_gpio_pin_read(0) == BTN_PRESSED)
            {
                // Clear LED0
                nrf_gpio_pin_clear(2);
    
                // Enter system OFF. After wakeup the chip will be reset, and the MCU will run from the top 
                NRF_POWER->SYSTEMOFF = 1;
            }
        }
    }
    

    Thanks & Regards, Sumit

Reply
  • Hi,

    The code is as below:

    /* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved.
     *
     * Use of this source code is governed by a BSD-style license that can be
     * found in the license.txt file.
     */
    #include <stdbool.h>
    #include <stdint.h>
    #include "nrf.h"
    #include "nrf_gpio.h"
    #include "boards.h"
    
    #define BTN_PRESSED 0
    #define BTN_RELEASED 1
    
    int main(void)
    {
        // Configure BUTTON0 as a regular input
        nrf_gpio_cfg_input(0, NRF_GPIO_PIN_NOPULL);
        
        // Configure BUTTON1 with SENSE enabled 
        nrf_gpio_cfg_sense_input(1, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_SENSE_LOW);
        
        // Configure the LED pins as outputs
        nrf_gpio_range_cfg_output(LED_START, LED_STOP);
        
        nrf_gpio_pin_set(2);
        
        // If desired, change the RAM retention parameters:
        NRF_POWER->RAMON = POWER_RAMON_ONRAM0_RAM0On   << POWER_RAMON_ONRAM0_Pos
                         | POWER_RAMON_ONRAM1_RAM1On   << POWER_RAMON_ONRAM1_Pos
                         | POWER_RAMON_OFFRAM0_RAM0Off << POWER_RAMON_OFFRAM0_Pos
                         | POWER_RAMON_OFFRAM1_RAM1Off << POWER_RAMON_OFFRAM1_Pos;
        
        while(1)
        {     
            // If BUTTON0 is pressed..
            if(nrf_gpio_pin_read(0) == BTN_PRESSED)
            {
                // Clear LED0
                nrf_gpio_pin_clear(2);
    
                // Enter system OFF. After wakeup the chip will be reset, and the MCU will run from the top 
                NRF_POWER->SYSTEMOFF = 1;
            }
        }
    }
    

    Thanks & Regards, Sumit

Children
No Data
Related