Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k views
in Technique[技术] by (71.8m points)

arduino - ESP32: Reading ADC in Active Mode blocks ADC reading in Deep Sleep mode ULP code

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 what's wrong here. Thanks in advance.

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();
question from:https://stackoverflow.com/questions/65546232/esp32-reading-adc-in-active-mode-blocks-adc-reading-in-deep-sleep-mode-ulp-code

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...