If I'm using a NUCLEO-F401RE with ADC throughput rate greater than 2 MSPS and storing the value in an array/memory, will the UART baud rate affect transmission of the signals from memory? How are they related? The ADC resolution is 12 bit. The data format is 1 startbit,8 databits & 1 stopbit. I want a 200 kHz input signal sampled at 2 MSPS & transmitted through UART. Is it possible, if not why?


closed as unclear what you're asking by brhans, Dmitry Grigoryev, RoyC, Voltage Spike, Finbarr May 20 at 23:04

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • \$\begingroup\$ We need to know the data rate for which we need to know how big each sample is and the data transport format: no. of data bits, no. of stop bits, yes or no parity bit. \$\endgroup\$ – Oldfart May 16 at 7:10
  • 7
    \$\begingroup\$ If 2'000'000*(ADC width) is more than what your UART throughput is, then it won't work. \$\endgroup\$ – Humpawumpa May 16 at 7:14
  • 1
    \$\begingroup\$ Why would you sample a 200 kHz signal at 2 MS/s? That's oversampling by a factor of 5! Unless you have a clear mathematical reason to want oversampling, I'd strongly advise you to take a step back and think about your overall system design and what rate you need where. \$\endgroup\$ – Marcus Müller May 16 at 7:36
  • \$\begingroup\$ @Oldfart The ADC resolution is 12 bit. The data format is 1 startbit,8 databits &1 stopbit. \$\endgroup\$ – Archana Narayanan May 16 at 9:18
  • 3
    \$\begingroup\$ Aha! So, while the data rate might be 200 kHz (capitalization matters! What you write would be pronounce "kelvinhertz"), that means it has frequency components much higher. Check whether your anti-aliasing filter is sufficient. Anyways, I don't really understand how you think you can squeeze 2 Millions of continuous samples per second, which equates to 30 Million bits per second, through an UART with a maximum bit rate of less than 10 Million bits per second. What's not to understand about the impossibility of that? \$\endgroup\$ – Marcus Müller May 16 at 10:43

No way.

2 million samples of 12 bits (ADC resolution) each means 3 MBytes/second. One byte is transferred as 10 bits (8 bits data, 1 start bit, 1 stop bit), so you'd need 30 MBits/s transfer rate.

The STM32F401RE MCU on the board has a maximum APB2 clock frequency of 84 MHz. The maximal UART bitrate is 1/8 of the clock, that's 10.5 MBits/s.

  • \$\begingroup\$ Thanks! That clears a few things. But then its is unclear to me as to what is the role of a memory array here, say, a FIFO of size 12000[12 bit *1000]. When the values are sent from FIFO at the UART's maximal bit rate to PC, will all the data not be retrieved at its pace? \$\endgroup\$ – Archana Narayanan May 16 at 9:32
  • 4
    \$\begingroup\$ @ArchanaNarayanan: A FIFO requires that the out-speed matches or exceeds the in-speed. (That's true for LIFO's and other buffers as well). You can't ask how a non-working design works, only how it fails.That's what berendi explains here. \$\endgroup\$ – MSalters May 16 at 10:24
  • 2
    \$\begingroup\$ @ArchanaNarayanan the input rate is 2.86 times the output rate. In the time it takes to receive 1000 samples, only 350 samples are sent out. You can put a few milliseconds worth of data in the puffer, but then it would be full, and you start losing samples, unless you have a way to stop receiving samples for a while. \$\endgroup\$ – berendi May 16 at 12:09
  • 4
    \$\begingroup\$ @ArchanaNarayanan It can be quite hard or impossible to exactly match input and output frequency, jitter also plays a role, and, as long as the maximum output rate is bigger than the input rate, a (small) FIFO (in the extreme just holding one value) is often used to allow for compensation of jitter/fluctuations. \$\endgroup\$ – JimmyB May 16 at 12:40

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