Generation of clock pulse from a GPIO pin in k70

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

Generation of clock pulse from a GPIO pin in k70

951 Views
ameybhopi
Contributor II

Hi, I am working on k70 microcontroller. I want to generate clock pulse for external watchdog module TPS3813K33 through PTC14 pin that is connected with watchdog timer input(WDI) pin. PTC14 pin does not have any FTM channel. How can I generate a pulse within each 200ms with on time of 2.5 ms and off time of 108ms. I need help. Thank you.

Regards,

Amey Bhopi

Tags (1)
4 Replies

623 Views
Carlos_Mendoza
NXP Employee
NXP Employee

Hi Amey Bhopi,

You can use the FlexTimer interrupts to call an ISR function where you toggle the PTC14 pin to feed the watchdog. Please find attached an example project and document that describe the FlexTimer and a few of its uses, the example was created for the K60 MCUs but you can use it as reference for your application.

You could also use Processor Expert to do this, please take a look to the following post created by our colleague Erich Styger, it explains how to blink a led using a timer:

http://mcuoneclipse.com/2013/03/29/version-control-with-processor-expert-projects/

Hope it helps!

Best Regards,

Carlos Mendoza

Technical Support Engineer

-----------------------------------------------------------------------------------------------------------------------

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

-----------------------------------------------------------------------------------------------------------------------

623 Views
mjbcswitzerland
Specialist V

Hi Amey

It is a good idea to generate the 2.5ms pulse using a timer interrupt but it is not a good idea to generate the 200ms period using an interrupt when it is used to retrigger an external watchdog.

The reason is that your ISR may be operating since it is an interrupt but your software, which the watchdog should be protecting, may be stuck in a forever loop and so never be able to be recovered by the watchdog.

This means that the 200ms period should be controlled by a software timer as should the actual setting of the output, and starting of the 2.5ms period timer - this should therefore be by a low priority software task or similar so that the watchdog can correctly monitor its operation.

Regards

Mark

Kinetis: µTasker Kinetis support

K70: µTasker Kinetis TWR-K70F120M support

Software Timers: http://www.utasker.com/docs/uTasker/uTaskerTimers.PDF

Hardware Timers: http://www.utasker.com/docs/uTasker/uTaskerHWTimers.PDF

For the complete "out-of-the-box" Kinetis experience and faster time to market

623 Views
ameybhopi
Contributor II

Thank a lot Carlos and Mark. All the documents are really helpful for me. Carlos on PTC14 pin in k70 there is no channel for flex timer, I think we cant use FTM for that pin. Initially i used timer interrupt(Overflow and compare match) to generate delay but the board was resetting continuously. So I thought of using a timer component in MQX and toggling the pin with the appropriate delay. Now its working fine :smileyhappy:. Please tell me if any do's and dont's regarding use of watchdog. Thank you.

Regards

Amey Bhopi

0 Kudos

623 Views
Carlos_Mendoza
NXP Employee
NXP Employee

Hi Amey,

It is good to hear it is now working fine, some recommendations for the usage of an external watchdog are: not to use the same crystal for the MCU and for the Watchdog, place a pull-up/down resistor to the pin being used to feed the watchdog and to make sure the configuration of this pin does not change.

Hope it helps!

Best Regards,

Carlos Mendoza

Technical Support Engineer

-----------------------------------------------------------------------------------------------------------------------

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

-----------------------------------------------------------------------------------------------------------------------

0 Kudos