2021-10-05 02:35 AM
Hi, I am using STM32F3Discovery board for our project at the moment. We need to sample 4 different signals at the same time so we are using all 4 available ADCs in parallel. We are triggering all the ADCs with Timer3 at 100kHz and to make sure the timing is OK we output a GPIO pulse when the conversion complete interrupt is triggered (only one of the ADCs is interrupt enabled) . We checked the signals on the oscilloscope and it seem that after the ADC conversion start trigger (Timer3 rising edge), it takes about 2.5us to enter the conversion complete interrupt service routine. In the reference manual it says the conversion time is 0.21us for slow channels. We were planning to sample 1MHz signals but we are struggling with 100kHz. We are using the fastest possible settings available on CubeMX, what can be causing this factor of 10 error?
Thanks,
Kıvanç
2021-12-01 05:13 AM
hello ,
Uwe Bonnes ->can you share your code with me? same problem ı have
2021-12-20 10:14 PM
How 2us is related to 100 khz? From your screenshots it seems that timer 3 frequency is 1MHz,it toggles GPIO at half rate 1/2[us] = 1/(2*10^-6) = 500000[Hz] = 500[kHz] = 0.5 [MHz]. If you trigger source timer is "output compare toggle on match" this explains everything, timer GPIO output provides 500kHz and ADC samples at 500kHz.
2021-12-21 02:49 AM
I am trying to sample a 100kHz signal, minimum Nyquist sampling rate is 200kHz... The yellow trace in the oscilloscope is the output of timer 3, which has a period of 5us, which translates to 200kHz, not 1MHz.
The ADCs are triggered on the positive edges of that yellow trace. The blue pulses are generated in the ADC conversion complete interrupt routine. I don't even read the ADC values in the ISR, all it does is to generate a GPIO pulse, as seen in the blue trace.
If ADC conversion starts at the positive edge of the yellow trace and the data becomes available at the positive edge of the blue trace than the conversion takes 2us. Datasheet says conversion takes 0.2us... I am using the fastest settings that is possible, I can't see what is wrong with my setup.