This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2640R2F: Switching between LDO and DC-DC modes at runtime

Part Number: CC2640R2F

Hi team,

My customer has a battery powered device with CC2640R2F based on a reference schematic using internal DC-DC. The customer has concerns that the device may be broken by saturating inductor of the DC-DC by applying a strong external magnetic field like a neodymium magnet.

Fortunately, the board has a magnetic field sensor.  We want to use the sensor signal to switch the power mode to LDO mode when an external field is detected to save the device and then switch back if the magnet is removed to save power.

Please advise how to change the power mode to LDO mode and back again while the app is running?

  • Hi Vsevolod,

    Have you looked at the DriverLib API for power control? There is APIs available to shift source from software:

    dev.ti.com/.../group__pwrctrl__api.html

  • Hi Max,

    Thank you for the answer! Yes I seen this.

    Do we have any examples how and when to use it?

    Is there any restrictions? Can I use the function in an interrupt context?

  • Hi,

    You should be free to use it from both Task and ISR context as far as I know. However, I fail to see how this would improve the customer situation? The GLDO and DC/DC is internally connected to each other, switching to the GLDO would not eliminate the connection to the inductor. This means that the risk of interference via the inductor remains, even in GLDO mode.

    I would suggest they test out, using for example a LaunchPad, how they see it being impacted by the presence of the expected field in both use-cases. If they find it to be a problem, I would assume they would have to actually run in GLDO mode only, excluding the inductur from the design. 

  • Max,

    The customer and I sugggest that in GLDO mode the DCDC_SW pin have HiZ mode and there will be no current flow through the inductor.

  • Hi V,

    That could be, but I would not rule out some other dependency. This is why I suggest you actually try it out with for example an LaunchPad to verify the behavior before applying it to the actual product.  

  • Hi Max,

    We tried to implement the switching to LDO using the code:

    #include <power_switcher.h>
    #include <driverlib/pwr_ctrl.h>
    #include <ti/drivers/PIN.h>
    #include <ti/drivers/pin/PINCC26XX.h>
    #include "board.h"
    
    volatile int pin_value = 0;
    static PIN_State PowerSwitchPinState;
    static PIN_Handle PowerSwitchPinHandle;
    const PIN_Config PowerSwitchTable[] = {
        CC2640R2_LAUNCHXL_HALL_SENSOR | PIN_INPUT_EN | PIN_NOPULL | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS,
        PIN_TERMINATE
    };
    
    static void PowerSwitchPinIntHandler(PIN_Handle handle, PIN_Id pinId) {
       if(handle == PowerSwitchPinHandle) {
           power_switcher_check();
       }
    }
    
    
    void power_switcher_init() {
        PowerSwitchPinHandle = PIN_open( &PowerSwitchPinState,PowerSwitchTable);
        if(PowerSwitchPinHandle == NULL) {
            return;
        }
    
        PIN_registerIntCb(PowerSwitchPinHandle,&PowerSwitchPinIntHandler);
        PIN_setInterrupt(PowerSwitchPinHandle, CC2640R2_LAUNCHXL_HALL_SENSOR | PIN_IRQ_BOTHEDGES);
    
    }
    
    #pragma FUNCTION_OPTIONS(power_switcher_check, "--opt_level=0")
    void power_switcher_check() {
        pin_value = PIN_getInputValue(CC2640R2_LAUNCHXL_HALL_SENSOR);
        if(PIN_getInputValue(CC2640R2_LAUNCHXL_HALL_SENSOR)) {
                PowerCtrlSourceSet(PWRCTRL_PWRSRC_DCDC);
        } else {
                PowerCtrlSourceSet(PWRCTRL_PWRSRC_GLDO);
        }
    }
    

    We see that GPIO Irq callback is processed when a magnet is close to board. But invoking PowerCtrlSourceSet have absolutely no effect.

    Also we tried to call PowerCtrlSourceSet(PWRCTRL_PWRSRC_GLDO); in SimplePeripheral_init and this also have no effect.

    We still observe oscillations on DCDC_SW pin after invoking PowerCtrlSourceSet(PWRCTRL_PWRSRC_GLDO) func.

    Max, please advise how to disable the DCDC for a some time?

  • Hi Vsevolod,

     I would expect this could happen of the device is invoking the power policy. The power policy calls “SysCtrl_DCDC_VoltageConditionalControl” which can decide to turn on the DC/DC again for power consumption reasons.

    To not have this behavior you would need to comment this call out from the PowerCC26XX_tirots.c file (The Power DPL found under the kernel/tirots folder in the SDK) and include it in the project.

    Could you try this out and see if it changes the situation?

  • Max,

    Thank you!

    We add PowerCC26XX_tirtos.c to the project and add flag checking in prior to SysCtrl_DCDC_VoltageConditionalControl(); we achieved the switching to LDO.