Electronics > Microcontrollers

Detect signal ringing

(1/4) > >>

Leopoldo:
Hello everyone,
I'm starting a project where a microcontroller will use its ADC to record an incoming signal, coming from a transmission line under a serial communication stimulus, and analyze it in order to measure rough "transmission quality" parameters like:
1. average/peak voltage for high and low communication symbols
2. spikes, other form of noise
3. rise/fall time
4. ringing (impedance mismatch)

I'm only at the "concept" phase; I have a couple of ideas for the first 3 metrics, but I'm having trouble figuring out a valid method for detecting the last one, ringing.
The issue is that I'd like to detect the phenomenon with a decent variability in 3 parameters: peak amplitude (i.e. overshoot), oscillation frequency and oscillation decay (I'm reducing the complexity of the problem to a 2nd order undampened system response to a step stimulus). Basically, as a human would detect ringing if it had an oscilloscope and good eyeballs.

Do you have any idea how this could be performed accurately? (Possibily, also efficiently - i.e., maybe avoid repeated convolutions with pre-defined waveforms or FFT).

Thanks!

P.S.:
I'm attaching a zip folder with some Octave (Matlab compatible) scripts containing test waveforms, if you want to try ideas.

ajb:
This sounds like an interesting project. What sort of ringing frequency are you expecting?  And what sort of serial communication/data rate is involved?  If you could post plots of your test waveforms with at least the time axis labeled that would be more helpful than the raw scripts.

I think the highest sample rate I've seen on an MCU ADC is a few Msps -- and that was with three separate ADCs in interleaved mode -- so measuring frequency from the ADC could be challenging, although reducing the resolution might get you there.  A faster external ADC is of course an option, but at some point the data rate becomes a challenge, or at least will require a parallel interface.  Using a fast edge/peak detector and a high frequency timer might be more suitable -- timers that can operate at ~100MHz or so aren't uncommon on modern MCUs, and you can probably find a couple of ~200MHz or faster options.  Likewise, peak/amplitude measurements probably benefit from some external analog help.  Since this is a transmission line, interfacing to it without causing more SI issues by altering the impedance will require some consideration.  ADCs requires a low impedance source to operate at maximum sample rate, since sampling time is directly proportional to input impedance, so at a minimum you will need an external buffer anyway.  But the specifics will really depend on the frequencies involved.

ajb:
Another thought: cheap DAC + fast comparator + high frequency timer could be a cheap and efficient way to get magnitude, frequency, and decay measurements, albeit over multiple events.  Sweeping the set point of the comparator and looking for events gets you magnitude, timing them gets you the frequency, and counting them per trigger event gets you the decay time.  A lot of MCUs have all three of these things built-in these days, so would need minimal external parts for one or two measurement channels.  It would be easy to expand with external comparators and DACs (or multiplexing sample-and-holds or PWM DACs with enough filtering) up to as many high frequency timer channels you have available -- having four channels would get you a lot more information over fewer cycles, and a better picture of each individual event rather than the average of many.  (Too many channels and at some point you've just done the ADC method the hard way  :scared:) 

But that might not be the solution you're looking for, if for example doing some DSP is part of the goal of the project.

Leopoldo:
Thanks ajb for the reply!
So:


--- Quote from: ajb on January 12, 2025, 11:48:21 pm ---What sort of ringing frequency are you expecting?  And what sort of serial communication/data rate is involved?  If you could post plots of your test waveforms with at least the time axis labeled that would be more helpful than the raw scripts.
--- End quote ---
No idea about the expected ringing. This is an experiment for my daytime job, where we don't have oscilloscopes available yet face constantly communication problems - that's the reason for this project.
The main protocol that I'm interested in is RS485 running at 38.4 Kbaud, so a symbol period of about 26us.
Just to be clear, I really wanted to experiment with the Pi Pico 2040 (though only if the IDE lets me get the full potential of the uC). I read in a forum that someone overclocked it to get the ADC running at 2.5Msps; for me, just having it run at 1Msps (2 channels at 500ksps, for RS485) would be already ok (so an oversampling with a factor of >10). What do you think? My requirements are quite low, even though it could become a more "professional" instrument; I'm really more focused on basic problem diagnosis.
I don't have a recording of the signals as of right now, but I will capture some in the next few weeks.


--- Quote from: ajb on January 12, 2025, 11:48:21 pm ---Using a fast edge/peak detector and a high frequency timer might be more suitable
--- End quote ---
Just to be clear, with edge detectors you mean the ones already present in interrupt-based digital inputs of microcontroller?


--- Quote from: ajb on January 12, 2025, 11:48:21 pm ---Likewise, peak/amplitude measurements probably benefit from some external analog help
--- End quote ---
Yes, I thought about a peak detector, though as you said buffering would be mandatory in order not to load the driver and thus change the behaviour of the DUT. So I might consider dealing with this also with the ADC directly.




--- Quote from: ajb on January 13, 2025, 02:33:26 am ---Another thought: cheap DAC + fast comparator + high frequency timer could be a cheap and efficient way to get magnitude, frequency, and decay measurements, albeit over multiple events.
--- End quote ---
That's a very clever solution, I didn't think about it! Though yes, this requires a somewhat "periodic" signal, whereas my target protocol only has bursts of 8-12 symbols...
Come to think of it...  :o could an "overall quality" parameter be extracted via an analog circuit?
Let's establish - for example - that my ideal signal has 0% overshoot and instant decay, and oscillation frequency not relevant. Anything over these value gets a proportionally lower score.
Is there an analog circuit that would accept any share-ish wave, and ignore every other parameter except these ones? So as to characterize the behaviour in hardware.
I'm thinking how to isolate the problematic signal part: off the top of my head, gating the incoming signal with a hardware (or microcontroller) edge-detector (in order to remove any signal transition which is not the ringing part), then removing the average settling voltage level offset (AC coupling might not work), and finally using an envelope circuit and some sort of integrator, calculate the area of the envelope...! The higher the area, the worst the score.
Yes, this would mean a completely different architecture, but I'm questioning what would be the most reliable and accurate direction   ::)


--- Quote ---Please excuse the crudity of my drawing... no time to build it to scale and paint it
--- End quote ---
  ;)

Thanks!

Leopoldo:
Another way to do it in hardware, which may scale better with other wave behaviour, could be to implement your solution with a circuit :)
I.e., having an array of basic comparators, say 8, and a resistor ladder. The output could be evaluated by integrating the detected peaks to "count the crossings" and infer decay time. Then reading the values with the ADC.
One problem with this is still setting the bias for the comparators, i.e. subtract the settling voltage level (not knowing it).
The purpose of doing it in hardware would be mainly to gain speed, i.e. not having issues with sampling rates.
What do you think?  :D

Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod