Need help to initialize External Watchdog Monitor(EWM) with software interrupt.

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

Need help to initialize External Watchdog Monitor(EWM) with software interrupt.

1,566 Views
sujaigowda
Contributor II

We are using EWM(external watchdog monitor) module on MK50DX256CLL10 controller for powerfail application.I have given 100ms pulses as input to the EWM_in pin from external circuit. I need an interrupt if we misses the pulse in 100ms time. I cannot use EWM_out pin because we are already using it for other applications, Is there anyway to get interrupt without using EWM_out. External circuit will not generate a pulse if powerfail occurs. I need interrupt when EWM_in misses the pulse(powerfail)  It should be software interrupt without using EWM_out pin.

we need clarification weather we can generate interrupt in software without using EWM_out pin. Appreciate your help in understanding EWM. Is there any initialization or sample code for this?

Thanks

SUJAI

0 Kudos
3 Replies

968 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Sujai Gowda:

The EWM_in pin is not intended to work with pulses. That pin is used together with the EWM internal refresh mechanism. An external circuit should provide a static value to the pin when the hardware is working as expected (1 or 0, depending on the bit EWM_CTRL[ASSIN]). Then you can configure the EWM to a 100 ms period and your application is responsible for servicing the EWM within that time. If the EWM is refreshed while the EWM_in pin is asserted, then an interrupt is generated if enabled with EWM_CTRL[INTEN].

Otherwise if you really need to monitor 100 ms external pulses then I see 2 options:

1) Use the internal watchdog (WDOG instead of EWM) with a ~105 ms time-out. Connect the pulsing signal to an input pin configured as interrupt-on-edge and refresh the watchdog from the ISR. The inconvenience is that the MCU will reset if watchdog expires.

2) Set any timer (PIT, LPTMR) for a ~105 ms period. As in option (1) connect the pulsing signal to an interrupt pin and restart the timer from ISR. If timer is not restarted then its interrupt is triggered.

I hope this helps.


Regards!,
Jorge Gonzalez

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

968 Views
sujaigowda
Contributor II

Hi Jorge,

Thank you for your reply and it helps us greatly to understand EWM.

We can make changes to the external circuit to generate static value as you said(1 or 0, not pulses). Can we now able to generate an software interrupt when EWM_in pin chnages its state(1 or 0, depending on the bit EWM_CTRL[ASSIN]) without using EWM_out pin ?

can we generate software interrupt from EWM module?

Thanks

Sujai

0 Kudos

968 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Sujai Gowda:

Yes, if you generate static value to the EWM_in pin, you can generate an interrupt without using the EWM_out pin. Just enable the interrupt using the bit EWM_CTRL[INTEN] = 1. Please check the Reference Manual about this bit.

Notice the interrupt will not be triggered immediately when EWM_in changes, but when the software tries to refresh the counter.

Regards!

Jorge Gonzalez

0 Kudos