Part Number:MSP432P401R
Tool/software: Code Composer Studio
Hello,
I'm using the examples/demos from Resource explorer:
boostxl_edumkii_microphonefft_msp432p401r and msp-exp432p401r_grlib_example
I'm integrating a touchscreen LCD and creating a menu to go to different display pages. One of the pages being an FFT of an audio signal playing with my project. On the FFT screen I would like to have an "X" in the top right to touch and get out of the FFT display screen to go back to the main menu. The problem I'm running into is that the touchscreen and FFT have two separate ADC configurations. Shown below are the two snippets of the ADC configurations:
FFT:
MAP_ADC14_enableModule(); // Enables ADC Block
MAP_ADC14_initModule(ADC_CLOCKSOURCE_MCLK, ADC_PREDIVIDER_1, ADC_DIVIDER_1, 0);
// MCLK - Clock Source for CPU
// Predivider_1 - Divides the given clock source before feeding it into the main clock divider. (Default)
// Divider_1 - Divides the pre-divided clock source (Default)
// 0 - ADC_NOROUTE, no InternalChannelMask
MAP_ADC14_setResolution(ADC_14BIT);
MAP_ADC14_setSampleHoldTrigger(ADC_TRIGGER_SOURCE1, false);
// Trigger Source 1 - Sets the source for the trigger of the ADC module.
// False - Trigger signal on rising edge
MAP_ADC14_setSampleHoldTime(ADC_PULSE_WIDTH_4, ADC_PULSE_WIDTH_4);
MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P4, GPIO_PIN3, // ADC Port 4 Pin 3 ---- A10
GPIO_TERTIARY_MODULE_FUNCTION);
// Configuring ADC Memory
MAP_ADC14_configureSingleSampleMode(ADC_MEM9, true); // ADC_MEM0 - Configures the ADC module to use a single ADC memory location for sampling/conversion.
// True - cause the ADC module to resume sampling once the initial sample/conversion set is executed.
// ****************************************************************************** //
MAP_ADC14_configureConversionMemory(ADC_MEM9, ADC_VREFPOS_AVCC_VREFNEG_VSS,
ADC_INPUT_A10, false);
// ADC_MEM0 - individual ADC memory location to configure
// Vref = 3.3 to GND
// A10 - channel to be used for ADC sampling
// False - Differential mode off
// ****************************************************************************** //
// Set ADC result format to signed binary
MAP_ADC14_setResultFormat(ADC_SIGNED_BINARY);
MAP_ADC14_enableConversion();
touch_P401R.c :
MAP_ADC14_initModule(ADC_CLOCKSOURCE_MCLK, ADC_PREDIVIDER_1, // ADCOSC
ADC_DIVIDER_1, 0);
MAP_ADC14_setResolution(ADC_14BIT);
MAP_ADC14_enableSampleTimer(ADC_MANUAL_ITERATION);
MAP_ADC14_setSampleHoldTime(ADC_PULSE_WIDTH_96, ADC_PULSE_WIDTH_96);
MAP_ADC14_setSampleHoldTrigger(ADC_TRIGGER_ADCSC, false);
MAP_ADC14_enableModule();
/* Configure Y+ input to memory buffer 0. */
MAP_ADC14_configureConversionMemory(TOUCH_Y_PLUS_MEMORY,
ADC_VREFPOS_AVCC_VREFNEG_VSS,
TOUCH_Y_PLUS_INPUT,
false);
/* Configure X+ input to memory buffer 1. */
MAP_ADC14_configureConversionMemory(TOUCH_X_PLUS_MEMORY,
ADC_VREFPOS_AVCC_VREFNEG_VSS,
TOUCH_X_PLUS_INPUT,
false);
for(i = 0; i < TOUCH_OVERSAMPLE; i++)
{
MAP_ADC14_toggleConversionTrigger();
status = MAP_ADC14_getInterruptStatus();
while(status != TOUCH_X_PLUS_IFG)
{
status = MAP_ADC14_getInterruptStatus();
}
aDCtemp += ADC14->MEM[1];
}
aDCtemp = (aDCtemp >> TOUCH_AVERAGE_DIVISOR);
The main difference I've noticed in the ADC registers is that the FFT uses
Single Channel - Repeat Conversion (ADC14CONSEQ = 10)
SAMPCON signal is sourced from the sample-input signal (ADC14SHP = 0).
Touchscreen ADC uses
Single Channel - Single Conversion(ADC14CONSEQ = 00)
SAMPCON signal is sourced from the sampling timer (ADC14SHP = 1) with a pulse width of 96.
I know there is an analog input mux that selects the channel for conversion, so is there a way to use both of these ADC configurations and select between the channels to run both at the same time or sequentially? Would multi-sequence mode be a possible solution?
Thank you!