Reading ADC in Active Mode blocks ADC reading in Deep Sleep mode ULP code

ikequan
Posts: 1
Joined: Sun Jan 03, 2021 9:59 am

Reading ADC in Active Mode blocks ADC reading in Deep Sleep mode ULP code

Postby ikequan » Sun Jan 03, 2021 10:04 am

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();

Who is online

Users browsing this forum: axellin and 82 guests