# How to create a control loop using a 100Msps digital signal as input

I would like to know what type of microcontroller should I buy for this control loop task.

Scenario:

I have a digital signal coming from the following equipment:

$\boxed{\text{Ultrasonic}\\\text{transducer}} \longrightarrow\boxed{\text{ADC}}\longrightarrow\boxed{\text{DSP Board}\\\text{(some high and low pass filter)}}\longrightarrow\boxed{\text{USB 2.0}\\\text{(40MBPS) output}}$

I want to be able to use this digital signal coming trough USB as input in my controller and calculate the TOF (time-of-flight) of the echo and react with my controller every $1\textrm{ ms}$ or less using a PID control law.

• How should I deal with this digital signal output in my microcontroller, to be able to detect the echo in generate a reaction in less than $1\textrm{ ms}$?

• Any suggestion of microcontroller that I could use for this task?

• And how can I deal with such high speed input?
• where in your system do you have the 100MS/s you claim in the title? – Marcus Müller Jun 19 '16 at 20:40
• I highly doubt you'd benefit much from such an extraordinarily high sample rate for ultrasound, by the way. – Marcus Müller Jun 19 '16 at 20:40
• and 1ms is enormously long compared to that sampling rate – Marcus Müller Jun 19 '16 at 20:42
• what's the sample bit depth? – Marcus Müller Jun 19 '16 at 20:43
• If you have a bit of cash to spend: ni.com/rseries – Arnfinn Jun 20 '16 at 13:01

No Microprocessor is able to deal with such extreme rates as 100MS/s. That is clearly the domain of custom ICs and FPGAs, bringing the data to a very capable CPU, not something small and embedded.

Regarding USB:

I don't know your sampling bit width, but 40MB/s is not very much if you need to transport 100MS/s – you get 12bit per sample, in the ideal, zero-overhead case (which doesn't exist).

As a matter of fact, I know a series of devices very well that can deliver 100MS/s and more to a PC – these work through expensive interface such as a proprietary external PCIexpress interface, or better even through 10Gbit Ethernet (which you'd normally only find in data center / ISP equipment).

With a single 100MS/s stream you can easily flatten a single CPU core of a pretty capable x86_64 computer – really, that MUCH MUCH more data than what "microcontrollers" handle.

This might really be a case of insufficiently discussed system design – Nyquist and my understanding of the term "Ultrasound" say that you'd never need more than twice the highest signal frequency as sampling rate. I wouldn't expect ultrasound sonar to have frequencies higher than maybe 4 MHz, but I might be wrong.

• The overhead on any bus like PCIe, USB, and Ethernet is way too large to allow for real-time closed-loop control in the MHz range. So even if the streaming rate and processing rate is high enough, the time needed to read and write is a severe limitation. The fastest I have ever been able to turn-around on a PCIe bus is 150 kHz. An FPGA is definitely the way to go. – Arnfinn Jun 19 '16 at 22:08
• @Arnfinn couldn't agree more. However, for the 1ms latency OP seems (?) to ask about, going through a PC is feasible. – Marcus Müller Jun 20 '16 at 9:59
• Sounds reasonable to me -- 100 MS/s seems unnecessarily high. If the sampling time for control law is 1 ms, a PC would do the job. – Arnfinn Jun 20 '16 at 13:00
• @Arnfinn since you're already "advertising" NI equipment in your comment to OP's question: I work for Ettus Research, a daughter of NI; the USRP series generally has a ADC/DAC<->FPGA<->computer peripheral bus architecture. There's USB2, USB3, Gigabit Ethernet, 10Gigabit Ethernet/PCIe and devices with a direct link to an embedded CPU, and yes, you can do high rates with that to a PC. – Marcus Müller Jun 21 '16 at 18:42