Other Parts Discussed in Thread: ENERGIA, MSP432WARE
Good afternoon,
We have been testing some custom built MSP432 prototype boards (ultra-low power sensor development) along with the both REV B / REV C launchpads and have encountered 2 issues with the ADCs.
1.
Regarding current consumed by the ADCs, in the MSP432 datasheet (page 64) (at 3.3V, 24MHz, 1Msps, single ended mode_) we should be consuming on the order of 640uA MAX. We ran the code attached below (code is slightly modified version of "adc14_single_conversion_repeat" from the most recent MSP432 driver library v3_21_00_05 and most recent system files loaded) on a brand new REV C launchpad. We turned the ADC module on/off using an interrupt and found that we are consuming ~1.8mA = (18mW-12mW)/3.3V (energia screenshot attached and confirmed with multimeter) However bumping up the clock to 48Mhz, this same code consumes a whopping ~3.6mA = (26mW-14mW)/3.3V (energia screenshot attached). On our custom board, we are seeing even a larger current consumption, around 4.85mA, with the ADC configured identically.
Is this how the ADC should be functioning?
In another TI document posted on the MSP432 main site "Bringing High Performance to low-power Applications" (page 4), it states that at full speed the ADC draws 375uA..
2.
Our other issue deals with the ADC example code. We currently have the most recent MSP432 driver library (v3_21_00_05) running on the most recent CCS Version: 6.1.3.00034 , but the ADC example code does not function correctly. Judging by the current consumed, the ADC module itself is turning on and off, but we are not registering any values being read by the ADCs on the launchpad (did a memory check to confirm values were not changing) Strangely enough the REV B micros work perfectly but as soon as we switch over to REV C micros, we encounter a significant amount of issues with the ADCs using the same exact code. Any suggestions? There may be some files linked incorrectly that are causing this issue or something wasn't updated accordingly.. Note: I loaded the MSP432 example file from the TI Resource Explorer and then created a new project which has the newest "startup_msp432p401r_ccs.c" and "system_msp432p401r.c" and copied the example into this new project.
Your help is much appreciated.
Best,
Rob
/*******************************************************************************
* MSP432 ADC14 - Single Channel Sample Repeat
*
* Description: This code example will demonstrate the basic functionality of
* of the DriverLib ADC APIs with sampling a single channel repeatedly. Each
* time the ADC conversion occurs, the result is stored into a local variable.
* The sample timer is used to continuously grab a new value from the ADC
* module using a manual iteration that is performed in the ADC ISR. A
* normalized ADC value with respect to the 3.3v Avcc is also calculated using
* the FPU.
*
* MSP432P401
* ------------------
* /|\| |
* | | |
* --|RST P5.5 |<--- A0 (Analog Input)
* | |
* | |
* | |
* | |
* | |
*
* Author: Timothy Logan
******************************************************************************/
/* DriverLib Includes */
#include "driverlib.h"
/* Standard Includes */
#include <stdint.h>
#include <stdbool.h>
/* Statics */
volatile uint16_t curADCResult;
volatile float normalizedADCRes;
volatile uint16_t *previous_position = &curADCResult;
int i = 0;
int main(void)
{
/* Halting the Watchdog */
MAP_WDT_A_holdTimer();
/* Initializing Variables */
curADCResult = 0;
/* Setting Flash wait state */
PCM_setCoreVoltageLevel(PCM_VCORE1);
MAP_FlashCtl_setWaitState(FLASH_BANK0, 2);
MAP_FlashCtl_setWaitState(FLASH_BANK1, 2);
/* Initialize MCLK to run from DCO with divider = 1*/
CS_initClockSignal(CS_MCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1);
/* 48MHz is a standard centered frequency */
MAP_CS_enableDCOExternalResistor();
MAP_CS_setDCOCenteredFrequency(CS_DCO_FREQUENCY_24);
// /* Enabling the FPU for floating point operation */
MAP_FPU_enableModule();
MAP_FPU_enableLazyStacking();
/* Initializing ADC (MCLK/1/4) */
ADC14_enableModule();
ADC14_initModule(ADC_CLOCKSOURCE_MCLK, ADC_PREDIVIDER_1, ADC_DIVIDER_4,
0);
/* Configuring GPIOs (5.5 A0) */
GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P5, GPIO_PIN5,
GPIO_TERTIARY_MODULE_FUNCTION);
/* Configuring ADC Memory */
ADC14_configureSingleSampleMode(ADC_MEM0, false);
ADC14_configureConversionMemory(ADC_MEM0, ADC_VREFPOS_AVCC_VREFNEG_VSS,ADC_INPUT_A0, false);
ADC14_setPowerMode(ADC_UNRESTRICTED_POWER_MODE);
/* Enabling interrupts */
ADC14_enableInterrupt(ADC_INT0);
/* Configuring SysTick to trigger at 24000000 (MCLK is 48MHz so this will
* make it toggle every 0.5s) */
MAP_SysTick_enableModule();
MAP_SysTick_setPeriod(12000000);
MAP_SysTick_enableInterrupt();
/* Enabling MASTER interrupts */
MAP_Interrupt_enableInterrupt(INT_ADC14);
MAP_Interrupt_enableInterrupt(FAULT_SYSTICK);
MAP_Interrupt_enableMaster();
/* Configuring Sample Timer */
ADC14_enableSampleTimer(ADC_MANUAL_ITERATION);
/* Enabling/Toggling Conversion */
ADC14_enableConversion();
ADC14_toggleConversionTrigger();
while (1)
{
MAP_PCM_gotoLPM0();
}
}
/* ADC Interrupt Handler. This handler is called whenever there is a conversion
* that is finished for ADC_MEM0.
*/
void ADC14_IRQHandler(void)
{
uint64_t status = ADC14_getEnabledInterruptStatus();
ADC14_clearInterruptFlag(status);
if (ADC_INT0 & status)
{
*previous_position = ADC14_getResult(ADC_MEM0);
normalizedADCRes = (curADCResult * 3.3) / 16384;
ADC14_toggleConversionTrigger();
}
}
void SysTick_Handler(void)
{
if (i<8){
ADC14_enableModule();
ADC14_enableInterrupt(ADC_INT0);
MAP_Interrupt_enableInterrupt(INT_ADC14);
i++;
}
else if (i>=8 && i<16){
MAP_Interrupt_disableInterrupt(INT_ADC14);
ADC14_disableInterrupt(ADC_INT0);
ADC14_disableModule();
i++;
}
else {
i=0;
}
}
24 MHz clock running above
48MHz clock running above