AnsweredAssumed Answered

Soft PWM?

Question asked by chuev.vladimir on Dec 4, 2017

I need to update DAC in PWM.
I have STM32F103C8T6 and two free timers (TIM3, TIM4).
But they only have one global interrupt. How do I get PWM?
I'm only called HAL_TIM_PWM_PulseFinishedCallback() and I get the meander.

 

// PWM Pulse finished

bool flag = true;
void HAL_TIM_PWM_PulseFinishedCallback(TIM_HandleTypeDef *htim){
    if(htim->Instance == TIM3) {
        UpdateDAC(flag  ? 1.125 : 0.5);

         flag = !flag;
    }
}

 

Outcomes