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.

[FAQ] IWRL6432: Debugging with Deep Sleep

Part Number: IWRL6432
Other Parts Discussed in Thread: SYSCONFIG

The xWRLx432 devices are designed with a deep sleep power state that allows the device to consume very little power when not chirping or processing data. When the device goes to deep sleep, it disables a lot of the supporting machinery that allows engineers to debug their software. If users want to debug during or after the deep sleep state though, they need to know a few of the following work-arounds.

Workaround #1 - Set gDebugTargetCode to 1

The xWRLx432 device has a frameStartInterrupt that interrupts execution to begin chirping for the subsequent frame. If you want to set a breakpoint, you will need to disable this interrupt by setting gDebugTargetCode to 1. The block of code below can be used to disable the gDebugTargetCode variable when in release mode, and enable it in debug mode.

/* In order to debug target code (set brake points, step over,...) set this variable below to 1 in CCS
 * expression window. It will prevent ISR mmwDemoFrameStartISR from forcing the code to stop */
#ifdef _DEBUG_
volatile uint32_t gDebugTargetCode = 1;
#else
volatile uint32_t gDebugTargetCode = 0;
#endif

Workaround #2 - Set lowPowerCfg 2 in the configuration file

This emulates the deep sleep timing by putting the device into an idle state instead of deep sleep. However, this will not allow users to actually see the changes from deep sleep (reduced power/memory retention/LPDS enter/resume hooks)

Workaround #3 - Set "Keep debug active during LPDS" and use the gDebugLowPowerModeBreakFlag

In the power tab of sysconfig, select "Keep debug active during LPDS"

Additionally, define LOW_POWER_DEEP_SLEEP_MODE_VERIFICATION and add the following code block to the power_LPDSresumehook() function

#ifdef LOW_POWER_DEEP_SLEEP_MODE_VERIFICATION
/* ToDo This is for debugging, set to one to stop the code after waking up from LPDS, and reconnect CCS*/
volatile int gDebugLowPowerModeBreakFlag = 1;
#endif
void power_LPDSresumehook(void)
{

    while(gDebugLowPowerModeBreakFlag)
    {
    }

Flash the device with the intended release code. Send the configuration file and when the device begins running, it will fall into the while() loop inserted. Then, to debug, connect to the device, load the symbols for the corresponding .out file, and then simply alter the value of the gDebugLowPowerModeBreakFlag in the expressions window, and begin to step through the code.