I am just not quite understanding how to get the ADC14 to sample at its top speed. I would like to get something in the neighborhood of 1MSPS, but I ma having a hard time getting even 1/10 of the way there.
The program that I am using is based on the adc14_single_conversion_repeat.c example. I added in a few lines to echo ACLK and MCLK to P4.2 and P4.3 and a line of code to flip the LED bit on each conversion.
The code is below, if anyone is willing to look. Hopefully there is an amusing error in there. I have tried various clocks for the MAP_ADC14_initModule() call etc., but I get the same results.
Thanks,
mike hogan
/* DriverLib Includes */ #include "driverlib.h" /* Standard Includes */ #include <stdint.h> #include <stdbool.h> /* Statics */ static volatile uint16_t curADCResult; static volatile float normalizedADCRes; int main(void) { /* Halting the Watchdog */ MAP_WDT_A_holdTimer(); // Set P1.0 to output direction GPIO_setAsOutputPin(GPIO_PORT_P1, GPIO_PIN0 ); P4DIR |= BIT2 | BIT3; P4SEL0 |= BIT2 | BIT3; // Output ACLK & MCLK P4SEL1 &= ~(BIT2 | BIT3); /* Initializing Variables */ curADCResult = 0; /* Setting DCO to 48MHz */ MAP_PCM_setPowerState(PCM_AM_LDO_VCORE1); MAP_CS_setDCOCenteredFrequency(CS_DCO_FREQUENCY_48); /* Enabling the FPU for floating point operation */ MAP_FPU_enableModule(); MAP_FPU_enableLazyStacking(); /* Initializing ADC (MCLK/1/1) */ MAP_ADC14_enableModule(); MAP_ADC14_initModule(ADC_CLOCKSOURCE_MCLK, ADC_PREDIVIDER_1, ADC_DIVIDER_1, 0); /* Configuring GPIOs (5.5 A0) */ MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P5, GPIO_PIN5, GPIO_TERTIARY_MODULE_FUNCTION); /* Configuring ADC Memory */ MAP_ADC14_configureSingleSampleMode(ADC_MEM0, true); MAP_ADC14_configureConversionMemory(ADC_MEM0, ADC_VREFPOS_AVCC_VREFNEG_VSS, ADC_INPUT_A0, false); /* Configuring Sample Timer */ MAP_ADC14_enableSampleTimer(ADC_AUTOMATIC_ITERATION); /* Enabling/Toggling Conversion */ MAP_ADC14_enableConversion(); MAP_ADC14_toggleConversionTrigger(); /* Enabling interrupts */ MAP_ADC14_enableInterrupt(ADC_INT0); MAP_Interrupt_enableInterrupt(INT_ADC14); MAP_Interrupt_enableMaster(); while (1) { MAP_PCM_gotoLPM0(); } } /* ADC Interrupt Handler. This handler is called whenever there is a conversion * that is finished for ADC_MEM0. */ void adc_isr(void) { uint64_t status = MAP_ADC14_getEnabledInterruptStatus(); MAP_ADC14_clearInterruptFlag(status); if (ADC_INT0 & status) { curADCResult = MAP_ADC14_getResult(ADC_MEM0); normalizedADCRes = (curADCResult * 3.3) / 16384; // MAP_ADC14_toggleConversionTrigger(); // Toggle P1.0 output for simple measurement of conversion speed GPIO_toggleOutputOnPin( GPIO_PORT_P1, PIO_PIN0); } }