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

Turning off peripherals before sleep mode (System ON)

Hi,

Is there an example code for nRF52832 were the system is configured to operate in a certain duty cycle, e.g. performing a certain task once every 100ms, and then goes to sleep mode, but where the current consumption during sleep mode is below 500uA? 

I was using sd_app_evt_wait(); to enter sleep mode, but this by itself doesn't bring me to low current. I still have around 7.5mA consumption. 

Thanks

  • Hi

    What peripherals are you using in your application? Do you not disable these peripherals at all before going to sleep? Most of our example projects that go to sleep (in system ON mode) use the idle_state_handle() function which calls an NRF_LOG_FLUSH and then the nrf_pwr_mgmt_run() function that prepares the device for sleep mode before calling sd_app_evt_wait().

    Do you really mean 7.5mA? If so, please show me what you did to get that amount of current consumption?

    Best regards,

    Simon

  • I really mean 7.5mA (7500 micro amps). When I go into system OFF mode, the current reduces below 0.1mA, which is the resolution of my current-meter. This means that the other parts of the board (except the nRF52832) consumes less than 0.1mA. 

    I am attaching my code. I am not sure which peripherals are on. 

    #include "rsm_config.h"
    #include "rsm_system.h"
    
    #include "rsm_sample_data.h"
    unsigned int guiSampleIdx = 0;
    
    int main(void)
    {
    	unsigned int uMsecCount = 0;
    	unsigned int err_code = 0;
    	unsigned int uiLedTicks = 0;
    	unsigned int uiButtonState = BUTTON_PRESSED;
    
    	unsigned int uiAdvertisingTimeout = 0;
    
    	unsigned int uiAlgPart = 1;
    
    	// Initialize the nrf log module
    	err_code = NRF_LOG_INIT(NULL);
    	APP_ERROR_CHECK(err_code);
    	NRF_LOG_DEFAULT_BACKENDS_INIT();
    
    	// Initialize the RTT module
    	SEGGER_RTT_Init();
    	SEGGER_RTT_WriteString(0, "RTT initialized\r\n");
    	NRF_LOG_INFO("RSM Application Started");
            
    	// Initialize power management
    	err_code = nrf_pwr_mgmt_init();
    	APP_ERROR_CHECK(err_code);
            
    
    	gSystemStatus = eNoBle;
    
    
            // If I write here nrf_pwr_mgmt_run(); the current consumption reduces below 100 micro-amps
    
    	// Enter main loop
    	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            // The main loop consumes 7.5mA (7500 micro-amps).
            
            for (;;)
    	{
            sd_app_evt_wait();
    
    	}
    
    }// end main

  • Hi

    I don't know what your calls to RSM does, and most of your settings seem to be custom made (not part of the SDK), so it's hard to say what you initialize and not. Where do you init the SoftDevice? If it isn't initialized at any point, then the sd_app_evt_wait() won't have any effect on the current consumption. 

    Please note that nrf_pwr_mgmt_run() does not put the device in System OFF mode, but puts it to sleep in System ON mode. It also checks whether the SoftDevice is initialized, and if it's not, it puts the device to sleep using the following calls:

    // Wait for an event.
            __WFE();
            // Clear the internal event register.
            __SEV();
            __WFE();

    Best regards,

    Simon

  • Hi, 

    Thanks for your answer. 

    Is there an example of a SW that doesn't do anything except for toggling a GPIO once every N msec, and consumes low current (since it is in System On sleep most of the time)? I searched the DevZone, as well as the directory: C:\Nordic_Semi\nRF5_SDK_17.0.2_d674dde\examples, but I was not able to find any such example. 

    If there is no such an example, can you create one?

    In your answers you referred to my calls to RSM. But there are no such calls in the code that I sent. There are only calls for NRF_LOG_INIT(NULL);  NRF_LOG_DEFAULT_BACKENDS_INIT(), SEGGER_RTT_Init();SEGGER_RTT_WriteString(0, "RTT initialized\r\n") and nrf_pwr_mgmt_init();. So you saw all the code. If you think I should add something (you referred to "SoftDevice") can you send me an example of how to add it, and where?

  • Hi

    From your description, it seems like you're looking for something like the GPIOTE example or the Timer Example(very basic), which both use a timer to generate events (toggling a LED controlled by a GPIO). 

    I meant the header files you refer to in your project, which I assume include some values of the other custom function calls.

    #include "rsm_config.h"
    #include "rsm_system.h"
    
    #include "rsm_sample_data.h"

    Best regards,

    Simon

Related