Question
Timer help
Hi,
i have a STM32F303RC and i have the following problem:
With the Pin A2 i want to produce a sequence of 10 pulses.
My attempt is to use a PWM TIMER Channel (TIM2 CH3) in one pulse Mode and retrigger it till i have generated my 10 Steps.
However, my code only generates 2 pulses.ow can i rearm the Timer correctly?
Does anyone know an easier way to solve the problem?
void HAL_TIM_PeriodElapsedCallback (TIM_HandleTypeDef *htim)
{
if(htim->Instance==htim2.Instance)
{
__HAL_TIM_SetCounter(&htim2,0);
p++;
}
}
int main(void)
{
MX_TIM2_Init();
HAL_TIM_PWM_Start_IT(&htim2, TIM_CHANNEL_3);
HAL_StatusTypeDef status= HAL_TIM_OnePulse_Start(&htim2, TIM_CHANNEL_3);
if(status != HAL_OK) {}
while(p<10)
{
while(htim2.State != HAL_TIM_STATE_READY) { }
}
finished=1;
}
