Measuring the ADC amplitude with K32L2B

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Measuring the ADC amplitude with K32L2B

725 Views
ericsmith2
Contributor I

I'm working with the FRDM-K32L2B3 kit and I'm trying to measure the amplitude/crest of a wave that lasts approximately 1μ. There is up to 2k samples per second. What's the best strategy here?

The goal is to trigger a capture when the signal hits a threshold then sample for 1μ or until the signal begins to decrease when it hits the peak. The highest value is what I'm after.

I've tried using the CMP to trigger an ADC conversion and interrupt but the values seem all over the place. I've tried modifying the adc16_continuous_dma example but it doesn't seem to capture the full wave, just one value.

The ADC operating conditions table lists a max conversion rate of 1200 ksps so does this mean I'm limited to one sample every 0.8μ? If this is the case I might not be able to sample the first half of the wave to catch the peak.

Does anyone have some pointers? Much thanks!

Here are the options I've used for adc16_continuous_dma example:

    adcUserConfig.clockDivider = kADC16_ClockDivider1;
    adcUserConfig.resolution = kADC16_ResolutionSE10Bit;
    adcUserConfig.clockSource = kADC16_ClockSourceAlt0;
    adcUserConfig.enableContinuousConversion = true;
    adcUserConfig.enableHighSpeed = true;

Edit: After closer examination it turns out that the ADC values on the CMP trigger do correlate with the peaks somewhat. Thanks for the words of advice.

2 Replies

640 Views
myke_predko
Senior Contributor III

Hi Eric,

I think we need more information to give you some practical suggestions that you can look into.  The short answer is I don't think you can get anything approaching an accurate measurement with just the K32L2B.

Can you describe the signal you're trying to measure - What is the theoretical maximum value and what is the slope of the rise/fall (is it consistent)?  Is there a voltage level above the base noise level the "wave" always exceeds (use as a comparator trigger level)? 

If you have a reasonably long rise & fall times (on the order of 5us) that is fairly linear and there is a good trigger level, you may be take a number of samples on the ADC (with DMA) triggered from a comparator that you can approximate as two linear equations (rising and falling) and use the intersection as the approximate maximum value.  

Other than that, you're going to have to look at external flash ADCs (which are pricey and will probably be difficult to interface to the K32L2B as it doesn't have an SPI or other high speed IO port).  

Sorry, hopefully somebody else will have a better answer.  

myke

640 Views
nxf56274
NXP Employee
NXP Employee

Hi,

Try to generate a 1Mhz sine wave. Use your configuration to test. Is it normal? You should modify the dma setting. The example only can transimit 16 data. 

 

Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------