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);
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.