Skip to main content
ssk
Associate III
June 30, 2015
Question

SPC560D - power control modes

  • June 30, 2015
  • 61 replies
  • 8056 views
Posted on June 30, 2015 at 16:50

Hello,

I am using standby mode for SPC560D MCU. The datasheet mentions about using DRUN or software reset for exiting this mode. Can you please explain on,

1. How to configure the DRUN mode? I tried using API 'halSPCSetRunMode' for switching between modes. But when used for DRUN mode, it does not exit the standby mode correctly and a power reset is required. Is any thing missing for this?

2. Which are the ways to use software reset for SPC560D? Can I use watchdog reset as a software reset? Is there any other means for software reset?

Thanks in advance for any help.

Mike.
    This topic has been closed for replies.

    61 replies

    ssk
    sskAuthor
    Associate III
    July 2, 2015
    Posted on July 02, 2015 at 10:29

    I am using standby mode as my product needs < 2mA of current when in low power mode. I tried using stop mode but it fails to meet the current requirements.

    Can you please provide the answers for queries?

    Thanks.

    Mike.

    Erwan YVIN
    ST Employee
    July 2, 2015
    Posted on July 02, 2015 at 11:26

    Hello Mike ,

    can you send me your example ? Did you trySPC560Dxx OS-Less WKPU LPM Test Application for Discovery ? You can adapt this program with STANDBY Mode. you should correctly set LP MODE for Standby and add the standby mode in LP3 for example

    /**
    * @brief Peripheral mode 3 (low power mode).
    * @note Do not change this setting, it is expected to be the ''stop only''
    * mode.
    */
    #if !defined(SPC5_ME_LP_PC3_BITS) || defined(__DOXYGEN__)
    #define SPC5_ME_LP_PC3_BITS (SPC5_ME_LP_PC_STOP0)
    #endif
    /* Enable WKPU PCTL */
    halSPCSetPeripheralClockMode(69,
    SPC5_ME_PCTL_RUN(2) | SPC5_ME_PCTL_LP(3));

    I am using a WKPU Unit to go back in RUN Mode Best Regards Erwan
    ssk
    sskAuthor
    Associate III
    July 2, 2015
    Posted on July 02, 2015 at 13:00

    Hello Erwan,

    Thanks for the guidelines. Is the test app you mentioned available with v3.4.x? I have yet not installed the v3.5.x. Can you please provide me the test application here?

    All the settings look ok as the device enters the LPM mode but can not exit it.

    Thanks.

    Mike.

    Erwan YVIN
    ST Employee
    July 2, 2015
    Posted on July 02, 2015 at 15:26

    Hello Mike ,

    You can find in this attachment the LPM Test application

    This application is integrated in the application wizard from SPC5Studio 3.5.0+ version

    Do not hesitate to send me your application ?

    Best regards

    Erwan

    ________________

    Attachments :

    SPC560Dxx_OS-Less_WKPU_LPM_Test_Application_for_Discovery.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0UI&d=%2Fa%2F0X0000000bZY%2FYgBvr_C1Ph2oj_hAujv2d0qKbQAasWTN0KEcnQX73Kc&asPdf=false
    ssk
    sskAuthor
    Associate III
    July 2, 2015
    Posted on July 02, 2015 at 16:12

    Hello Erwan,

    Thanks for the test application. I have implemented the same and it works for STOP mode but not for STANDBY mode. Can you please try to configure your test app for STANDBY mode and check?

    As communicated, my app enters the STANDBY mode but I am unable to pull it out of it. As per specifications, I tried using DRUN mode to come out of STANDBY but no success. Can you please check your app for STANDBY mode?

    Thanks.

    Mike.

    ssk
    sskAuthor
    Associate III
    July 6, 2015
    Posted on July 06, 2015 at 11:30

    Hello Erwan,

    Have you tried 'STANDBY' mode? Please respond.

    Hello forum members,

    Has anyone tried using 'STANDBY' mode? Any help?

    Thanks.

    Mike.

    Erwan YVIN
    ST Employee
    July 7, 2015
    Posted on July 07, 2015 at 13:29

    Hello Mike ,

    i will send you an example application LPM on Standby mode.

      Best Regards

                  Erwan

    Erwan YVIN
    ST Employee
    July 7, 2015
    Posted on July 07, 2015 at 15:36

    Hello Mike ,

    You can find in this attachment an example of STANDBY mode LPM Application

    First ,

    1)with a wire : plug the PA[11] (BUTTON) with PA[3] (IRQ #0)

    ==>Click on BUTTON SW2 to go in STANDBY Mode

    ==> Rely by a wire PA[2] to generate a trigger (WKPU) in order to go in RUN Mode

    Best regards

    Erwan

    ________________

    Attachments :

    SPC560Dxx_OS-Less_WKPU_STANDBY_LPM_Test_Application_for_Discovery.7z : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0Sc&d=%2Fa%2F0X0000000bZZ%2FpwJUdNGGuatcEo1ThwSB_kpmv5uR8oymKmOQ2Os1LQg&asPdf=false
    ssk
    sskAuthor
    Associate III
    July 8, 2015
    Posted on July 08, 2015 at 14:18

    Hello Erwan,

    Thanks for the test application. I believe you must have tested it. I have implemented standby/run mode in the same way as you did though the pin used are different.

    What I observed is I do not receive the interrupt for wakeup pin when MCU enters standby mode. But the same code works when I put the device to stop mode and exits when wakeup interrupt is received. I looked at the reference manual (page #138), it states as wakeup event as exit source for standby mode while wakeup interrupt or wakeup event as source for stop mode to exit. Does this make sense?

    How to serve event for wakeup? When can I configure event for wakeup?

    Thanks for your speedy response.

    Mike.

    Erwan YVIN
    ST Employee
    July 8, 2015
    Posted on July 08, 2015 at 15:58 Hello Mike , Yes, this application has been tested and is working for STANDBY. Did you have this patch in hal_lld.h ?

    <diff><![CDATA[--- components/spc560dxx_hal_drivers_component/lib/include/hal_lld.h
    +++ components/spc560dxx_hal_drivers_component/lib/include/hal_lld.h
    @@ -599,8 +599,7 @@
    * @note Not defined, available to application-specific modes.
    */
    #if !defined(SPC5_ME_LP_PC7_BITS) || defined(__DOXYGEN__)
    -#define SPC5_ME_LP_PC7_BITS (SPC5_ME_LP_PC_HALT0 | \
    - SPC5_ME_LP_PC_STOP0)
    +#define SPC5_ME_LP_PC7_BITS (SPC5_ME_LP_PC_STANDBY0)
    #endif
    /**
    @@ -737,7 +736,8 @@
    SPC5_RUNMODE_RUN2 = 6,
    SPC5_RUNMODE_RUN3 = 7,
    SPC5_RUNMODE_HALT0 = 8,
    - SPC5_RUNMODE_STOP0 = 10
    + SPC5_RUNMODE_STOP0 = 10,
    + SPC5_RUNMODE_STANDBY = 13
    } spc5_runmode_t;

    After importing the project , you should regenerate in order to apply the patch ? the Wakeup event is served in :

    /*
    * Interrupt_wakeup ISR function (vector 46).
    */
    OSAL_IRQ_HANDLER(vector46) {
    uint32_t wisr;
    OSAL_IRQ_PROLOGUE();
    /* ISR code here.*/
    wisr = WKUP.WISR.R;
    WKUP.WISR.R = wisr;

    //Clear interrupt

    gotoRunMode();

    //Put device to run mode

    OSAL_IRQ_EPILOGUE();
    }

    The configuration could be done in the init :

    void

    configureWKPU(

    void

    ) {
    INTC_PSR(46) = 7;
    WKUP.WIPUER.R = 0x0003ffff;

    //Enable pullups on all wakeup pins

    WKUP.WISR.R = 0x00000008;

    //Clear interrupt flag

    WKUP.WRER.R = 0x00000008;

    //Enable WKUP[3]for wakeup event

    WKUP.WIREER.R = 0x00000008;

    //Enable WKUP[3]for wakeup event

    WKUP.WIFER.R = 0x00000008;

    // Enable Filter

    }

    Best Regards Erwan