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

How to put the nrf52832 into deep sleep mode

Hello,

I am currently using nRF52832 with SDK v11.0.0 and S132 v2.0.0. I am also using the soft device as my application requires. I have been trying to put the CPU into SYSTEM OFF mode using the following:

// Configure the "main" button:

nrf_gpio_cfg_sense_input( BUTTON_MAIN_PIN, NRF_GPIO_PIN_PULLUPNRF_GPIO_PIN_SENSE_LOW );

// Enter SYSTEM OFF mode

sd_power_system_off();

There is one major problem -- the system is still pulling a lot of current ~3.5mA. I don't understand what is going on. I read this in the manual, in section 18.2: "

Before entering System OFF mode, the user must make sure that all on-going EasyDMA transactions have been completed. This is usually accomplished by making sure that the EasyDMA enabled peripheral is not active when entering System OFF. "

Questions: -Am I using the correct function call for my version of the SDK to put the system in System OFF mode?

                  - Is the EasyDMA consuming that much current?! If so, how do I disable EasyDMA and ensure all transactions are complete?

                   - What other calls am I missing?

  • Of course putting the reset call in does not help you: it is in an endless boot loop now. Indeed, make sure your debugger is detached. You can do this with the IDE. If don't now how, for now, close it completely and reset your target manually.

  • Thank you for your reply. I made sure to flash my app into the target, then immediately remove the debugger, etc. I even detached the battery and reattached it, but still, same current consumption. 

    // Configure the "main" button:
        nrf_gpio_cfg_sense_input( BUTTON_MAIN_PIN,
                                  NRF_GPIO_PIN_PULLUP,
                                  NRF_GPIO_PIN_SENSE_LOW );
    
        // SWCLK
        // SWDIO
        nrf_gpio_cfg_input( CONSOLE_TX_PIN, NRF_GPIO_PIN_PULLDOWN );
        nrf_gpio_cfg_input( CONSOLE_RX_PIN, NRF_GPIO_PIN_PULLDOWN );
    
        // Turn off the NVM:
        bool stat = extNvm_enterDeepPowerDown( true );
    
        if ( stat == false )
        {
            APP_PRINTF( "extNvm_enterDeepPowerDown() failed\n" );
            // Log the error.
            logDevNoDesc( LIB_ORIG_BLE, stat, REG_ERR );
        }
    
        // Turn off the AMOLED:
        displayQDisplayOff( NULL, NULL );
    
        // Before entering System OFF mode, the user must make sure that all
        // on-going EasyDMA transactions have been completed. This is usually
        // accomplished by making sure that the EasyDMA enabled peripheral is not
        // active when entering System OFF and this is achieved by disabling TWIM
        // and SPI busses.
    
        i2c_master_uninit();
        spi_uninit();
    
        //sd_softdevice_disable();
        DebugConsole_Disable();
    
    
        uint32_t errCode = sd_power_system_off();
    
        if ( errCode != NRF_SUCCESS )
        {
            APP_PRINTF( "sd_power_system_off() failed\n" );
            // Log the error.
            logDevNoDesc( LIB_ORIG_BLE, errCode, FATAL_ERR );
        }

    There must be something else missing...going through the manual and devzone is all I have at this point.

  • Hi

    Very well, let's move on to the EasyDMA fix. There is an erratum where the EasyDMA isn't disabled properly by just disabling the TWI/SPI peripherals. Please check out this link and implement the workaround for the TWI and SPI you're using in order to power flush and make sure EasyDMA is turned off properly. Please note that you have to reinitialize the peripherals when waking up to get back up and running properly. 

    Best regards,

    Simon

  • Thank you for the update. Last question, what is the correct way to permanently turn off the Debug Mode interface on the nRF52832 chip? Do I need to write 

    NRF_UICR->APPROTECT = 0xFF // is this the correct way ?

    sd_flash_protect(<some register>) // do I need to use this at all? 

    Please advise as well. Perhaps the errata work-around is all I need. 

  • Hi

    Power cycling the board after programming it should be sufficient to get out of debug mode. Just turn the chip off and remove any power sources (battery, USB connector, etc.), then attach the power source and turn the DK on again. You shouldn't need any explicit code for this. Additionally, when the JLink debugger is connected, debug mode should be able to be turned off with the JLink commander using the "writeDP 1 0" command, although I haven't tried this myself. Hopefully, the EasyDMA workaround will work out for you.

    Best regards,

    Simon

    PS: I'll be out of office for the remainder of this week, but I'll get back to you upon my return!

Related