Hi everyone,
I'm using the sensor controller of my CC2640 to drive a step-by-step motor. I need to use ADC and delay insertions, and user the less power as possible.
But when I start the sensor controller, it already use 600uA without doing anything :
// Initialisation code
U16 k = 0;
do {
fwDelayUs(10000, FW_DELAY_RANGE_100_MS);
k = k + 1;
}while(k != 250);
fwScheduleTask(1);
The sensor controller should use 8.2uA / Mhz, so around 200uA at 24Mhz, and even at 12Mhz it still use 550uA. I show you the Init / start / stop functions I use. Thanks in advance for your help
/* Initialize the Sensor Controller */
SCIF_RESULT_T SensorController_init()
{
// Enable power domains
PRCMPowerDomainOn(PRCM_DOMAIN_PERIPH);
while (PRCMPowerDomainStatus(PRCM_DOMAIN_PERIPH) != PRCM_DOMAIN_POWER_ON);
// Enable peripheral clocks
PRCMPeripheralRunEnable(PRCM_PERIPH_GPIO);
PRCMLoadSet();
while (!PRCMLoadGet());
scifOsalEnableAuxDomainAccess(); // Prevent AUX from powering down
scifOsalInit(); // Initializes the OSAL
scifOsalRegisterTaskAlertCallback(scTaskAlertCallback); // Register callback method for Task alert
//*Set activ mode in low frequency
HWREG(AUX_WUC_BASE + AUX_WUC_O_CLKLFREQ) = 1;
while(HWREG(AUX_WUC_BASE + AUX_WUC_O_CLKLFACK) != 1);
HWREG(AUX_WUC_BASE + AUX_WUC_O_CLKLFREQ) = 0;
while(HWREG(AUX_WUC_BASE + AUX_WUC_O_CLKLFACK) != 0);
// Use less than 24Mhz
HWREG(AON_WUC_BASE + AON_WUC_O_AUXCLK) |= AON_WUC_AUXCLK_SCLK_HF_DIV_DIV4 ;
return scifInit(&scifDriverSetup); // Enable the driver
}
/* Start one time init-execute-terminate session */
SCIF_RESULT_T SensorController_start_once()
{
scifStartRtcTicksNow(0x100); // Start ticks (for alert events) bit 15:0 -> 1/65536 of seconds, about 100us
// Open the AUX I/O latches, which have undefined value after power-up. AUX_AIODIO will by default
// drive '0' on all I/O pins, so AUX_AIODIO must be configured before IOC
HWREG(AUX_WUC_BASE + AUX_WUC_O_AUXIOLATCH) = AUX_WUC_AUXIOLATCH_EN_TRANSP;
//scifTaskResourceInit(); // Start I/O
return scifCtrlTasksNbl(BV(SCIF_MOTOR_CONTROL_TASK_ID), 0x07); // Init and execute sensor (not termintae)
}
/* Stop ticks and Sensor Controller task */
SCIF_RESULT_T SensorController_stop()
{
SCIF_RESULT_T res = SCIF_SUCCESS;
res = scifStopTasksNbl(BV(SCIF_MOTOR_CONTROL_TASK_ID));
if(res == SCIF_SUCCESS)
{
while(scifWaitOnNbl(0) != SCIF_SUCCESS);
scifStopRtcTicks();
// Wait until the Sensor Controller is idle (it might still be running, though not for long)
while (!(HWREG(AUX_SCE_BASE + AUX_SCE_O_CPUSTAT) & AUX_SCE_CPUSTAT_SLEEP_M));
scifTaskResourceUninit(); // Disable I/O
}
return res;
}
/* Task Main function : */
if(SCIF_SUCCESS == SensorController_start_once())
{
// Wait semaphore
Semaphore_pend(Semaphore_handle(&semScTaskAlert), BIOS_WAIT_FOREVER);
scifClearAlertIntSource();
// Stop sensor controller
scifAckAlertEvents();
while(SensorController_stop() != SCIF_SUCCESS);
}