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.

TMS320F28377S: CCS After entering HALT() mode, wake up

Part Number: TMS320F28377S
Other Parts Discussed in Thread: C2000WARE

Hello

Can you advice?

I want to switch to HALT mode to save battery.

I want to work for 1 minute and sleep(HALT) for 59 minutes.(continuous)

 

Refer to the example of 'lpm_haltwake.c' included in TI's C2000Ware.

Below is the test sequence.
I entered HALT mode, but I cannot re-enter.
1. Enter HALT() mode (complete)
- result : Current consumption down(60mA)

2. Wake up after receiving SCI (complete)
- result : Current consumption up( 60mA -> 140mA)
3. Re-enter HALT() mode  (complete)
- result : Current consumption down(140mA -> 60mA)
4. Wake up when receiving SCI (not complete) 
- result : Current consumption down (60mA)
* Wake up in IDLE(), STANDBY() mode *
* but, can't wake up only in HALT(), HIB() mode *
  • Kang,

                  So essentially what you are saying is the device is unable to wake up the second time form HALT. Is this correct? 

    Please pay attention to the below (page 123 of SPRUHX5G):

    Disable all interrupts with the exception of the WAKEINT interrupt . The other interrupts can be reenabled after the device is brought out of HALT mode. 

    Have you ensured this? You mention you wake up based on activity on the SCI pin. Do you reconfigure the SCIRXD pin as a GPIO pin before you enter HALT mode? Which interrupt is active when the device is in HALT mode?

  • Also, please attach the scope waveform of your wakeup signal that clearly shows the pulse width.

  • The problem is solved.

    Thanks for your hint.

    First, second, third, fourth.. (continue). wake up works well.


    The cause is.

    reconfiged  after first wake up. (see below)

    ************ Reconfiged************************************* *****************

    // WD is not functional in HALT

    EALLOW;
    CpuSysRegs.LPMCR.bit.WDINTE = 0;
    ClkCfgRegs.CLKSRCCTL1.bit.WDHALTI = 0;
    EDIS;

    // Ensure there are no subsequent flash accesses to wake up the pump and  bank. Power down the flash bank and pump.

       SeizeFlashPump_Bank0 ();
    // FlashOff_Bank0 (); // 1 번                    
       ReleaseFlashPump ();
      SeizeFlashPump_Bank1 ();
    // FlashOff_Bank1 (); // 2 번
       ReleaseFlashPump ();

        HALT();        // Enter enter HALT mode (1st)

    // Reconfigure PLL after waking from HALT
    // PLLSYSCLK = (XTAL_OSC) * (IMULT + FMULT) / (PLLSYSCLKDIV)


    InitSysPll (XTAL_OSC, IMULT_20, FMULT_0, PLLCLK_BY_2);
    // ESTOP0;

        HALT();        // Enter enter HALT mode (2nd)추가

    ************************************************** ******************************************


    Can I ask additional questions?

    1. An error occurs when executing number 1 and  number 2.(see above)

       - Can you tell the cause? (It jumps to the ILLEGAL_ISR() function.)

     . // FlashOff_Bank0 (); // number 1 // Do not run

      // FlashOff_Bank1 (); // number2 // Do not run

       

    2.  HALT mode works well.

        - But, There are times when a program can be injected and there are times when it doesn't.. (see below)

    3.  Should I always reconfig after entering halt mode (after wake up)?(see above)

        - Before, only one function was called.(HALT();l)

  • Kang,

    Please clarify what you mean by "There are times when a program can be injected" 

    Should I always reconfig after entering halt mode

    Reconfig what? 

    On a different note, if the original problem is solved and you have new questions unrelated to the original thread, it would be best to start a new post, with an appropriate title. You could choose the "Ask a related question" option to reference the new thread to this thread. This ensures your question is routed to the correct expert/team and also makes future searches easy.

  • 죄송합니다...

    HALT 모드가 정상적으로 실행됩니다. 감사합니다.

    그러나 오류가 발생합니다. 

    따라서 아래 두 가지 기능을 실행하지 않습니다.

    TI의 C2000Ware에 포함 된 'lpm_haltwake.c'예제를 참조했습니다.

    이 추가 질문 후에 스레드를 닫겠습니다.

    추가 질문.

    Q1. 프로그램을 실행할 때 오류가 발생하는데 원인을 모르겠습니다.

       // FlashOff_Bank0 (); // 실행되지 않습니다. (오류 발생)

      // FlashOff_Bank1 (); // 실행되지 않습니다. (오류 발생)

         HALT 모드 진입은 지속적으로 잘 작동합니다. (FlashOff Bank0 () 함수 및 FlashOff Bank1 () 함수는 사용되지 않습니다.)

               -깨우기 모드 1 분, HALT 모드 59 분. (1 분-> 59 분-> 1 분-> 59 분 ..... 연속)

          HALT 모드 진입 후 재진입시 설정 문제입니다.


    Q2. timer2 인터럽트 안에 한 번 더 설정해야합니까? (타이머 60 초).

           HALT () 함수 만 호출하고 싶습니다.

    문안 인사,         

      * 내 시퀀스 

  • Are you running these functions from RAM?


  • Yes.

    I am using external SDRAM(AS4C8M16SA-6TIN) - interface : EMIF 

        Usage : Gathering Zigbee communication data(SPI)


    Maybe stak overflow occurred due to sdram?

    Regards...

  • Any function that powers down the flash must be copied to RAM and executed from there. Are you doing this? Code that powers down the flash cannot be executed out of flash.

  • Kang Youk,

    Are these flashoff functions mapped to .TI.ramfunc in your code?  If yes, in your linker cmd file, where is .Ti.ramfunc mapped to?  

    ITRAP occurrence tells that the function is not executed correctly - Need to check whether the memcpy is called correctly to copy from flash to RAM or not.

    Thanks and regards,
    Vamsi

  • I was mistaken.

    The program runs in Flash, not RAM.

    I will think a little more.


    Question 2 is not resolved.(see above)

    Should I perform the same procedure every time when entering HALT mode?

    (The main function procedure and timer2 interrupt function procedure are the same.)

    I will close the thread after this question.

    Thank you.

    Regards,

  • Kang,

    As clarified by both me and Vamsi, any function that shuts down the flash must be copied to RAM and then executed from there. I have attached a sample code, that clearly shows how to do this. This was written for a different device, but the idea is the same.

    /*********************************************************************
                                                                         
    Code run off: Flash
    
    *********************************************************************/
    
    #include "DSP28x_Project.h"     // Device Headerfile and Examples Include File
    
    // Functions that will be run from RAM need to be assigned to 
    // a different section.  This section will then be mapped using
    // the linker cmd file.
    
    #pragma CODE_SECTION(flash_sleep, "ramfuncs");
    
    // Prototype statements for functions found within this file.
    
    void flash_sleep(void);
    
    // These are defined by the linker (see xxxx.cmd)
    extern Uint16 RamfuncsLoadStart;
    extern Uint16 RamfuncsLoadEnd;
    extern Uint16 RamfuncsRunStart;
    
    main() 
    {
    	asm("  EALLOW");
    
    /* Disable Watchdog  */  
    
        SysCtrlRegs.WDCR = 0x006F;    
    
    	GpioCtrlRegs.GPBPUD.all = 0xFFFFFFFF;	
    
    // Copy Flash setup code to RAM
    // This includes flash_sleep and InitFlash();
    // The  RamfuncsLoadStart, RamfuncsLoadEnd, and RamfuncsRunStart
    // symbols are created by the linker. Refer to the xxxx.cmd file. 
    
       MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);
    	
    /* Write the LPM code value */
    	
        SysCtrlRegs.LPMCR0.bit.LPM = 0x0002; 
    
    	flash_sleep();	// This function puts the Flash to sleep & HALTs the device	
    }
    
    /*********End of main()************/
    
    // This MUST be executed from RAM as it will put the Flash to sleep  & device into HALT
    
    void flash_sleep(void)
    {
       FlashRegs.FPWR.bit.PWR = FLASH_SLEEP;  // Put the Flash to sleep
       asm(" RPT #7 || NOP");   
       asm(" IDLE"); 						  /* Force device into HALT  */
    	
       while(1){}
    }