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.

SM470R1B1M-HT power saving methods.

Other Parts Discussed in Thread: SM470R1B1M-HT

Hi,

I am trying to put SM470R1B1M-HT in low power mode( halt mode or standby mode) to save power. I am powering up from battery, this controller is consuming more power, form the  datasheet we know that  bit.0 and bit.1 of CLKCNTL register can be used to put in standby or halt mode.

When i try like this

CLKCNTL |=  LPM_STANDBY;

I didn't see any reduction in power consumption. I am using RTI interrupt to wakeup from standby mode. RTI will work even while controller is in standby mode, To set specific time intervel i am using RTI interrupt, after expiring interrupt it will come out of standby mode.

Did anyone tried low powermode with this controller? any suggestion on how to use low power mode techninque? any other ways?

Regards,

Pavan.

  • Pavan,
    I have a few questions.
    Can you post your code?
    What is the frequency of the wakeup?
    What is status of flash?

    Also, I believe a dummy read of the CLKCNTL register is required after setting it to activate the new mode.
    Regards,
    Wade
  • Hi Wade,

    Thanks for your reply,

    I am not using ZPLL feature, I have disabled it with PLLDIS pin(pin.57). I am using 7.5MHz crystal oscillator. i am using RAM configuration not flash. the code which i am trying is posted below

    #include <intrinsics.h>
    #include <TexasInstruments/iotms470r1b1m.h>
    #include <TexasInstruments/tms470r1B1m_bit_definitions.h>
    
    unsigned int Delay_H;      // Internal high-byte
    
    void startTimer(unsigned int _delay);
    
    
    int main(void)
    {
    
      // Set up peripheral registers.
      // First disable interrupts.
    
      __disable_interrupt();
    
      // Setup system.
     
     // GCR &= ~ZPLL_MULT4;                 //no multiplication because PLLDIS is disabled
      GCR &= ~ZPLL_CLK_DIV_PRE1; 
      GCR &= ~ZPLL_CLK_DIV_PRE2;
      GCR &= ~ZPLL_CLK_DIV_PRE3;                       // SYSCLK = fOSC/1 =7.5
      PCR = CLKDIV_1;                                               // ICLK = SYSCLK
      PCR |= PENABLE;                                              // enable peripherals
      CLKCNTL |= CLKDIR | CLKSR_ICLK;
      REQMASK = (1 << CIM_COMP1);                     // Enable SPI Interrupt mask
    
      // Setup periodic interrupt using RTI with RTICMP1
      RTICNTEN = CNTEN_NOCNT;                       // Stop counting
      RTICNTR = 0x00;                                             // clear 21-bits CNTR
    
      // Setup periodic interrupt timer
      // CMP1 used to generate  interrupt at every one sec.
      RTIPCTL = 2047;                         // preload 11-bits MOD
      RTICMP1 = 3600;                        // every one sec interrupt
      RTICNTL = 0x00;                        // clear and disable tap
    
      // interrupt control, clear CMP1 and enable CMP1 interrupt
      RTICINT = 0x00;
      RTICINT |= CMP1ENA;
      
      __enable_interrupt();                 // Enable Interrupts
    
       RTICNTR = 0x00;
    
      startTimer(10000);      // 1= 1 sec, 10000=10000sec=2.7 hour in standby mode
    
    // Loop forever.
      while (1)
      {
          
      }
    }
    
      //------------------------------------------------------------------------------
    // TMS470R1B1M Standard Interrupt Handler
    //------------------------------------------------------------------------------
    
    __irq __arm void IRQ_Handler(void)
    {
       switch((0xff & IRQIVEC)-1)
      {
       case CIM_COMP1  : 
    
        RTICINT &= ~CMP1FLAG;   // interrupt control, clear CMP1
        RTICNTR = 0x00; 
       
        if(Delay_H != 0){
            Delay_H--;          // Decrement time counter
         }else{            
            RTICNTEN = CNTEN_NOCNT;                       // Stop counting
            CLKCNTL |= LPM_RUN;
            }
        break;
    
      }
    }
    
    void startTimer(unsigned int _delay){
        Delay_H = _delay;
                     //
      RTICNTR = 0x00;                               // clear 21-bits CNTR
      RTICNTEN = CNTEN_UP;                         // Start count, CNTR and MOD will count in both USER and SYSTEM mode 
    
      CLKCNTL |= LPM_STANDBY;                      //Activate standby mode after starting RTI counter up
    }
    

    I have RTI settings to generate interrupt at every sec, the counter will decrese from 10000 to 0 to stop the RTI and exit from standby mode. any suggestions?

    Regards,

    Pavan.

  • Hi wade ,

    Any suggestions on power saving methods. My method is wrong?

    Regards.

    Pavan.

  • I am not sure what is wrong.
    However, here are some ideas to try.
    Can you remove the code from interrupt service routing, and have it go to low power mode from the main line? Ie, is the interrupt getting serviced correctly.

    Are you connected to a debugger during this? The jtag connection may inhibit lower power modes, as the debugger needs to communicate to processor.

    Regards,
    Wade
  • Hello Pavan,

    How do you know that processor is not in sleep / halt mode ? do you have any pin toggling while in sleep mode ?
    did you try your code without the debuger probes ?

    @ wade, Any news on the current consumption while in sleep mode ??

    regards
  • Hi Pavan,

    I have been able to get the SM470 into its low power mode. I typically run out of flash, but the code that puts the part into low power mode must be running in RAM. So, I created a RAM function that executes the code. My example is below.

    __ramfunc void GoLowPower(void);


    From my main code I call the GoLowPower function.
    // Go low power
    if(LowPowerFlag){
    LowPowerFlag = 0;
    GoLowPower();
    }






    /////////////////////////////////////////////////
    // Low Power Mode
    /////////////////////////////////////////////////

    void GoLowPower(void){

    volatile unsigned long dummy;

    GCR |= FLCONFIG;
    FMMAC1 = PSLEEP_MAX; // pump sleep to standby time
    FMMAC2 = BANK0_ENA + PMPPWR_SLEEP + PSTDBY_MAX; // bank0
    FMBAC1 = (BNKPWR_SLEEP + BSTDBY_MAX) & ~0x00000003; // active
    FMBAC2 = PIPELINE_MODE + BSLEEP_MAX; // 0 wait states
    FMMAC2 = BANK1_ENA + PMPPWR_SLEEP + PSTDBY_MAX; // bank1
    FMBAC1 = (BNKPWR_SLEEP + BSTDBY_MAX) & ~0x00000003; // active
    FMBAC2 = PIPELINE_MODE + BSLEEP_MAX; // 0 wait states
    FMREGOPT = ENPIPE; // ENABLE PIPELINE MODE

    dummy = 2000000;
    while(dummy){ // Give a little delay
    dummy--;
    }

    GCR |= FLCONFIG;

    CLKCNTL |= LPM_HA; // Go into halt mode
    // CLKCNTL |= LPM_STANDBY;
    dummy = CLKCNTL;
    }
  • Thanks Shawn.

    Pavan, I believe it will also be necessary to disconnect from the debugger.  You will need to provide power from the DC jack vs emulator power.

    Regards,

    Wade

  • Hi Wade,  Michel james,

    Thanks for you reply, 

    This time i have connected my designed board with DC power instead of trying on IAR Stater kit.  I have proper DC supply.  I tried to put in standby mode not into halt mode.

    My board is taking 65 mA current consumption, when i put controller in reset then it is consuming 17mA so it seems controller is taking remaining 48mA. I am trying to put in stand by mode.

    CLKCNTL |= CLKDIR + CLKSR_ICLK + LPM_STANDBY;                               // Standby mode
    
    dummy=CLKCNTL;

    I tried to program into RAM and as well Flash. 

    When i programmed into RAM, i am adding only above two lines in my main function. as well I am toggling one of the I/O pin for checking purpose after those two lines.  It didn't enter into standby mode because still it is toggling I/O and i didn't see any lower power consumption, but this time i have connected debugger. Once programmed into RAM then i removed debugger without powering off then also its same. If tried to program once again it is showing unable to halt CPU message, then I have to reset the controller to program once again.

    When i tried to program same code into "flash" then, I think it entered into standby mode because I/O pin is not toggling but i didn't see any reduction in power consumption. It is same. Then i removed debugger and powered even it is still same power consumption as well it is not toggling the I/O pin but the strange thing is once I programmed to flash with Power saving code then I am not able to erase or program new active application, It was showing "unable to halt CPU abort debug session" message. I can't program into RAM as well after that. 

    I am trying to put into "standby mode" then why it is entering into HALT mode. I didn't understand. It seems as per your information i lost two controllers. I didn't understand how to protect controller when i program into flash. I am not changing any thing and i don't have any other code only running power saving code and I/O toggling.

     I am toggling I/O pin to know it entered into standby mode or not. 

    Regards,

    Pavan.

  • Hi shawn,

    Thanks for your reply, 

    I am using the same code but I have some doubts, At what frequency you running, my SYSCLK is 7.5MHz, I am not using ZPLL, will that influence? 

    if i understand properly you are not running power saving code in flash? you running it in RAM. We can't use this code in flash? I have tried and lost two controllers after that.

    Do we need set that GCR | = FLCONFIG ; after power saving code. 

    If you don't mind can you explain me what values you using for  PSLEEP_MAX, PSTDBY_MAX, BSTDBY_MAX, BSLEEP_MAX. I am using default.

    Regards,

    Pavan.

  • Pavan,

    I have a 7.5MHz external oscillator, but I use the PLL to boost the internal clock to 60 MHz. That will make a difference in some of the timing used by the flash modules when powering down , but I don't know if it would be a problem or not.

    I put that second GCR | = FLCONFIG in there to be sure I was in flash configuration mode. According to the Flash Configuration Guide, that is required when the low power mode is entered (see excerpt below).

    I am using the default PSLEEP_MAX, PSTDBY_MAX, BSTDBY_MAX, and BSLEEP_MAX values that came with one of the sample IAR programs. I did, however, add the mask (& ~0x00000003) onto the end of those lines to make sure I was putting the flash banks to sleep.

    As for running from RAM, I believe that is mandatory. This is an excerpt from the TMS470R1x F05 Flash Reference Guide:

    5.1 Powering Down Flash for Halt Mode
    To completely power down all of the flash banks and the flash pumps, the
    code must be executing from RAM or some memory other than flash when
    the CPU is halted. The host must first set the fallback power bits to sleep
    mode. Then, before the host enables halt mode, it must execute from RAM
    long enough to let the active grace period for all banks and the charge pump
    expire. Also, the device must be in configuration mode.
    Note: When Putting All Banks Into Sleep or Standby Mode, Ensure
    That There Are No Accesses to Non-Existing Memory
    If all banks are in sleep or standby mode and an access to a non-existing
    bank is performed, the CPU will hang. This can be avoided by setting the
    memory decoder to enable only the amount of flash that is physically
    implemented on the chip.


    Hopefully that helps,
    Shawn
  • Hi Shawn,

    Thank you very much for your reply,

    I am able to put into Standby Mode finally with your help and I used the same code which you posted. Upto now i worked with RAM programming. I am able to save power. I have one more question if you don't mine can you suggest me.

    1) If i run the same code with flash programming, do i need to change anything or i can call the same function in main function and run as it is? I mean form the datasheet as it mentioned we have to run it from RAM even we use flash configuration. do we have to configure anything to run this function in RAM while programming through flash?

    Regards,

    Pavan.

  • Hi pavan,

    You need to use specific instruction toindicate to the compiler wich part of the code is in Flash and wiich part is in RAM. Ram section will be automatically initialised at startup by the low level function provided by IAR.

    It is not difficult but may take time to get it right.

    Good luck

    JM

  • Hi James ,

    Thanks for your reply,
    I am new to this kind of programming , if possible can you provide any example on how to do this.?

    Regards,
    Pavan.

  • Hi Pavan,

    In that original code I posted, the "__ramfunc void GoLowPower(void);" statement will cause the GoLowPower code to run from RAM if you are using the IAR development environment. Once you compile and load the code onto the SM470, you can verify that it is in RAM by looking at the memory address assigned by the linker.

    -Shawn


    __ramfunc void GoLowPower(void);

    From my main code I call the GoLowPower function.
    // Go low power
    if(LowPowerFlag){
    LowPowerFlag = 0;
    GoLowPower();
    }
  • Hi,

    when i put SM470R1B1M into standby mode, the current consumption as mentioned in the datasheet should be less than 2mA but my controller is consuming 34mA after entering into STANDBY mode.
    If i put controller into reset then i can see only 14mA so my controller still consuming arround 20mA after entering into STANDBY mode.

    From data sheet when controller in is STANDBY mode SYSCLK, ICLK, MCLK are inactive. Then i am not able to figure out when it consuming 20mA current.

    Any suggestions?

    Regards,
    Pavan.
  • Hello Pavan,

    Are you testing the processor at temperature ?

    Did you disable the flash memory ( and run from ram ?)

    JM

  • Hi Pavan,


    Is it possible that some of your surrounding logic is consuming the extra power?  In reset, all of the  pins of the SM470 go to a high impedance state.  However, I believe in low power mode the pins retain whatever state they were in before entering low power mode. I'm not positive about that, but I believe that is the case.  If those pins are enabling some external logic during low power mode, then maybe your extra power is going there. 

    -Shawn

  • Hi JM,

    I am not testing processor at high temperature, only testing at room temperature. I am disabling the flash as well.

    Regards,

    Pavan.

  • Hi Shawn,

    Ok thanks for your explanation, I will try to put all i/o pins and controls in low state before entering into low power mode.

    Regards,
    Pavan.