Skip to main content
PPowe.1
Associate II
August 4, 2020
Question

Can you configure a timer in PWM mode (in the CubeIDE) to trigger DAC output?

Greetings!

I am new to microprocessors and am using an H7 board, and I have been using the CubeIDE. I have done most the basic/introductory examples, so I understand the basics of how to trigger the DAC with a timer, and how to run a timer in PWM mode, and some basic GPIO stuff.

I have been trying to combine the Timer Triggered DAC output with a PWM signal to create a DAC signal that starts on the falling edge of the PWM pulse and stops on its rising edge. From I have been told, the PWM signal cannot directly trigger the DAC (though I have been struggling to fully understand why), so the next best option would be to synchronize two timers. The master timer will control a PWM signal and the slave will be triggered by the PWM it, which hopefully then can trigger the DAC?

I have spent the last two weeks looking at example videos/documentation/forum posts online and have yet to find a solution that is specifically what I'm looking for. So, I would appreciate any help. Please let me know if this is even possible, and what I can do to get on the right track.

Thank-you!

This topic has been closed for replies.

2 replies

waclawek.jan
Super User
August 4, 2020

So, you want to trigger the DMA on both edges of the PWM signal? Then probably you might try using center-aligned PWM on TIMx_CH1 with generating CC1IF at both edges (i.e. TIMx_CR1.CMS=0b11), and using that as TRGO (i.e. setting TIMx_CR2.MMS=0b011).

I don't see how looking at videos might help. You may want to look into the Reference Manual (TIM, DAC and probably DMA chapters) instead.

JW

PPowe.1
PPowe.1Author
Associate II
August 4, 2020

In the end, I want to trigger the DAC to start pulling data from the DMA based on the timing of the pulse from a PWM signal. I've been looking at example videos because I've been working with the CubeIDE to configure all my peripherals.