简体   繁体   English

ESP32:在活动模式下读取 ADC 会阻止在深度睡眠模式下读取 ADC ULP 代码

[英]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.我目前正在研究 GPS 项目,并且正在使用电压检测让我的系统进入睡眠状态并唤醒它。

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.当 ADC 通道 6(引脚 34)上的电压为 0 时,系统进入深度睡眠,并且在深度睡眠中,我使用 ULP 代码测量电压并在达到阈值时唤醒系统。 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.我现在的问题是,当我在活动模式下运行adc1_get_raw(ADC1_CHANNEL_6)时,在深度睡眠中的 ULP 程序中读取的 ADC 仍然没有响应,我仍然删除了活动模式一中的代码。 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:深度睡眠 ADC 配置代码:

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

I encountered this issue in a project I am working on.我在我正在做的一个项目中遇到了这个问题。

You need to call adc1_ulp_enable() after calling adc1_get_raw() in the active mode so that the ULP ADC instruction does not hang.您需要在活动模式下调用adc1_ulp_enable()后调用adc1_get_raw() ,以使 ULP ADC 指令不会挂起。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM