2009-10-14 01:44 AM
3-phase sinusoidal PWM (OPEN LOOP)
2011-05-17 04:26 AM
Hi ,
I've decided to use TIM1 (PA8 ) as output. I need only one SPWM signal. I wish to know where to keep that code for PWM[i] which you were talking about. I tried keeping that code in STM32f10x_it.c but it was showing me errors when i compliled it. Thanks..2011-05-17 04:26 AM
Hi gaya,
copy the code below in TIM1_CC_IRQHandler() i++; TIM_OCInitStructure.TIM_Pulse = PWMdata[i]; TIM_OC1Init(TIM1, &TIM_OCInitStructure); /* check if array's index reaches the max: 255 */ if (i == 255) i = 0; TIM_ClearFlag(TIM1, TIM_Flag_CC1); Do not forget to declare ''i''. What is the error message you are getting?MCU Lüfter2011-05-17 04:26 AM
Hi,
I'm using timer1 & in code TIM_TimeBaseStructure.TIM_Period = 399 i.e to get a output frequency of 20KHz. I've written a loop to get the output to read values in PWM data but the frequency is changing continously. I want to know which is that interrupt or flag or register that will update or set when the timer reaches a count of 400 (399+1). So that i can put my loop code to execute when the timer reaches the desired count. should i change something from timer1 interrupt or from NVIC configuration to check for that timer count.2011-05-17 04:26 AM
Hi Lufter,
The errors I'm getting after pasting that code in stm32f10x_it.c in TIM1_CC_IRQHandler()
error1:identifier ''TIM_OCInitStructure'' is undefined error2: identifier ''PWMdata'' is undefined error3: error: #20: identifier ''TIM_Flag_CC1'' is undefined These are the 3 errors i'm facing. & i've declared ''i'' as extern unsigned int i=0;
2011-05-27 11:43 PM
These are pretty basic errors in C when you don't #include the correct files from the library, and fail to define extern's across source files. If PWMdata is defined in main.c, the only way it will be visible in stm32f10x_it.c is for it to be defined as an extern.
The errors I'm getting after pasting that code in stm32f10x_it.cTIM1_CC_IRQHandler()
error1:identifier ''TIM_OCInitStructure'' is undefined
error2: identifier ''PWMdata'' is undefined
error3: error: #20: identifier ''TIM_Flag_CC1'' is undefined
These are the 3 errors i'm facing. & i've declared '' i'' as extern unsigned int i=0;
2011-06-06 01:21 AM
Muratterzi,
Please respond to my queries. Thanks in advance2011-12-20 02:46 AM
2014-08-19 10:30 PM
Hi,
I have an STM32F051 board. I want to generate a 3 phase sinusoidal pwm waveform, and also control its frequency and duty cycle. How can this be done? F0 series has only 1 parameter for NVIC Priority, whereas F1 and higher versions have multiple priorities. How can the program be transformed to suit my requirements?2014-08-20 06:37 AM
Look this is a thread from 2009 (Five Years Ago, the 17-May-2011 date is when the forum melted down last), the interrupt priority really doesn't material effect how it works, and as best I can tell at a glance is that it interrupts on each of the timer channels, and then programs a new pulse width into that channel. The frequency is going to depend on the timer's prescaler, and period, and the length of the table.
Please open a NEW thread for a NEW topic, and refer to, or cite, the old one if you must