0
\$\begingroup\$

I am trying to do a partial integration on a 550 KHz waveform using STM32F4 Discovery board using the Waijung toolset in Simulink. The sampling time that I am using is 0.018 us, i.e 3 cycles, if the clock frequency is 168 MHz. The ADC prescaler is 2, so the ADC frequency is 84 MHz. The total time required for the conversion should be 0.143 us (12 bit resolution) +0.018 us i.e. around 0.16 us. This should theoretically suffice the Nyquist criteria for sampling. However, I dont seem to get any output at the end. I can't see the real time data after ADC, using the serial interface or the DAC. So I am not sure what I am doing wrong. Any suggestion or idea is much appreciated.

P.S. I am attaching the waveform I am trying to acquire (integration between say 20 us to 140 us) and the simulink program. Please let me know if any other information is required.

Waveform Simulink Program Sys Clock

\$\endgroup\$
  • \$\begingroup\$ I'll tell you, the chances of this working out of the box at that sample rate are basically nil. There is no way the chip can keep up with that sample rate and do all that processing and send data through the UART in three cycles. \$\endgroup\$ – pgvoorhees Sep 20 '18 at 11:21
0
\$\begingroup\$

I am not sure exactly which chip you are using, but STM32F4 family has maximum ADC sampling rate 2.4 MS/s or 7.2 MS/s if you use 3 of ADCs in triple mode.

You are also missing that between main clock and ADC is one more prescaler which limit clock on APB2 bus. Maximum clock on APB2 is 90 MHz which has to be divided with 2 for maximum ADC clock of 45 MHz.

To actually achieve this sampling rate you need to consider data speed (7.2 MS/s* 12bit=86 Mb/s), which is way too fast for serial communications available on chip. What you could do is use DMA to gather samples on chip memory and later send then slowly to PC.

\$\endgroup\$
  • \$\begingroup\$ Max clock speed of APB2 is 84 MHz according to the Clock config file of STM32F4. So I understand that I was missing another prescaler after this and the maximum achievable rate is 42 MHz. Still it should be possible to acquire the data and finally, get the digital output that I am trying to obtain after the program. I understood the UART or the DAC wouldn't work anyway, but was looking for some other idea, like the DMA you suggested. Thanks for that. \$\endgroup\$ – SappyM Sep 20 '18 at 12:58
  • \$\begingroup\$ Max APB2 is 90 MHz, but you cant achieve it with master clock of 164 MHz. DMA is necessary to store data from ADC fast enough, but you cant operate continuously at that rate as you cant output from chip that fast. \$\endgroup\$ – Rokta Sep 20 '18 at 13:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.