How can i enable dcdc regulator

Hi everybody,

I want to try dcdc module. I want to figure out How can i reduce current consumption.

I have a this 2 configuration in sdk_config.h

1) 

// <e> POWER_ENABLED - nrf_drv_power - POWER peripheral driver - legacy layer
//==========================================================
#ifndef POWER_ENABLE
#define POWER_ENABLED 0
#endif
// <o> POWER_CONFIG_IRQ_PRIORITY  - Interrupt priority
 

// <i> Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice
// <0=> 0 (highest)
// <1=> 1
// <2=> 2
// <3=> 3
// <4=> 4
// <5=> 5
// <6=> 6
// <7=> 7

#ifndef POWER_CONFIG_IRQ_PRIORITY
#define POWER_CONFIG_IRQ_PRIORITY 6
#endif

// <q> POWER_CONFIG_DEFAULT_DCDCEN  - The default configuration of main DCDC regulator
 

// <i> This settings means only that components for DCDC regulator are installed and it can be enabled.

#ifndef POWER_CONFIG_DEFAULT_DCDCEN
#define POWER_CONFIG_DEFAULT_DCDCEN 1
#endif

// <q> POWER_CONFIG_DEFAULT_DCDCENHV  - The default configuration of High Voltage DCDC regulator
 

// <i> This settings means only that components for DCDC regulator are installed and it can be enabled.

#ifndef POWER_CONFIG_DEFAULT_DCDCENHV
#define POWER_CONFIG_DEFAULT_DCDCENHV 0
#endif

// </e>


2)
// <e> NRFX_POWER_ENABLED - nrfx_power - POWER peripheral driver
//==========================================================
#ifndef NRFX_POWER_ENABLED
#define NRFX_POWER_ENABLED 0
#endif
// <o> NRFX_POWER_CONFIG_IRQ_PRIORITY  - Interrupt priority
 
// <0=> 0 (highest)
// <1=> 1
// <2=> 2
// <3=> 3
// <4=> 4
// <5=> 5
// <6=> 6
// <7=> 7

#ifndef NRFX_POWER_CONFIG_IRQ_PRIORITY
#define NRFX_POWER_CONFIG_IRQ_PRIORITY 6
#endif

// <q> NRFX_POWER_CONFIG_DEFAULT_DCDCEN  - The default configuration of main DCDC regulator
 

// <i> This settings means only that components for DCDC regulator are installed and it can be enabled.

#ifndef NRFX_POWER_CONFIG_DEFAULT_DCDCEN
#define NRFX_POWER_CONFIG_DEFAULT_DCDCEN 1
#endif

// <q> NRFX_POWER_CONFIG_DEFAULT_DCDCENHV  - The default configuration of High Voltage DCDC regulator
 

// <i> This settings means only that components for DCDC regulator are installed and it can be enabled.

#ifndef NRFX_POWER_CONFIG_DEFAULT_DCDCENHV
#define NRFX_POWER_CONFIG_DEFAULT_DCDCENHV 0
#endif

// </e>

What is the differences between these two configurations?

and is this enough for enable dcdc regülator.


Parents
  • The reason some of the definitions say NRFX while others doesn't is only for backwards compatibility. If you open your application project, and search for the apply_old_config.h.

    In the end, it is the NRFX_POWER_CONFIG_DEFAULT_DCDCEN that is being used, but it may not be the same as you define it to be in the sdk_config.h. You can see in the apply_old_config.h file that if the POWER_ENABLED is defined (it can be set to 0 but still be defined), it will undef NRFX_POWER_CONFIG_DEFAULT_DCDCEN and then redefine it to be equal to POWER_CONFIG_DEFAULT_DCDCEN. 

    However, I never remember which way this goes without looking it up in the apply_old_config.h file, so I ususally just set them to be equal in sdk_config.h.

    You may also need to add the file SDK\modules\nrfx\drivers\src\nrfx_power.c, if you have not already included it. You also need to call nrf_drv_power_init(NULL), and include the files needed for this, such as SDK\integration\nrfx\legacy\nrf_drv_power.c

    When this is called, it will call nrfx_power_init() with p_config.dcdcen = NRFX_POWER_CONFIG_DEFAULT_DCDCEN.

    To verify that the DCDC is enabled, you can read the DCDCEN register using nrfjprog:

    nrfjprog --memrd 0x40000578

    and it should say 0x00000001 if it is enabled, and 0x00000000 if it is disabled. 

    Hope that helps. Let me know if you are stuck.

    Best regards,

    Edvin

Reply
  • The reason some of the definitions say NRFX while others doesn't is only for backwards compatibility. If you open your application project, and search for the apply_old_config.h.

    In the end, it is the NRFX_POWER_CONFIG_DEFAULT_DCDCEN that is being used, but it may not be the same as you define it to be in the sdk_config.h. You can see in the apply_old_config.h file that if the POWER_ENABLED is defined (it can be set to 0 but still be defined), it will undef NRFX_POWER_CONFIG_DEFAULT_DCDCEN and then redefine it to be equal to POWER_CONFIG_DEFAULT_DCDCEN. 

    However, I never remember which way this goes without looking it up in the apply_old_config.h file, so I ususally just set them to be equal in sdk_config.h.

    You may also need to add the file SDK\modules\nrfx\drivers\src\nrfx_power.c, if you have not already included it. You also need to call nrf_drv_power_init(NULL), and include the files needed for this, such as SDK\integration\nrfx\legacy\nrf_drv_power.c

    When this is called, it will call nrfx_power_init() with p_config.dcdcen = NRFX_POWER_CONFIG_DEFAULT_DCDCEN.

    To verify that the DCDC is enabled, you can read the DCDCEN register using nrfjprog:

    nrfjprog --memrd 0x40000578

    and it should say 0x00000001 if it is enabled, and 0x00000000 if it is disabled. 

    Hope that helps. Let me know if you are stuck.

    Best regards,

    Edvin

Children

  • is this function necessery? 

        err_code = sd_power_dcdc_mode_set(NRF_POWER_DCDC_ENABLE);
        APP_ERROR_CHECK(err_code);


    is nrfx just for old version ? can i remove it from sdk_config.h?

    where should i use nrfx_power_init()? begining of main function or anywhere else?
  • no. NRFX is the new drivers. Keep them. You can remove the old ones if you like.

    The apply_old_config.h is located in SDK17.1.0\integration\nrfx\legacy\apply_old_config.h

    Yes. If you have enabled the softdevice, you can use sd_power_dcdc_mode_set(), if not, you can use the nrf_drv_power_init(NULL),

    Best regards,

    Edvin

  • I am using SDK17 and nrf52810 custom board. I tried to manage enable DCDC Regulator. For this, i removed old version config sentences, i changed the sdk_config.h :

    // <e> NRFX_POWER_ENABLED - nrfx_power - POWER peripheral driver
    //==========================================================
    #ifndef NRFX_POWER_ENABLED
    #define NRFX_POWER_ENABLED 1
    #endif
    // <o> NRFX_POWER_CONFIG_IRQ_PRIORITY  - Interrupt priority
     
    // <0=> 0 (highest)
    // <1=> 1
    // <2=> 2
    // <3=> 3
    // <4=> 4
    // <5=> 5
    // <6=> 6
    // <7=> 7

    #ifndef NRFX_POWER_CONFIG_IRQ_PRIORITY
    #define NRFX_POWER_CONFIG_IRQ_PRIORITY 6
    #endif

    // <q> NRFX_POWER_CONFIG_DEFAULT_DCDCEN  - The default configuration of main DCDC regulator
     

    // <i> This settings means only that components for DCDC regulator are installed and it can be enabled.

    #ifndef NRFX_POWER_CONFIG_DEFAULT_DCDCEN
    #define NRFX_POWER_CONFIG_DEFAULT_DCDCEN 1
    #endif

    // <q> NRFX_POWER_CONFIG_DEFAULT_DCDCENHV  - The default configuration of High Voltage DCDC regulator
     

    // <i> This settings means only that components for DCDC regulator are installed and it can be enabled.

    #ifndef NRFX_POWER_CONFIG_DEFAULT_DCDCENHV
    #define NRFX_POWER_CONFIG_DEFAULT_DCDCENHV 0
    #endif

    // </e>


    end then i call this function respectively. is there any wrong thing in enable process?

    ret_code_t err_code = nrf_sdh_enable_request();
    APP_ERROR_CHECK(err_code);

    err_code = nrfx_drv_power_init(NULL);
    APP_ERROR_CHECK(err_code);

    err_code = sd_power_dcdc_mode_set(NRF_POWER_DCDC_ENABLE); APP_ERROR_CHECK(err_code);

    err_code  = nrf_sdh_ble_enable(&ram_start);
    APP_ERROR_CHECK(err_code);  

     

  • Don't know. Does it work? Do any of the APP_ERROR_CHECK() return an err_code != 0? Does the register change?

    What are you running the application on? The nRF52832DK, or an actual nRF52810?

    Best regards,

    Edvin

Related