WatchDog_LDD component with EWM on K64

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

WatchDog_LDD component with EWM on K64

Jump to solution
1,068 Views
matthewkendall
Contributor V

I am using a Kinetis K64 device with MQX, using Processor Expert to create drivers for some peripherals for which MQX does not provide drivers.

I am using the WatchDog_LDD component to configure and drive the EWM (the External Watchdog Monitor module, not the regular Watchdog Timer module). PE generates an Init() function that I call to initialise the device, and a Clear() function that I call regularly to clear it. If I don't clear it at the appropriate rate the watchdog expires and the EWM_OUT pin becomes asserted, which forces some external hardware into a fail-safe state. This all works as expected.

I would like to be able to tell, in firmware, if the watchdog has expired. Processor Expert does not offer to generate any function that would provide this information. Looking at the MCU datasheet, I see there is no convenient register bit that shows this. There is, however, a register bit that enables an interrupt on expiry. Processor Expert looks like it has the ability to generate a callback via the OnWatchDog() event, but this is greyed out and I cannot set it to generate code.

Is there some way to enable the OnWatchDog event of the PE WatchDog_LDD component for the EWM on the K64? If so, how?

0 Kudos
1 Solution
540 Views
marek_neuzil
NXP Employee
NXP Employee

Hello,

The WatchDog_LDD component does not support the OnWatchDog event for EWM device. You can use Init_EWM component to initiliaze EWM and enable EWM interrupt. The interrupt service routine is declared and the interrupt service routine is registered in interrupt vector table. But you must write own code to service this interrupt.

The Init_EWM does not provide any other methods and therefore you must also write own EWM clear function (e.g. you can copy the code from the Clear method of the WatchDog_LDD component):

PE_ISR(EWM_ISR) {
/* user interrupt service routine code */
. . .
}

void EWM_Clear(void) {
EnterCritical();
EWM_PDD_WriteServiceReg(EWM_BASE_PTR, EWM_PDD_KEY_1);
EWM_PDD_WriteServiceReg(EWM_BASE_PTR, EWM_PDD_KEY_2);
ExitCritical();
}

Example of Init_EWM component configuration:

Init_EWM_settings.png

Best Regards,

Marek Neuzil

View solution in original post

0 Kudos
4 Replies
541 Views
marek_neuzil
NXP Employee
NXP Employee

Hello,

The WatchDog_LDD component does not support the OnWatchDog event for EWM device. You can use Init_EWM component to initiliaze EWM and enable EWM interrupt. The interrupt service routine is declared and the interrupt service routine is registered in interrupt vector table. But you must write own code to service this interrupt.

The Init_EWM does not provide any other methods and therefore you must also write own EWM clear function (e.g. you can copy the code from the Clear method of the WatchDog_LDD component):

PE_ISR(EWM_ISR) {
/* user interrupt service routine code */
. . .
}

void EWM_Clear(void) {
EnterCritical();
EWM_PDD_WriteServiceReg(EWM_BASE_PTR, EWM_PDD_KEY_1);
EWM_PDD_WriteServiceReg(EWM_BASE_PTR, EWM_PDD_KEY_2);
ExitCritical();
}

Example of Init_EWM component configuration:

Init_EWM_settings.png

Best Regards,

Marek Neuzil

0 Kudos
540 Views
matthewkendall
Contributor V

Hi Marek, thanks for the reply. The options that PE shows me are not the same as the ones shown in your screenshots. The Methods pages does offer to generate a Clear function (and it works), but the Properties page has no settings concerning interrupts.

properties.png

methods.png

0 Kudos
540 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Matthew:

Marek recommended the Init_EWM component (pastedImage_0.png), your screenshot is for WatchDog_LDD (pastedImage_4.png).

Please read again his proposed workaround. Although I am not sure if the interrupt can be handled independently from MQX RTOS.


Regards!,
Jorge Gonzalez

0 Kudos
540 Views
matthewkendall
Contributor V

Right, got it, thanks.

0 Kudos