Unable to come out of ADuCM3029 hibernate mode when running code from flash (copying hex file into CMSIS-DAP USB driver)

Hi,

I am using ADuCM3029 COG board and CCES IDE for my development. I am using the "hibernate" sleep mode of device to put it into sleep mode for ~10sec. After awake, I am doing some tasks (UART data transmit) and then again going into hibernate mode. This happens continuously.

To put device into hibernate mode I am using below sequence/function:

pADI_PMG0->PWRKEY = 0x4859;
pADI_PMG0->PWRMOD = 2;
SCB->SCR |= BITM_NVIC_INTCON0_SLEEPDEEP;
__DSB();
__WFI();

Or

adi_pwr_EnterLowPowerMode(ADI_PWR_MODE_HIBERNATE, &iHibernateExitFlag, 0);

To awake it from hibernate mode, I am using RTC alarm interrupt as well as XINT0 interrupts.

 

static void rtcWakeupCallback (void *pCBParam, uint32_t Event, void *EventArg)
{

    if( 0 != (ADI_RTC_ALARM_INT & Event)) {
        // disable RTC interrupt
        
        rtc_ReportTime();
        
        adi_pwr_ExitLowPowerMode(&iHibernateExitFlag);
        //iHibernateExitFlag = 1;
        
        /* Update wakeup alarm */
        wakeup_SetNextTime();
    }
}

When I use debugger to debug my code, it works fine. The controller enters and exits from the awake mode at specified intervals. But when I run it from flash i.e. by manually copying hex/binary file into CMSIS-DAP drive, the code doesn't work expected way. It doesn't come out of hibernate mode. I doubt the interrupt source that is used to awake MCU doesn't get triggered, but not sure.

I was referring the similar thread from e-zone: https://ez.analog.com/analog-microcontrollers/ultra-low-power-microcontrollers/f/q-a/19506/rtc-setup-to-wake-up-from-hibernate-mode-each-1-s/147896#147896

But this code doesn't put MCU periodically into hibernate mode, it's just a once. I am using same RTC alarm logic to wake-up MCU. 

Please let me know if I am missing anything here?

  • 0
    •  Analog Employees 
    on May 20, 2020 6:08 AM 6 months ago

    Hi Mahesh,

    The default linker script of CCES puts all the variable data into SRAM bank 3.

    This may cause some  variable corruption that may cause your issue.

    You need to change the linker file to place the .data and .bss region on the SRAM Bank 0.

     

           __etext = .;

     

           .data : AT (__etext)

           {

              

           } > DSRAM_A

     

           .bss :

           {

             

           } > DSRAM_A

     

    DSRAM_A is defined on the default linker script as SRAM Bank 0 + SRAM Bank 1 (an optionally retainable SRAM)

    Regards,

    Jeric

  • 0
    •  Analog Employees 
    on May 20, 2020 6:33 AM 6 months ago in reply to @JV

    Hi Jeric,

    I have tried changing the data and bss regions to DSRAM_A, but still same results. 

  • +1
    •  Analog Employees 
    on May 20, 2020 7:09 AM 6 months ago in reply to mphalke

    1. Make sure that semi hosting is disabled

    2. All printing message must be remove in working on stand-alone mode

    what other peripherals are use in your code aside from RTC and XINT? Please check in ADuCM3029 HRM if all peripheral registers used are retained when you entered the hibernate mode.

    Regards,

    Jeric

  • 0
    •  Analog Employees 
    on May 20, 2020 5:39 PM 6 months ago in reply to @JV

    Hi Jeric,

    Thanks for the inputs. After disabling all active/used peripherals (DMA, SPI and UART) before entering into hibernate mode and enabling them again post exit of hibernate mode, the code works fine.

    And along with that I need to change the linker file to map .data and .bss sections to Bank0 of SRAM, as suggested by you above.

    Appreciate your help on this.