Page 1 of 1

how to use TIM2

Posted: Fri Jan 11, 2019 2:25 am
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 ...

Re: how to use TIM2

Posted: Wed Jan 23, 2019 8:30 am
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: https://github.com/bitcraze/crazyflie-f ... sterdeck.c.