Tool/software: Code Composer Studio
Hello,
So I've got the MSP432's ADC Sampling a 20 kHz Sine Wave, but I always get a distortion for the first few samples (see figure below). I'm converting SampleBufferOne to MicroVolts and graphing it. (Sampling at 1 MSPS). I'm also curious as to what I need to do to sample this waveform at 2 MSPS. It somehow maxes out at 1 MSPS no matter what I set the sampling rate to.
Here's the code I have set up:
/* Call ADC driver init function */
ADCBuf_init();
ADCBuf_Params_init(&adcBufParams);
adcBufParams.recurrenceMode = ADCBuf_RECURRENCE_MODE_ONE_SHOT;
adcBufParams.returnMode = ADCBuf_RETURN_MODE_BLOCKING;
adcBufParams.samplingFrequency = 1000000;
adcBufParams.blockingTimeout = 125000;
adcBuf = ADCBuf_open(Board_ADCBUF0, &adcBufParams);
if (adcBuf == NULL){
/* ADCBuf failed to open. */
while(1);
}
/* Configure the conversion struct */
oneshotConversion.arg = NULL;
oneshotConversion.adcChannel = Board_ADCBUF0CHANNEL0;
oneshotConversion.sampleBuffer = sampleBufferOne;
oneshotConversion.sampleBufferTwo = sampleBufferTwo;
oneshotConversion.samplesRequestedCount = ADCSAMPLESIZE;
/* Start converting. */
if (ADCBuf_convert(adcBuf, &oneshotConversion, 1) !=
ADCBuf_STATUS_SUCCESS) {
/* Did not start conversion process correctly. */
while(1);
}
// Normalize and convert to uVolts
/* Adjust raw ADC values and convert them to microvolts */
ADCBuf_adjustRawValues(adcBuf, oneshotConversion.sampleBuffer, ADCSAMPLESIZE,
Board_ADCBUF0CHANNEL0);
ADCBuf_convertAdjustedToMicroVolts(adcBuf, Board_ADCBUF0CHANNEL0,
oneshotConversion.sampleBuffer, microVoltBuffer, ADCSAMPLESIZE);
Here's my Signal: