how to use TIM2

Post Reply
Posts: 8
Joined: Wed Sep 26, 2018 3:18 am

how to use TIM2

Post by zhoujincheng »

hello,dear developers,
I want use TIM2_CH4 to generate some PWM output by the expansion connector RX2. But I can't use the code "DECH_USING_TIMER2" in my **deck.c,
maybe something wrong with "Used peripherals"? Can you tell me how to modify the deck_core.h? or ...
Posts: 2352
Joined: Tue Feb 06, 2007 12:36 pm

Re: how to use TIM2

Post by arnaud »

The DECK_USE_ defines are intended to be used by a deck driver to declare that a peripheral is used, this allows to check for conflict before initializing the driver. Though it does not mean that the deck subsytem has easy-to-use driver for all these peripheral.

DECK_USE_TIMER2 does not exists because TIM2 is already used to generate the PWM signals to the Crazyflie 2 motors so you cannot use it in a deck driver. On TX2/RX2 you should be able to use TIM5 (hence the existence of DECK_USE_TIMER5).

There is a example of deck using TIM5 to generate pulse train on TX2: ... sterdeck.c.
Post Reply