I'm using an RA6M3 connected to IAR's EWARM IDE via a J-Link Ultra+. I've read the Low Power Mode section of the RA6M3 user's manual and have looked at the register values and I think I have everything configured correctly. However, when I single-step through my code, it just steps right over the WFI instruction. I would expect the WFI to never return. The debugger would only resume after the device has reset out from the deep software standby state.
Before I pull out more hair, I thought I'd check to see if it is the debugger itself that is preventing the RA6M3 from entering deep software standby.
I've done more research and have a solution. Two, actually.
The script mentioned in the app note cited by Richard can be used. Getting C-Spy (the EWARM debugger) to run the J-Link script involves editing…
Have you looked at the app note:
Getting Started with Low Power Applications Package for RA6M3 and RA4 Groups Application Project (mouser.com)
In summary, yes the debugger ill not allow you to enter SW Standby mode or Deep Software Standby mode.
However, if you use the low power debug script as mentioned in the app note, then yes, you can debug through DP SW Stby mode
I did not find that app note, but I found the script in another posting. From the script, it appears the key is to clear the DBIRQ bit in the MCUCTRL register (section 18.104.22.168 in the RA6M3 User's Manual). MCUCTRL is only accessible via the debugger, so you can't clear this bit in firmware. The debugger needs to do it.
I am using EWARM, not E2. I'm not sure if I can use that script directly or not. I'll have to experiment. EWARM does come with a R7FA_DBG.dmac script that clears this bit in _ExecDeviceCoreConnect(), but it isn't happening. I don't know why. I'm still investigating that.
Has anyone succeeded in debugging the low power modes using EWARM? If so, did you need to do anything special?
please have a look at this Synergy low power example.
I hope this is the correct link
This has the IAR .mac file and how to configure the IAR debug session to allow low power debugging
The script mentioned in the app note cited by Richard can be used. Getting C-Spy (the EWARM debugger) to run the J-Link script involves editing a configuration file. It cannot be done directly from within EWARM.
EWARM creates a "settings" folder in the project folder. Look for a file(s) that end in .jlink. There should be one for each build configuration you've used in a debug session. Edit this file(s). Look for the ScriptFile="" line and put the name of the script file in the double quotes. Adjust the path as necessary (the default working directory is the "settings" folder). Once done, the script will run when the debugger attaches to the processor and you'll be able to enter low power modes with the debugger attached.
While workable, I didn't like this solution because the "settings" folder and its contents are automatically generated. I don't track them in my revision control and any changes I make to them might get over-written the next time the files are generated.
The other solution is to create a macro file containing the following:
* Clear the MCUCTRL.DBIRQ bit.
* Without this, the MCU will not be able to enter low
* power modes. The debugger interrupt will immediately
* wake the processor and the WFI will look like a nop.
__writeMemory32(0, 0x80000410, "AP1_Memory");
Then, from EWARM, go to Options > Debugger > Setup > Setup macro(s). Add the path to this macro file. That's it. Now when you attach the debugger, the MCUCTRL.DBIRQ bit will be cleared and you'll be able to enter the low power modes when you issue the WFI instruction.
I've also verified that the debugger will reattach after you reset out of Deep Software Standby.