2018-06-27 04:25 AM
Hello,
I am new in timer implementation , I want to generate PWM timer with an external clock using 2 MHz as frequency.. It shall be possible to enable or disable the generation of the PWM signal. I can able to generate, But I have a doubt for running the timer with support should give- blocking , DMA or interrupt ??
I have found three different function is available ,HAL_TIM_PWM_Start(),HAL_TIM_PWM_Start_IT() and HAL_TIM_PWM_Start_DMA() , What is the difference between these three ?? which is suitable for 2Mhz PWM timer generation and why ?
I'm using STM32F7 Nucleo Board
Any help would be appreciated.
Thanks in advance.
2018-06-28 03:36 AM
Hello
sur.poulamee@in.bosch.com
,Can you please precise if you want to put the 2MHz frequency signal as an input clock source for timer
or generate PWM timer signal with 2 MHz frequency? If it is possible provide a figure that explain your expected configuration.
If you just want generate a PWM signal, you can use the HAL_TIM_PWM_Start function.
For HAL_TIM_PWM_Start() funtion:
Starts the PWM signal generation.
The HAL_TIM_PWM_Start_IT() funtion s
tarts the PWM signal with interrupt generation.
HAL_TIM_PWM_Start_DMA() funtion s
tarts the TIM PWM signal with DMA request generation.
You can refer to the
it can help you to understand the PWM generation signal.I recommend you to start from the TIM_PWMOutput example within the
firmware package examplesSTM32Cube_FW_F7_V1.11.0\Projects\STM32F746ZG-Nucleo\Examples\TIM\TIM_PWMOutput
With Regards,
Imen
2018-06-28 04:03 AM
'
I want to generate PWM timer with an external clock using 2 MHz as frequency.. '
2Mhz PWM frequency would be nuts, most of the times.
'But I have a doubt for running the timer with support should give- blocking , DMA or interrupt ??'
does HAL come with any documentation? if not, read the code / examples and compare it to datasheet to see how it works.
2018-06-28 04:45 AM
Hello
DAHMEN.IMEN
Thank you for your reply , the timer should generate 2 MHz frequency.
If I go with polling method, It will be block the CPU or something else??
Do you have any idea on that ?
2018-06-28 07:45 AM
Hi
sur.poulamee
,The CPU cannot be blocked by the timer and to generate the 2MHz frequency, you should apply this equation:
Where:
TIM_CLK = timer clock input
PSC = 16-bit prescaler register
ARR = 16/32-bit Autoreload register
I suggest you to use STM32CubeMx tool, which help you to develop your Timer application with easy configuration and generate an initialization code.
WIth Regards,
Imen