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?
Asked
Active
Viewed 988 times
4
-
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. – Oldfart May 16 '19 at 07:10
-
7If 2'000'000*(ADC width) is more than what your UART throughput is, then it won't work. – po.pe May 16 '19 at 07:14
-
1*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. – Marcus Müller May 16 '19 at 07:36
-
@Oldfart The ADC resolution is 12 bit. The data format is 1 startbit,8 databits &1 stopbit. – Archana Narayanan May 16 '19 at 09:18
-
@Marcus, the datarate of my CCD signal is around 200-250KHz. I configured the ADC on NucleoF401RE with HAL library and DMA in Keil using STMCubeMX(Prescaler of 4 and 12 bit Continuous Conversion), however it does not work. The digitised data from ADC through UART is always distorted. I tried Arduino IDE and I observed using their serial plotter that the input freq range increased from 100Hz to 400Hz with baud rate. Hence the question. I'm quite unsure where the problem lies. – Archana Narayanan May 16 '19 at 09:26
-
3Aha! 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? – Marcus Müller May 16 '19 at 10:43
1 Answers
14
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.

followed Monica to Codidact
- 5,312
- 1
- 13
- 28
-
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? – Archana Narayanan May 16 '19 at 09:32
-
4@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. – MSalters May 16 '19 at 10:24
-
2@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. – followed Monica to Codidact May 16 '19 at 12:09
-
4@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. – JimmyB May 16 '19 at 12:40