KL02 run after a reset

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

KL02 run after a reset

810 Views
scottyevans
Contributor I

Hi, I have a KL02 micro and it wont run after a sw reset (SYSRESETREQ). The chip does reset but is held in reset until i run it manually. how do i get it to run after a reset?

I simply have this in main :

SCB_AIRCR = SCB_AIRCR_SYSRESETREQ_MASK;

and then it resets and stays at the beginning of __thumb_startup()

I have verified that it doesn't run after the reset when not in debug with an LED that should flash. without the reset it happily flashes. With the reset it never comes on (obviously it wont flash at all but it should get the the point of turning the LED on before reseting again)

0 Kudos
7 Replies

640 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hello Scott Evans,

   Your software reset code have problem, please do it like this:

#define Reset()      ( SCB_AIRCR = SCB_AIRCR_VECTKEY(0x5FA) | SCB_AIRCR_SYSRESETREQ_MASK)

  Then try again.

Wish it helps you!


Have a great day,
Kerry

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

0 Kudos

640 Views
scottyevans
Contributor I

Hi Kerry

I have tried that but its still not behaving how i expect. The reset works fine (not only for the Reset() function, but for all other types of reset). After completing a reset it doesn't start running automatically.

For example, i have a watchdog running but i don't bother poking it, so after the watchdog expires I would expect to see it hit the same point in main() continuously, as it keeps resetting and goes back to the __thumb_startup(). This isn't happening though, it does remains on the __thumb_startup() function.

Any ideas on why?

Thanks

0 Kudos

640 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hello Scott Evans,

  Do you mean your watchdog can't reset?

 You can check the register, whether your watchdog is disabled, because the watchdog control register is write once after reset, so I think maybe your watchdog is disabled before.

If you still have question about it, please kindly let me know!


Have a great day,
Kerry

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

0 Kudos

640 Views
scottyevans
Contributor I

Hi Kerry,

No my watchdog is firing perfectly fine. but once it does fire and resets the device, the device does not automatically run again.

Its not an issue with the watchdog but with the reset procedure, as the same happens when i reset the device any other way

0 Kudos

640 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hello Scott Evans,

   Did you debug it?

   After the reset happens, where is it stopping?

  You can give me a shot screen about your debug information when the problem happens.


Have a great day,
Kerry

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

0 Kudos

640 Views
scottyevans
Contributor I

Hi Kerry

Sure, please see attached image. It is stopping right on __thumb_startup() as I mentioned before (no other breakpoints are set). it will only continue to run if I hit the "resume" button.

As you can see on the image, RCM_SRS0 indicates a reset was caused by a watchdog timeout on this particular instance, but the same happens if I did say an external reset pin.

reset issue.png

0 Kudos

640 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hello Scott Evans,

   I understand you now.

   Actually, this is just the character of debugger, when the reset happens, it will stop after reset.

  But, after you download the code to your board, it will work normally after you feed the watchdog in time.

  You can download your code to your chip, and test the function without the debug.

  Please try it without the debugger again, whether your functions works, you can printf some data as the working log.

Wish it helps you!


Have a great day,
Kerry

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

0 Kudos