2016-11-08 10:59 AM
Hi, I want to generate short pulses on channels 1, 2 and 3 of TIM4. Pulses on each channel must be shifted relative to other channels, just like on image below:
Main idea is:At first I set TIM4 mode to TIM_OCMode_Active, then set different CCRx values to each channel, then in TIM4 interrupt handler i managed to add to CCRx constant value (my pulse width) and set TIM4 mode to TIM_OCMode_Inactive. In the next interrupt CCRx and TIM4 mode were set to the original values.After many tests it doesn't work, even single channel. I'm not able to paste here my code right now, if needed i can do this later. Is the idea good, is it even possible to do this or am i convicted to use 3 different timers? If it is possible can someone help me with some working code? #!stm32f4-!timer-!channels-!pulse2016-11-08 11:05 AM
Toggle mode has been used to get specific edge placement.
2016-11-08 11:34 AM
So all I should do is to set toggle mode at the beginning and in the interrupt handler control only CCRx, right?
Could you please also tell me what actually is TIM_OutputState? I couldn't get any information if should i pass the TIM_OutputState_Enable or TIM_OutputState_Disable...Thank You in advance, Sir.2016-11-09 08:33 AM
Hi varsheim,
I recommend that you have a look to the example ''TIM_ComplementarySignals'' in the STM32CubeF4 library package where you find how to ouptout signal with dead timer insertion ; at this path STM32Cube_FW_F4_V1.13.0\Projects\STM324xG_EVAL\Examples\TIM\TIM_ComplementarySignals-Hannibal-2016-11-09 08:53 AM
I've generally initialized the timer, and initial phase angles, and then advanced the phase angles in the CCRx as each of the prior ones have hit. For higher frequencies one might need to decimate interrupt loading using DMA to load from tables.
I've posted examples of the toggle mode method on the forum, but I'm not a motor guy, and this isn't how I use STM32 parts.