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

  • looks like your device is still in debug mode. Are you making your measurements in system_off while debugging? Try this example to make measurements which has been specifically made for this purpose.

  • Hi,

    I tried the above example. First i programmed the softdevice S110 and the bootloader. Through bootloader i flashed the firmware in the link you have mentioned. But still its taking the same amount of current. Does this has anything to do with S110 and Bootloader? Can you please help.

    Thanks & Regards, Sumit

  • 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

  • can you try to change the PULL config in this line

    nrf_gpio_cfg_sense_input(1, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_SENSE_LOW);
    

    for input there needs to some pull else the pin can go to invalid states while going to system off mode. Are you using custom board?

Related