Part Number: MSP432P401R
Tool/software: Code Composer Studio
Hi,
I´m having some issues developing a low power application with MSP432 Launchpad. The idea is to keep the micro under LPM3, wake it up every minute to power on some sensor, delay with systick, measure, power off sensors and finally go back to sleep. It´s not much of a thing and got it up working nicely.
While I´m using CCS8 debug mode everything works fine. But then when I reboot my launchpad and try to measure power consumption with EnergyTrace things start to fail. Sensor power pins never go low again.
I´ve changed a little bit my code so instead of using sensors now, I´m just waking up from LPM3 every minute, turn on a led on pin 5.2, delay with sysTick and powering off the led. The led only turns off while using debug mode... I´ve tried using both MAP_GPIO_setOutputLowOnPin and P5OUT ^= 0x04; I´m completly lost at this point.
void main(void) { // ULP MODE WDT_A->CTL = WDT_A_CTL_PW | WDT_A_CTL_HOLD; // stop watchdog timer PADIR = 0xFFFF; PBDIR = 0xFFFF; PCDIR = 0xFFFF; PDDIR = 0xFFFF; PEDIR = 0xFFFF; PJDIR = 0xFFFF; PAOUT = 0; PBOUT = 0; PCOUT = 0; PDOUT = 0; PEOUT = 0; PJOUT = 0; MAP_SysCtl_enableSRAMBankRetention(SYSCTL_SRAM_BANK1); // Downgrade Frequency to 12 MHz CS_setDCOCenteredFrequency(CS_DCO_FREQUENCY_12); /* el modo ULP pone todos los pines a 0. Eso hace que los canales I2C consuman. Hay que crear funciones para los sensores que activen y desactiven estos puertos... */ ADS1220_init(); // debug int epoch = 1552733990; TIME_startRTC(epoch); /* bucle infinito. Mantiene el micro en estado de ultra bajo consumo */ while (1) { MAP_Interrupt_enableSleepOnIsrExit(); MAP_Interrupt_enableMaster(); __enable_interrupt(); __low_power_mode_3(); } } void activateSystick(int delay) { // Configuring SysTick to trigger at 6.000.000 is 1 second MAP_SysTick_enableModule(); MAP_SysTick_setPeriod(delay); MAP_Interrupt_enableSleepOnIsrExit(); MAP_SysTick_enableInterrupt(); } void activate_sensors(void) { GPIO_setOutputHighOnPin(ADS1220_POWER_PORT, ADS1220_POWER_PIN); // pin 5.2 //ADS1220_beginPTR(); stateMeasure = true; activateSystick(1500000); } void shutdown_sensors(void) { //ADS1220_shutDown(); P5OUT ^= 0x04; //MAP_GPIO_setOutputLowOnPin(ADS1220_POWER_PORT, ADS1220_POWER_PIN); // pin 5.2 } void measure_sensors(void) { int hora = 0; hora = TIME_secondsSinceEpoch(); shutdown_sensors(); } void SysTick_Handler(void) { MAP_SysTick_disableModule(); if (stateMeasure) { stateMeasure = false; measure_sensors(); } } /******************************************************************************* * RTC ISR * Atiende las interrupciones generadas por: *******************************************************************************/ void RTC_C_IRQHandler(void) { uint32_t status; status = MAP_RTC_C_getEnabledInterruptStatus(); MAP_RTC_C_clearInterruptFlag(status); if (status & RTC_C_TIME_EVENT_INTERRUPT) { activate_sensors(); } }
Would really apreciate some help here.