Watchdog on KL24z

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

Watchdog on KL24z

809 Views
mikeconover
Contributor II

Has anyone ever been able to get the watchdog to work on the KL24z?

Every time I try and run the processor it goes into the statement below which is in boot.S. Has anyone seen this problem before? 

/* Disable interrupts and clear pending flags */

        ldr r0, =0xFFFFFFFF

Thanks,

Mike

0 Kudos
5 Replies

634 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Mike Conover:

Please provide more details about your issue:

- What IDE are you using (CW, KDS, IAR, Keil)?

- How are you configuring the Watchdog?

- Is this code from a new project created by you or an example project?

In general any context information that helps us understand your issue and provide feedback.

Regards!

Jorge Gonzalez

0 Kudos

634 Views
mikeconover
Contributor II

Jorge,

Thanks for the reply.

I am using CW with MQX lite.

I tried configuring the watchdog a few ways. First, I tried through processor expert and using the watchdog_LDD, but that didn't seem to work at all. Secondly, I tried by just modifying the registers. In this second case I am using SIM_COPC = 0xE; to setup the watchdog timer. Then, using SIM_SRVCOP = 0x55; SIM_SRVCOP = 0xAA; to clear the watchdog timer.

I started with an example project a while ago, but have written a ton of code around it.

I don't know if a watchdog will solve my problem or not though. I just wanted to try it and see if it would work. My main issue is that I have a state machine in a task and the state machine is getting stuck in a state. It doesn't get stuck every time, just randomly. This is a battery powered application so I go to sleep after the state machine is done, so I can't every troubleshoot and see where the code is getting stuck. It never gets stuck the first time through the state machine.

Let me know if you need any more info for my application. I have 50 units out at a customers site and not all of them have froze, but a majority of them have. :smileysad:

Thanks,

Mike

0 Kudos

634 Views
mikeconover
Contributor II

Are those the correct commands to start the watchdog and keep it going? Also, I commented out the code where processor expert writes to the SIM_COPC register because you can only update that register once after a reset.

-Mike

0 Kudos

634 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Mike:

Sorry for the delay.

I am not sure what is causing your application to crash, but regarding watchdog, I attached a simple project for KL24 with MQX_Lite and the Watchdog_LDD component. You may give it a check.

Some comments:

1) The file boot.S you mentioned above is actually the MQX entry point. This means that the watchdog was timing out.

2) From the CPU component, set the property "Watchdog disable" to no:

pastedImage_3.png

3) From either of your tasks you have to refresh the Watchdog by calling the WDog_Clear() method as in the attached project:

void Task1_task(uint32_t task_init_data)

{

  int counter = 0;

  while(1) {

    counter++;

    /* Write your code here ... */

    WDog1_Clear(WDog1_DeviceData);

  }

}

4) If you comment out the Clear method, then you will see the execution restarting from boot.S.

About your question, your configuration seems correct. You can inspect PEx generated Watchdog code and confirm it is actually the same at least for the refresh part.

Let me know if you have doubts.


Regards!,
Jorge Gonzalez

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

0 Kudos

634 Views
mikeconover
Contributor II

Thanks a lot Jorge. I think my issue is with the MQX lite. It is like the task is getting stuck in the idle state or something. I have not been able to figure out the problem. Thanks for your help.

-Mike

0 Kudos