Other Parts Discussed in Thread: CC1310
Hey all,
at the moment I'm working with a TI CC1310 and the Sensor Controller Studio.
I'm trying to measure the time of decharging a capacitor with a series resistor from 3.0V to 0.825V.
For that I'm using the COMPB-module which should fire an event, if the voltage level on the capacitor (PIN_COMP) falls below 0.825V (COMPB_REF_VDDS_DIV4).
To visualize the moment of the event as accurate as possible, I set a digital output pin (PIN_TRIGGERED) to high if I start decharging and to low if the event occurs.
I expect that the time in which PIN_TRIGGERED is high should always be on the same time, because its always the same resistor and the same capacitor, but the event occurs on different times.
It looks like the event is not triggered through falling below the 0,825V level.
What did I do wrong?
Thanks,
Manuel
------------------ Initialisation Code ------------------ // GENERAL state.initDone = 0; state.loadingCap = 1; // DIGITAL OUTPUTS gpioClearOutput(AUXIO_O_PIN_R_REF); gpioClearOutput(AUXIO_O_PIN_TRIGGERED); // COMPB compbSelectGpioInput(AUXIO_A_PIN_COMPB_2); compbEnable(COMPB_REF_VDDS_DIV4); evhSetupTimer1Trigger(0, 3, 0); evhSetupCompbTrigger(0, 0, EVH_COMPB_TRIG_ON_MATCH); state.initDone = 0;
-------------------- Execution Code -------------------- if(state.loadingCap == 1){ // Charging C116 state.loadingCap = 0; gpioSetOutput(AUXIO_O_PIN_R_REF); for(U16 n=0; n < 3; n++){ fwDelayUs(10000, FW_DELAY_RANGE_100_MS); } evhSetupCompbTrigger(0, 1, EVH_COMPB_TRIG_ON_MATCH); output.pTdcValueH = 0; output.pTdcValueL = 0; }else{ // Discharging C116 state.loadingCap = 1; gpioSetOutput(AUXIO_O_PIN_TRIGGERED); // COMPB compbSelectGpioInput(AUXIO_A_PIN_COMPB_2); compbEnable(COMPB_REF_VDDS_DIV4); evhSetupTimer1Trigger(0, 3, 0); gpioClearOutput(AUXIO_O_PIN_R_REF); }
----------------- Event Handler A Code ----------------- if (state.initDone == 0) { compbGetOutput(state.currTriggerLevel); state.initDone = 1; } if (state.currTriggerLevel == 0) { // C116 voltage below 0.825V gpioClearOutput(AUXIO_O_PIN_TRIGGERED); state.currTriggerLevel = 1; } else { // C116 voltage over 0.825V //evhSetupCompbTrigger(0, 1, EVH_COMPB_TRIG_ON_MATCH); state.currTriggerLevel = 0; }
---------------- Task iteration action sequence -------------------- Run Execution Code If event trigger 0 occured{ Run Event Handler A Code (trigger0) Wait for 1 second }