multiple TIM1 channels dutycycle update single DMA
I'm trying to update the duty cycle of 3 channels of timer 1 simultaneously with just one DMA event.


I'm trying to update the duty cycle of 3 channels of timer 1 simultaneously with just one DMA event.


Hello @RaulPosada,
In the TIM2_IRQHandler, your code attempts to directly assign values to the DMA channel's Control Register (CCR):
DMA1_Channel4->CCR = a * fasea[theta];
DMA1_Channel5->CCR = a * faseb[theta];
DMA1_Channel6->CCR = a * fasec[theta];
This is not the correct way to update the duty cycle of the PWM channels. The CCR of the timer channels should be updated with the duty cycle values, not the DMA channel's CCR. The DMA channel's CCR is used to configure the DMA channel itself, not to transfer data.
Also, the variable "theta" that you're declaring, needs to be a valid index within the bounds of the arrays
I suppose it represents an angle,in this case it needs to stay within the range of 0 to 359, which corresponds to the valid indices for the arrays.
So, theta needs to be properly defined, initialized, and updated somewhere in your code
Also, this line is not clear to me:
a=(((1/((Wref/4096)*10))/360)/150000000);
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.