STM32G4 ADC Trigger using PWM out pin to measure the frequency
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-11-19 3:43 AM
Hi,
We want pwm out raising edge should trigger the adc conversion after that callback should trigger then we can able to measure input adc frequency.
We know timer peripheral can trigger the adc we don't know how to implement.
Which timer we has to use for our application (HRTIM, Advanced Timer).
Adc callback should trigger every pwm raising edge to get the adc value and the timestamp to calculate the frequency.
Please help to get solve this issue.
- Labels:
-
ADC
-
STM32G4 Series
-
TIM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-11-19 3:59 AM
"We want pwm out raising edge should trigger the adc conversion after that callback should trigger then we can able to measure input adc frequency."
oh man im having hard time understanding you, you should try google translate.
You meant this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-11-19 4:01 AM
in case you dont know what to google https://www.google.com/search?q=stm32+triggering+adc
What i believe you want to do is quite straight foward and normal way of triggering ADC readings
Depends of what ADC youre using but if you go to cubeMX: you can see which timers have the option to trigger your adc conversions
Then you just configure your tim3/8/... to trigger event (it doesnt need to have any pwm channel on for you aplication)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-11-21 7:54 AM
Hi @Javier Muñoz​,
Thanks you for your reply.
I want to generate pwm output with 500HZ 50%duty cycle.
This PWM output and ADC trigger should be linked together.
Every PWM output rising edge adc callback should be triggered to read the adc value after that internally capture the timestamp of two different rising edge to measure adc frequency (means input and output adc frequency should be same).
Above mentioned logic which timer would be possible?
Thanks & Regards,
Vasu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-11-22 12:02 AM
As i said thats the normal way of triggering an ADC, any PWM triggered ADC tutorial should work for you.
>Every PWM output rising edge adc callback should be triggered to read the adc value after that internally capture the timestamp of two different rising edge to measure adc frequency (means input and output adc frequency should be same).
The adc sampling frequency will have the same fixed frequency as the PWM triggering it , i dont see why you want to calculate it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-11-22 12:10 AM
Hi,
The adc sampling frequency will have the same fixed frequency as the PWM triggering it , i dont see why you want to calculate it
- In order to find hardware failure and environmental condition.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-11-22 3:37 AM
I dont understand what you want to archieve, sorry, icannot help.
If youre worried about hardware faliure check some tutorial about the watchdog usage .
