Other Parts Discussed in Thread: CC1310
I am trying to dig through the 802.15.4 sensor example application and I am running into a wall regarding current consumption. I have reduced the application to a single task without the radio controls. This single task just which runs the ADC every 250mS. The current measurements are showing around 5mA average. I lengthened the time to sleep the task to 25 seconds and it is still the same. It seems something is blocking the low power modes.
This is with a launchpad board with the XDC jumpers removed. POWER_MEAS is defined at the project level.
Void main() { Task_Params taskParams; Board_initGeneral(); /* enable iCache prefetching */ VIMSConfigure(VIMS_BASE, TRUE, TRUE); /* Enable cache */ VIMSModeSet( VIMS_BASE, VIMS_MODE_ENABLED); CPU_WriteBufferDisable(); /* Initialization for board related stuff such as LEDs following TI-RTOS convention */ ADC_init(); #ifndef POWER_MEAS #if defined(BOARD_DISPLAY_USE_UART) /* Enable System_printf(..) UART output */ UART_init(); UART_Params_init(&uartParams); uartParams.baudRate = 115200; UartPrintf_init(UART_open(Board_UART0, &uartParams)); #endif /* BOARD_DISPLAY_USE_UART */ #endif #ifdef DEBUG_SW_TRACE IOCPortConfigureSet(IOID_8, IOC_PORT_RFC_TRC, IOC_STD_OUTPUT | IOC_CURRENT_4MA | IOC_SLEW_ENABLE); #endif /* DEBUG_SW_TRACE */ senseLoopPinHandle = PIN_open(&senseLoopPinState, senseLoopPinCfg); Task_Params_init(&taskParams); taskParams.stack = securityTaskStack; taskParams.stackSize = SEC_TASK_STACK_SIZE; taskParams.priority = 2; Task_construct(&securityTask, securityThread, &taskParams, NULL); BIOS_start(); /* enable interrupts and start SYS/BIOS */ }
Void securityThread(UArg a0, UArg a1) { #if defined(POWER_MEAS) /* Disable external flash for power measurements */ Board_shutDownExtFlash(); #endif while(1) { PIN_setOutputValue(senseLoopPinHandle, STROBE, 1); // GPIO power sense line (just a voltage divider ) ASM_NOP; ASM_NOP; ASM_NOP; ASM_NOP; ASM_NOP; // short delay after switching gpio high ASM_NOP; ASM_NOP; ASM_NOP; ASM_NOP; ASM_NOP; ASM_NOP; ASM_NOP; ASM_NOP; ASM_NOP; ASM_NOP; ASM_NOP; ASM_NOP; ASM_NOP; ASM_NOP; ASM_NOP; senseloop_mV = get_single_ADC( CC13X0_LAUNCHXL_ADC0 ); // Get the ADC result PIN_setOutputValue(senseLoopPinHandle, STROBE, 0); // Set sense line low Task_sleep( 250 *1000 / Clock_tickPeriod ); // sleep } }
uint32_t get_single_ADC( CC13X0_LAUNCHXL_ADCName adc_Ch ) { ADC_Handle adc; ADC_Params params; int_fast16_t res; uint32_t adcValue_mV; uint16_t raw_adc; ADC_Params_init(¶ms); adc = ADC_open(adc_Ch, ¶ms); if (adc == NULL) { System_printf("Error initializing ADC channel 0\r\n"); while (1); } /* Blocking mode conversion */ res = ADC_convert(adc, &raw_adc); if (res == ADC_STATUS_SUCCESS) { adcValue_mV = ADC_convertRawToMicroVolts(adc, raw_adc) / 1000; } else { System_printf("ADC channel 0 convert failed\n\r"); } ADC_close(adc); return adcValue_mV; }
App.cfg contents
/* ================ Idle configuration ================ */ var Idle = xdc.useModule('ti.sysbios.knl.Idle'); /* * The Idle module is used to specify a list of functions to be called when no * other tasks are running in the system. * * Functions added here will be run continuously within the idle task. * * Function signature: * Void func(Void); */ //Idle.addFunc("&myIdleFunc"); Idle.addFunc('&Power_idleFunc'); /* Add the Power module's idle function */ Idle.addFunc('&UartPrintf_flush'); /* Add the UART printout function */ Task.enableIdleTask = true; //Task.enableIdleTask = false; //Task.allBlockedFunc = Idle.run;