I am currently working on a GPS project and am using voltage detection to put my system to sleep and a wake it up. When voltage on ADC channel 6(pin 34) is 0 the system goes to deep sleep and and in deep sleep I use a ULP code to measure voltage and wake up system if a threshold is met. My problem now is, when I run adc1_get_raw(ADC1_CHANNEL_6) in the Active Mode, ADC read in the ULP program in deep sleep is not responding still i delete the code in the Active Mode one. Can anyone me out whats wrong here. Thanks in advance.
Code: Select all
Active Mode Code
...
bool ignitionSate() {
int val = 0;
val = adc1_get_raw(ADC1_CHANNEL_6);
if (val > 0) {
return true;
} else {
return false;
}
}
...
Deep Sleep ADC Config Code
/* Configure ADC channel */
/* Note: when changing channel here, also change 'adc_channel' constant
in adc.S */
adc1_config_channel_atten(ADC1_CHANNEL_6, ADC_ATTEN_DB_11);
adc1_config_width(ADC_WIDTH_BIT_12);
adc1_ulp_enable();