Debugger resets on WFI instruction

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Debugger resets on WFI instruction

Jump to solution
3,158 Views
scottm
Senior Contributor II

I've been going around and around about this problem in the Kinetis MCUs forum for weeks without resolution and was referred here.

 

In KDS 3.2 (and KDS 3.0 before that), when the target executes a WFI instruction the debugger stops with the PC and all registers reading 0.  It's still connected and apparently able to read memory, but it can't resume.  If I step into the WFI instruction it steps past it fine, but in normal run mode it stops every time.  The target keeps running normally.

 

This happens with a P&E Cyclone, P&E Multilink Universal, and with the FRDM-K22F's built-in OpenSDA debug adapter.  I've tested it on the FRDM-K22F and my own MK02FN64 boards.  This problem does not happen in CodeWarrior 10.6 on the same system with the same drivers and debug interfaces, so it's definitely not a hardware problem.  Unfortunately NXP has abandoned CodeWarrior for Kinetis so I don't have the option of using my preferred IDE with the K02 parts.

 

Any ideas?

 

Scott

Labels (1)
0 Kudos
Reply
1 Solution
2,706 Views
scottm
Senior Contributor II

Finally got resolution on this.  P&E appears to have fixed the bug in the 2.4.7.201605092133 update of the gdb plugin.  It's now working as expected.

View solution in original post

0 Kudos
Reply
13 Replies
2,707 Views
scottm
Senior Contributor II

Finally got resolution on this.  P&E appears to have fixed the bug in the 2.4.7.201605092133 update of the gdb plugin.  It's now working as expected.

0 Kudos
Reply
2,706 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Scott,

In low power modes , the debugger powered off.

For the frdm-k22 board , you can check the Reference manual :

pastedImage_0.png

Hope it helps


Have a great day,
Alice

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply
2,706 Views
scottm
Senior Contributor II

Hi Alice,

If you look at the next page, 9.14.1 says that the debug port is fully functional in STOP, VLPR, and VLPW modes.  In this case, it's entering normal Wait mode via the WFI instruction with SLEEPDEEP disabled, and according to table 7-1 all peripherals are clocked in sleep mode.

Moreover, the same hardware and same code functions just fine with the CodeWarrior debugger.  Your colleague Jingjing Zhou referred me here after being unable to reproduce the problem, and says that WFI should not stop the debugger.

Scott

0 Kudos
Reply
2,706 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello SCOTT,

Sorry i misunderstand your meaning.

Yes, when it enter Wait mode , the debug not disconnect , after wake up it , it can continue to work.

i also test the project Jingjing zhou provide, it can work well.

- Please disable all of the breakpoints you add on the project before you download it ;

- You can create one project to download, check whether it can work well;

-If they all can not work , please re-install the KDS again.

Hope it helps

Alice

0 Kudos
Reply
2,706 Views
scottm
Senior Contributor II

I've done all of that.  I've run the project provided by your colleague and it stops every time.  Or rather, the debugger stops every time.  The target continues running normally after the debugger stops and shows "__isr_vector() at 0x0" and all zeros for the registers.

Is there a more detailed log produced by GDB somewhere?  Can you tell me what version of the P&E drivers you're running?

- You can create one project to download, check whether it can work well;

I'm sorry, I can't quite parse that.  Can you please re-state?

Scott

0 Kudos
Reply
2,706 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello SCOTT,

I have not use debugger , i use the OpeSDA on board .

Which debugger do you used ? pleas take a screenshot .

What about the system of your PC ? And have you test it on other PC ?

Please create one simple project (not low power), then test it on KDS , check whether can work well .

maybe it is not the reason of low power , please take a screenshot about the configuration of KDS

when you download  the project.

BR

Alice

0 Kudos
Reply
2,706 Views
scottm
Senior Contributor II

Here's a simple project to demonstrate the problem:

https://dl.dropboxusercontent.com/u/13572256/wfi.zip

And here's the configuration of the KDS installation:

https://dl.dropboxusercontent.com/u/13572256/kds_config.txt

We tried it on a Windows 7 machine with a P&E Multilink Universal and it seems to function as expected.  The machine that it doesn't work on is Windows 8.1 Enterprise.

Screen shot is included below.  Note that 0x4d8 is Reset_Handler.

Scott

Screenshot 2016-06-10 14.55.38.png

0 Kudos
Reply
2,706 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello  SCOTT,

The linker you give me can not open :

pastedImage_0.png

And my PC is also Win7 system , if it can work well on your win7, i think you can directly use this

system to develop.

BR

Alice

0 Kudos
Reply
2,706 Views
scottm
Senior Contributor II

Here's a link hosted on my own server:

http://argentdata.com/wfi.zip

I'm afraid using the Windows 7 system is not really an option.   For one, it's already in use by another engineer.  It's only running Windows 7 for the sake of compatibility with a pick-and-place machine.  Each PC has a suite of test equipment (some with finicky drivers) plus CAD/CAM and EDA software and adding another computer to an already crowded lab or changing operating systems for the sake of one program just isn't an option.

Scott

0 Kudos
Reply
2,706 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Scoot,

    Please post your KDS error picture here again, let Alice to check the error is caused  by what factor from the KDS side.

    Besides, If you have the condition, please install your KDS in another PC with win7 system, and try again. The test platform use FRDM-K22, and debugger use P&E multilink or opensda, the project use K02FN64VLF10.rar which I already give you.

    Because, I tried at least 3 computers on my side with KDS3.2 or KDS3.0, I didn't meet your KDS debugger error after enter wait mode.

Best Regards,

Jingjing

0 Kudos
Reply
2,706 Views
scottm
Senior Contributor II

Screenshot 2016-05-31 08.02.17.png

Here's the screenshot.

0 Kudos
Reply
2,706 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello SCOTT,

Which DOC do you refer to ?

I said  the Reference manual for k22 : K22P121M120SF7RM

in this doc, there is no 9.14.1.

BR

Alice

0 Kudos
Reply
2,706 Views
scottm
Senior Contributor II

I'm referring to K22 Sub-Family Reference Manual, document number K22P64M120SF5V2RM.  Sorry for the confusion, my K22F target boards are using the MK22FN1M0.  I only used the MK22FN512 on the FRDM-K22F for the sake of running the sample code provided to demonstrate the problem.  In any case, it doesn't seem to matter which variant I use.

0 Kudos
Reply