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.

Deep Sleep Wake Source

Other Parts Discussed in Thread: SYSBIOS

I’m working on a project using the TM4C129XNCAD, IAR 7.20.2.7431 as the dev tool, and TI-RTOS2.00.02.36. I am attempting to use deep sleep mode, and am seeing that the device wakes a few seconds after being put to sleep, apparently by an unhandled interrupt source, because the application immediately exits with a hard fault.

I am hoping someone can point me to a way to find the interrupt which has caused exit from deep sleep mode. Thanks!

  • Hi Steve O,

    Do you see a dump of register contents?

    If so, you can use that info to trace back to the code that caused the app to crash.

    Please see this FAQ for info on how to do that.

  • Thanks for the reply. I am using IAR, and although I would expect the register dump to be the same, all I get is:

    FSR = 0x0002
    HFSR = 0x40000000
    DFSR = 0x00000000
    MMAR = 0xe000ed34
    BFAR = 0xe000ed38
    AFSR = 0x00000000
    Terminating execution...

    The rest of the information shown in the FAQ is not there. I was able to stop the program exit after determining that it was caused by a bus fault, probably due to not allowing the clocks to come back up after sleep. The solution was to use IntMasterDisable(), which allowed the interrupt to wake the device but allowed me to delay the servicing of the interrupt until the clocks were stable..

    I still have the initial question of how to determine which interrupt caused the wake up. I am attempting to use HWREG( NVIC_PEND0 ), but am not sure if this is the right way to go about that.

  • Do you see any output in the ROV tool (under SysMin)?

    What does the Hwi module show you in ROV?

    Assuming you're using SysMin, how big is your buffer size?  You would see this as "SysMin.buffSize" in the code of your *.cfg file.

    You may need to increase the size of your SysMin buffer to get the full contents of the message.  I still think using the back tracing steps of that FAQ will help you, so hopefully you can get the full output to show by increasing the buffer size.

    Steve

  • Hi Steve 0,

    Were you able to get past the above issue?  If so, would you mind please marking the post as "verified" for closure?

    Thanks,


    Steve

  • Hi, sorry to keep the post open so long, got called away an something else:

    So using IntMasterDisable(), I can keep the application from exiting, but I keep getting an interrupt wake up. When I read NVIC_PEND0 it often has a value of 0x00000020, which indicates a bus fault as far as I can tell. (I am intending to use the GPIOD interrupt as the wake source).

    I am using an alternate clock source during sleep via the following:

    // set the deep sleep clock source: use the low-frequency internal osc with
    // a div/64, disable the MOSC and internal oscillator in deep sleep.
    SysCtlDeepSleepClockConfigSet( SYSCTL_DSLP_DIV_64,
    ( SYSCTL_DSLP_OSC_INT30 | SYSCTL_DSLP_PIOSC_PD |
    SYSCTL_DSLP_MOSC_PD ) );
    // set the SRAM and flash to low power modes during sleep
    SysCtlDeepSleepPowerSet( SYSCTL_FLASH_LOW_POWER | SYSCTL_SRAM_LOW_POWER |
    SYSCTL_LDO_SLEEP | SYSCTL_TEMP_LOW_POWER );

    // use clock gating for peripherals during sleep
    SysCtlPeripheralClockGating( true );

    And using SysCtlPeripheralDeepSleepDisable() on all enabled peripherals except GPIOD. When the bus fault is asserted, I have no way in the API to clear it, so it constantly will wake up once it asserts. Any ideas on what may be happening? Thanks!

  • Steve O,

    Were you able to try what I mentioned previously?  In order to get more information printed out from the crash?

    "Do you see any output in the ROV tool (under SysMin)?

    What does the Hwi module show you in ROV?

    Assuming you're using SysMin, how big is your buffer size?  You would see this as "SysMin.buffSize" in the code of your *.cfg file.

    You may need to increase the size of your SysMin buffer to get the full contents of the message.  I still think using the back tracing steps of that FAQ will help you, so hopefully you can get the full output to show by increasing the buffer size."

    Steve

  • As I mentioned before, I was able to get the application exit to stop using IntMasterDisable() and IntMasterEnable() arounf the SysCtlDeepSleep() call. The application now resumes operation normally, it's the strange interrupt that keeps waking the device up that I can't figure out.

    Under the assumption that the initial issue is causing my problem, I removed the IntMasterDisable/Enable calls and increased the SysMin buffer. I now see the following:

    Exception occurred in ISR thread at PC = 0xfffffd58.
    Core 0: Exception occurred in ThreadType_Hwi.
    Hwi name: {unknown-instance-name}, handle: 0x20001b18.
    Hwi stack base: 0x2001d988.
    Hwi stack size: 0x2000.
    R0 = 0x00000000 R8 = 0x0000001e
    R1 = 0x00000020 R9 = 0x00001827
    R2 = 0x0000001e R10 = 0xffffffff
    R3 = 0x20002ba0 R11 = 0xffffffff
    R4 = 0x20000b38 R12 = 0x00000000
    R5 = 0x20002ba0 SP(R13) = 0x2001f8d0
    R6 = 0x00200000 LR(R14) = 0x00001fe7
    R7 = 0x14f70200 PC(R15) = 0xfffffd58
    PSR = 0x21000023
    ICSR = 0x00415003
    MMFSR = 0x01
    BFSR = 0x00
    UFSR = 0x0000
    HFSR = 0x40000000
    DFSR = 0x00000001
    MMAR = 0xe000ed34
    BFAR = 0xe000ed38
    AFSR = 0x00000000
    Terminating execution...

    However, following the FAQ resulted in a complete crash of IAR, probably because the PC value looks to be invalid? The HWI module indicates that the activeInterrupt is 3, which looks to be a hard fault, with a pending interrupt of 21.

    I also have added a system error callback which allows me to catch the call stack prior to "exit". This is what it shows me:

    SystemErrorCallback -> this is my error callback function
    [xdc_runtime_Error_policyDefault__E + 0x8d]
    [xdc_runtime_Error_raiseX__E + 0x15]
    [ti_sysbios_family_arm_m3_Hwi_excHardFault__I + 0x3b]
    [ti_sysbios_family_arm_m3_Hwi_excHandlerMax__I + 0x77]
    <Exception frame>
    <Unknown handler>

    Thanks again for the help!

  • I'm working on this issue with Steve and have figured out the random wakeup issue. Checking the PEND0 register, we were getting a pending interrupt from Timer 0. It does not seem like we are having a Bus Fault like we initially thought. Prior to going into deep sleep I am now disabling it using TimerIntDisable( TIMER0_BASE, TIMER_TIMA_TIMEOUT ). This allows the processor to stay in deep sleep and wakeup upon an interrupt on PORTD like we expect.

    However, I am still having the exiting issue when NOT using IntMasterDisable() prior to SysCtlDeepSleep(). What other steps can we take to solve this issue?

    Thanks,
    Brayden