MKL26Z256: How can MCUXpresso IDE debug COP watchdog code?

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

MKL26Z256: How can MCUXpresso IDE debug COP watchdog code?

547 Views
bgraham
Contributor IV

MCUXpresso IDE v11.0.1 [Build 2563] [2019-09-01]

C++ FreeRTOS, SDK

Segger j-link Plus

MKL16Z256 on the board. MKL26Z256 in the project.

MCUXpresso SDK: SDK_2.x_MKL26Z256xxx4

I have added the COP to my project uses the watchdog, calling COP_Init(SIM) and COP_Refresh(SIM).

Start code

COP_GetDefaultConfig(&m_configCop);
m_configCop.enableWindowMode = false;
m_configCop.clockSource = kCOP_LpoClock; // 1 kHz
m_configCop.timeoutCycles = kCOP_2Power10CyclesOr2Power18Cycles; // MAX count - timeout in 1024 mSec

COP_Init(SIM, &m_configCop);

Thread code

calls COP_Refresh(SIM) every 100 mSec.

I tested my code, with COP_Refresh(SIM) commented out, or not commented out.

When the app runs under the debugger in MCUXpresso IDE, the COP does not reset the MCU.

When the app runs without the debugger, the COP is resetting the MCU.

So, I know the COP code is working, but I don't have the debugger working as expected.

From the manual, I expect the MCUXpresso IDE debugger to reset and resume the COP

KL16 Sub-Family Reference Manual, Rev. 3.2, October 2013 

3.4.10.2 COP watchdog operation

If the 1 kHz clock source is selected, the COP counter is re-initialized to 0 upon entry to
either Debug mode or Stop (including VLPS or LLS) mode. The counter begins from 0
upon exit from Debug mode or Stop mode.

Is there a way to get the MCUXpresso IDE debugger to work with the COP, as implied in the manual?

Thanks,

Bruce Graham

0 Kudos
1 Reply

462 Views
Sabina_Bruce
NXP Employee
NXP Employee

Hello Bruce,

In the section 3.4.10.2 COP watchdog operation of the Reference Manual, says that the COP counter does not increment while the microcontroller is in Debug Mode when it is not the 1KHz clock source. This describes that if the counter is at 0x15 (for example), then when it is out of debug mode it will count next to 0x16. However if the clock source is 1KHz, then it is reset to 0 regardless of what the counter is once it exists the counter will next count at 0x1.

KL26 Sub-Family Reference Manual 

 

If it is in free run while debugging you should be able to see the reset occur. Otherwise, stepping through will not work properly with the watchdog.

Best Regards,

Sabina

0 Kudos