I’ve got an application where I need to generate a 1kHz square wave, and also measure the voltage on the positive half cycle (the square wave amplitude is pulled down externally).
The impedance of the signal is 220k which I know is on the high side - which leads to my first question, if sampling this signal at 1kHz, would it be recommended to use an op amp buffer on the signal? I suppose testing would be the way to go (which I will soon) but also just interested in others opinions as I’ve heard that the input impedance of the STM32F2 is relatively low.
Aside from this, in terms of the actual software implementation, to sample in sync with the generated PWM, could a solution be use the new IntervalTimer library at 1kHz and simultaneously toggle the output pin (to create the PWM) and also read the ADC at the same time? Is this an efficient method?
I’ll also need to vary the duty cycle of the PWM as well…
Any thoughts are much appreciated!