Using Input captur in PWM mode with DMA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-09-14 2:12 AM
Hello,
I want to capture the duty cycle of an input PWM with the timer feature PWM Input on CH1.
Channel 1 is configured on rising edge, channel 2 is configured on falling edge.
The DMA is configured for this timer on channel 1, channel 2 can't have DMA.
To compute the duty cycle, I need the total period widh (store in CCR1) and the pulse width (stored in CCR2).
My goal is to start a measurement, and when the DMA is complete, get several values in order to compute an average duty cycle.
Is it possible to get both values (multiple times) with only one channel configured with a DMA.
Thanks
- Labels:
-
DMA
-
STM32F0 Series
-
TIM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-09-14 2:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-09-14 6:19 AM
It's almost what I want, but my timer has only DMA for channel 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-09-14 6:28 AM - edited ‎2023-09-14 6:29 AM
I'm not sure. But I think you can do this by setting the polarity selection for both edges (rising and falling edge).
Try this. It may works.
Best regards.
II
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-09-18 2:03 AM
Hello @I2.1,
No, I'm afraid you can't
As far as I know, it is not possible to configure this DMA channel to transfer data from two different memory locations.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-09-18 3:07 AM
Which STM32? Which timer?
You may be able to use the DMAR/DCR mechanism, read description of these registers in TIM chapter of RM.
JW
