Synchronization between PWM signal and ADC
Hello!
I'm trying to synchronize a PWM signal with an ADC (by TRIGGER OUT EVENT). There are 2 issues:
1. The frequency of the PWM signal is 200 Khz and the frequency of the ADC is 12 Mhz. According to the calculation of 14 cycles (12.5 cycles + sampling time of 1.5 cycles), the conversion time should be 1.16 microseconds, but according to the test, it turns out that this time is 3.16 microseconds (from raising the PWM signal and receiving the result of the conversion). That means there is a gap of 2 microseconds. What could be the reason for the gap and how can it be solved?
2. In addition to this, I tried to perform the experiment with synchronizing a PWM signal with a frequency of 500 Khz. In this mode, the result of the ADC is not received in every cycle, but once every few cycles (in a manner consistent with the PWM signal) - Probably this is due to the 2 microseconds that are added in each cycle.
I would like to know how it is possible to synchronize to a PWM signal with a higher frequency and perform a sample once per cycle (because there is probably some error in the initialization of the system from my side).
I use STM32F103C8T6.
Thanks!