WFI instruction stops debugger

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

WFI instruction stops debugger

Jump to solution
4,813 Views
scottm
Senior Contributor II

I'm using an MK02FN64VLF10 with KDS, porting an application from an HCS08.  I've used the WFI instruction in place of the HCS08's WAIT instruction to pause a loop while waiting for a periodic interrupt.  It works fine, but when I'm using the debugger the WFI instruction causes it to stop with a "suspended : signal : SIGTRAP : Trace/breakpoint trap" message.  After that it seems to keep running but the debugger is disconnected.  My debug connection is via SWD to a P&E Multilink Universal.

It's just a nuisance at this point, but I can't find any information on whether this is the expected behavior and the best way to avoid it.  I can just exclude the WFI instruction in the debug build, but then it's a less accurate representation of the system's actual behavior.  Is there another way around this?

Thanks,

Scott

Labels (1)
Tags (1)
1 Solution
2,806 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

33 Replies
2,022 Views
thomasedel
Contributor III

Thank you, Scott, for persevering through on this!!!!  I just had the same problem, though my problem was combined with difficulties getting my code settings right to get into VLPS mode.  The combination of the debugger issue and my own code issues made for difficult going.  I finally got VLPS mode working, but the debugger was always disconnecting with the same error as you indicated.  Fortunately, I found your two posts.  Your posts probably saved me countless hours, as I was not understanding the problem as well as you, and thought there might still be something wrong with my code.  So sad it took so long for your issue to be resolved.

I found that the Help->Check for Updates menu item in KDS found the needed update (a 65Mb download!).  That solved the problem for me.

Thanks again...

-Thomas

2,807 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.

2,022 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi SCOTT MILLER,

Thank you very much for your resolution sharing.

It is caused by the P&E tool, could you tell me how did you find it? Install the newest P&E driver?

Best Regards,

Jingjing

0 Kudos
2,022 Views
scottm
Senior Contributor II

I had already been to P&E's site for driver updates and also run through the Eclipse software updates previously without any change, but I ran the Eclipse update again yesterday and the new version worked.  The update was released last month.  Either it hadn't been posted to the repository yet last time I tried, or the previous update didn't complete successfully.

0 Kudos
2,022 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Thank you for your more information.

But the older driver also works on our side, it seems the driver still relative to the PC.

Best Regards,

Jingjing

0 Kudos
2,022 Views
scottm
Senior Contributor II

This is the state of the debugger after encountering the WFI instruction in KDS.  The target is still connected and memory appears to be readable, but all registers are zero.  If you try to resume or step, it thinks it's at address 0.

Screenshot 2016-05-31 08.02.17.png

0 Kudos
2,022 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Please try KDS3.2 on your side.

0 Kudos
2,022 Views
scottm
Senior Contributor II

I upgraded to KDS3.2 and installed all available updates and it's still doing exactly the same thing.

BTW, is there some reason that no release dates are given for anything on the NXP site?  They're not shown in the download listing and even the release notes don't contain any date other than the copyright year.

0 Kudos
2,022 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi SCOTT,

      kds3.2 is released in Mar. 2016,

New Kinetis Design Studio v3.2.0 available

   About the NXP site don't contain the release dates problem, I will transfer it to our according department.

Best Regards,

Jingjing

0 Kudos
2,030 Views
scottm
Senior Contributor II

I do have a FRDM-K22.  I fired it up and added your enter_wait() function to the hello_world project and it stops, exactly the same as the K02.  The same thing happens whether I'm debugging via the Cyclone or the built-in OpenSDA interface on the FRDM board.

0 Kudos
2,030 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi SCOTT,

    Of course it will stop, because you enter_wait mode, did you try to wake up it?

    If you wake up the MCU, you will find it still working with debugger.

   Use my K02FN64VLF10.rar, and after enter in wait mode, press SW2 on the FRDM-K22 board.

Wish it helps you!


Have a great day,
Jingjing

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

0 Kudos
2,030 Views
scottm
Senior Contributor II

I mean the debugger itself stops like the target was reset.  You can't resume, PC is 0, registers are all 0.  The target continues running normally.  I can tell that the wait instruction is working properly because on my board the power consumption drops from 20 mA to 12 mA when the wait command is in use.

Scott

0 Kudos
2,025 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi SCOTT,

     Did you try any other debugger? Because I already try the Cyclone and the PE multilink on my side, both debugger never stop connect, and I also can resume.

    Maybe it is relate to your debugger, you can try another debugger, or just download the lower power code to your flash and test the function.

Jingjing

0 Kudos
2,022 Views
scottm
Senior Contributor II

This happens in KDS whether I'm using the Multilink, Cyclone for ARM, or the built-in OpenSDA interface on the K22F.

The CodeWarrior 10.6 debugger has no problem with the WFI instruction and works exactly as expected.  The KDS debugger seems to be inferior all around, but there's really not any alternative for the K02 short of writing my own support packages for CW10 or switching to IAR.

Scott

0 Kudos
2,022 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi SCOTT,

    Could you please try the KDS3.2 software, please download it from this link:

www.nxp.com/kds

    After you install it, and add the KSDK1.3.0 eclipse add-on, then try my project on the FRDM-K22 again.

    If you still meet the same debug error, and the all registers are zero, you need to create a post about the KDS in this link:

Kinetis Design Studio

Wish it helps you!


Have a great day,
Jingjing

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

0 Kudos
2,022 Views
scottm
Senior Contributor II

So after all this, the answer is to go try in a different support forum?  Is it possible to at least open a trouble ticket?  Kind of frustrated that I'm left with KDS as my only option short of IAR after already paying for CodeWarrior.

0 Kudos
2,022 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi SCOTT,

    Actually, KSD3.0 and KDS3.2 are all working ok on my side after enter the wait power mode, I even try the project which I give you on some colleagues's computer, and I didn't reproduce your problem on our side with the same board(FRDMK22), the same project(K02FN64VLF10.rar), the same debuggers(cyclone, multilink, even JLINK). But you said if you use the codewarrior, it works ok, and just the KDS have problem.

    Because I just the kinetis engineer, I think this problem you need to create a KDS error post on the KDS community, the KDS expert will help you to check it from the KDS software point, whether it is relative to some PC configurations.

   Today, I already see your post on the KDS area.

Debugger resets on WFI instruction

Please also add the error information to that post: no source avaiable of 0X4d8,  the picture which you give me.

  I will also follow your KDS post, if any help need about the kinetis, I will help you.

Best Regards,

Jingjing

0 Kudos
2,030 Views
scottm
Senior Contributor II

Hi Jingjing,

I set this aside for a while to work on other things, but it's come up again.  I compiled your project and it's doing exactly the same thing mine did.  I'm able to step through the WFI instruction but if I resume it immediately crashes.

I'm now using a P&E Cyclone connected via Ethernet rather than the Multilink over USB, but the behavior is exactly the same.

Any ideas?

Scott

0 Kudos
2,030 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi SCOTT,

    I am using the PE multilink, and test this code on my FRDM-K22 board, because I don't have K02 board.

  After get that you are using the Cyclone, I also try my project with Cyclone USB port,

4.jpg

    Then I also can debug my board.

5.jpg

  If you have the FRDM-K22, maybe you can try this code on our official board.


Have a great day,
Jingjing

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

0 Kudos
2,030 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Scott,

    You can compress your project with password and attach it, then you follow me, and send your password to me with the community message!

   Now did you test your K02 project on the K02 board or K22 board? I just have the K22 board, so I will test your K02 KDS project on my K22 board.

Best Regards,

Jingjing

0 Kudos