0
votes

I have interfaced one ADC with microcontroller and reading data through UART.The UART is set at 115200 bps.

I wanted to calculate the maximum sampling rate I can achieve with the UART. The ADC is 12 bits so maximum count is 4 digits (upto 4095). Each digit will occupy a character for UART.

UART bit rate: 115200 bps

UART Character rate : 11520 char/sec ( 10 bit for 1 char)

No of chars for each sample : 4 char/sample

Maximum sampling rate: 11520/4 = 2880 samples/s= 2.8KSps

Is my calculation correct? I wanted to find if UART acts as a bottleneck for high speed ADC transfer.

1
So you plan on saturating the serial link with characters. What's your plan for determining which 4 characters belong to each sample? E.G. see stackoverflow.com/questions/16177947/…sawdust
This is just my guess. I can see the ADC counts in 4 digits on serial terminal, so I have 4 characters for reading each sample.Falcon98

1 Answers

0
votes

ADC is 12 bits long. So, why do we need to consider it in terms of character? ADC's 12 bits corresponds to [0, 4095] in decimal. Considering each digit as a character, you are assuming you need to transmit 4 characters, each character being 10 bits, you'd be transmitting 40 bits. But ADC data is simply 12 bits in binary format. I consider binary->decimal->character conversion is over-complicating, unless you have a strong reason to do so. ADC's 12 bits can be simply transmitted over UART.

https://www.circuitbasics.com/basics-uart-communication/

UART transmits 8 bits at once in serial. It includes 1 start bit, 1 parity bit (optional) and minimum 1 stop bit. So, it transmits 8+1+1+1 = 11 bits at once for transferring first 8 bits of ADC data. It then requires the next 4 bits of ADC data to be transmitted, i.e. 8+1+1+1 = 11 bits (assuming it doesnt transfer just 4 bits) for transferring next 4 bits of ADC data. So overall, it requires 11+11 = 22 bits of transfer. Also UART IC has parallel input pins to feed in the data to be transmitted. This requires one clock, i.e. one clock for feeding in the first 8 bits of ADC data and another clock for feeding in the next 4 bits of ADC data. So in total, we require 24 clocks to feed in the data from ADC to UART IC, to transmit in two frames, i.e. one ADC data sample. UART Baud rate is 115200 bps. Sample rate = 115200bps / 24 = 4800sps = 4.8KSPS Maximum ADC sampling rate can be 4.8KSPS.