2023-08-30 06:47 AM
The objective is to visualize the response of a device to a series of pulses of different durations.
The number of pulses, their duration and their frequency are given as an indication and can be adapted.
I want to acquire several identical pulses to increase the sensitivity of the analysis by adding or averaging the responses received. Similarly I want to add the acquisition several times to increase the sensitivity even more.
This sum of 16-bit values would then be compared to the previous sum µs by µs (by subtraction or division) to see if any variation occurred in the response.
Ideally, a "limit" variation value could be calculated or measured experimentally from which a change of state would be made on one of the pins of the stm32.
Another solution I considered would be to separate each series of pulses based on signal duration and analyze the signal for each pulse length separately (A). Or make a series of pulses with only one pulse per given duration and add the loops so you can compare the signal accurately (B).
Thanks for your help
Alban
2023-08-30 07:17 AM
Timer capture compare channels do this well.
2023-08-30 07:43 AM
Definitely doable, probably can't process all ADC data in realtime, but you could post-process. Synchronizing PWM pulses to ADC input will be tricky, but again is quite doable.
Might want to run a sanity check on the accuracy of ADC values you expect. At 1 MSps, don't expect the full range.
2023-08-30 08:46 AM
Thank you for your rapid answer raptorhal2 and TDK.
"Synchronizing PWM pulses to ADC input will be tricky, but again is quite doable" I assume a little delay couldn't be a problem if less than 5 µsec.
If I understand well "Timer capture compare channels" could help me to start ADC acquisition after pulse end and stop it when a new pulse is starting.
So what do you thing is the best solution a sequence with several repetitions of each pulse length (first diagram) or specific sequences for each pulse length which will be separated by an interruption (diagram A).
Wouldn't data analysis also be simpler by separating the pulse series by length?
"You may want to perform a health check to see if the ADC values are correct as you expect. At 1 MSps, don't expect the full range"
I don't understand what this check is for, is it to be able to do the second part of the calculations? How often do you think I can make the comparison?
Regarding the analysis of the data measured by the ADC for you, what would be the simplest and the least source of error, adding the values or making an average? (in order to increase sensitivity)
To analyze the accumulations of data between them, a division or subtraction?
Can you confirm that it is possible to independently compare the accumulations of values obtained for each pulse length?
Not having much experience, I think that your help can be valuable in making decisions allowing me to simplify the design as much as possible in order to save programming time.
Thanx again for your time
2023-08-30 09:01 AM
Please clarify - are you analyzing signal duration and timing or amplitude? I assumed duration, TDK provided an amplitude also answer.
2023-08-30 09:39 AM
I thinking about amplitude like an oscilloscope
2023-08-30 11:05 AM - edited 2023-08-30 11:05 AM
It sounds like you need to decide what exactly you want to measure and how to assess the results. It's your application, you have free reign to choose whatever measurement or process works. We have limited insight into what you're trying to find out.
It is possible to make the pulses and ADC measurements you want to some amount of accuracy. Whether it is simpler or better or easier one way over the other is really subjective. You're the one who will be coding this, what will be best for you?