Control GPIO Pin with a Timer?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Control GPIO Pin with a Timer?

1,987 次查看
q1220200
Contributor III

Hello,

I want to know if it's possible to control (set / clear / toggle) GPIO pins directly with a timer on a FRDM-KL25Z?

I've worked previously with AVR 8 bit chips, and it's possible to set the timer expiry to directly manipulate GPIO pins. I've looked through a couple of relevant manuals, but can't really see how this can be achieved on this platform.

I'm not particular fussed about which timer module, so SysTick, TPM, PIT or whatever, I don't really mind. However, my preference would probably be PIT or SysTick as they have longer possible intervals than TPM (which I need).

Any help would greatly be appreciated as always.

Paul Swanson

标记 (5)
2 回复数

1,579 次查看
mjbcswitzerland
Specialist V

Paul

The TPM has outputs so that PWM (and such can be generated).

The PIT has no output so generally is used with an interrupt and the output is toggled/set/cleared) in the interrupt routine. If you are talking about long timeouts and interrupt would usually be adequate.

The PIT and TPM can also trigger DMA transfer which write to ports (clearing, setting or toggling) so that the output can be controlled without requiring interrupts (very low jitter). [Beware that when using PIT DMA triggers PIT0 can only trigger DMA channel 0 and PIT1 only DMA channel 1)]

As always, all these are supported in the uTasker project so professional engineers need not lose time working out how or using non-proven code.
If your work is for educational or hobby purposes you can still get almost everything from the open source version below and simulate the KL25 (including its timers, interrupts and DMA) in Visual Studio, which aids in further slashing development, debugging and testing times..

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

Regards

Mark


Complete Kinetis solutions for professional needs, training and support: http://www.utasker.com/kinetis.htmlKinetis KL25:
- http://www.utasker.com/kinetis/FRDM-KL25Z.html
- http://www.utasker.com/kinetis/TWR-KL25Z48M.html
uTasker: supporting >1'000 registered Kinetis users get products faster and cheaper to market
Request Free emergency remote desk-top consulting at http://www.utasker.com/services.html

Open Source version at https://github.com/uTasker/uTasker-Kinetis

1,579 次查看
q1220200
Contributor III

Thanks again, Mark.

0 项奖励