Skip to content

ADC vs WiFi #11291

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task done
smartes opened this issue Apr 24, 2025 · 2 comments
Open
1 task done

ADC vs WiFi #11291

smartes opened this issue Apr 24, 2025 · 2 comments
Labels
Status: Awaiting triage Issue is waiting for triage

Comments

@smartes
Copy link

smartes commented Apr 24, 2025

Board

ESP32-s3-wroom1

Device Description

ESP32-s3-wroom1

Hardware Configuration

GPIO5 ADC

Version

v3.2.0

IDE Name

Arduino IDE 2.3.4

Operating System

Ubuntu 24

Flash frequency

40Mhz

PSRAM enabled

no

Upload speed

921600

Description

Seems in version 3.2 something has been changed with adc continuous mode. I have ADC on GPIO5 and I want to have WiFi, which is activated by pressing GPIO0. Now when I try to set up wifi I get "Guru Meditation Error: Core 1 panic'ed (Cache disabled but cached memory region accessed)."
In v3.1.0 this sketch works with no issues.

Sketch

#include <WiFi.h>
#include <ESPmDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>

const char* ssid = "SSID";
const char* password = "Password";
IPAddress ip(192, 168, 4, 1);
IPAddress netmask(255, 255, 255, 0);
const int port = 8080;


adc_continuous_data_t *adcresult = NULL;
uint8_t adc_pins[] = { 6 };  
volatile bool adc_coversion_done = false;

void ARDUINO_ISR_ATTR adcComplete() {
  adc_coversion_done = true;
}

bool OTA=0;

void setup() {
  analogContinuousSetWidth(12);
  analogContinuousSetAtten(ADC_0db);
  analogContinuous(adc_pins, 1, 5, 40000, &adcComplete);
  analogContinuousStart();
}

void loop() {
  if(digitalRead(0)==0) {
    OTA_init();
  }
  if(OTA)
    ArduinoOTA.handle();

  if (adc_coversion_done == true) {
    adc_coversion_done = false;
    if (analogContinuousRead(&adcresult, 0)) {
      analogContinuousStop();       
      uint32_t C_V = adcresult[0].avg_read_mvolts;  ///CPU_BAT          
      analogContinuousStart();
    }
  }
}

void OTA_init() {
  WiFi.softAPConfig(ip, ip, netmask);
  WiFi.softAP(ssid, password);
  WiFi.mode(WIFI_AP);
  ArduinoOTA.setHostname(ssid);
  ArduinoOTA.begin();
  OTA=1;
}

Debug Message

Guru Meditation Error: Core  1 panic'ed (Cache disabled but cached memory region accessed). 
Backtrace: 0x42002b9f:0x3fc99e00 0x403791ae:0x3fc99e20 0x40379233:0x3fc99e70 0x4037b7e8:0x3fc99e90 0x403796d5:0x3fc99ec0 0x40376394:0x3fca4440 0x403765cf:0x3fca4460 0x4037e8be:0x3fca4490

Decoding stack results
0x403791ae: adc_dma_intr at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_adc/adc_continuous.c line 90
0x40379233: adc_dma_in_suc_eof_callback at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_adc/gdma/adc_dma.c line 15
0x4037b7e8: gdma_default_rx_isr at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_hw_support/dma/gdma.c line 829
0x40376394: spi_flash_op_block_func at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/spi_flash/cache_utils.c line 134
0x403765cf: ipc_task at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_system/esp_ipc.c line 65
0x4037e8be: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c line 139

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@smartes smartes added the Status: Awaiting triage Issue is waiting for triage label Apr 24, 2025
@Jason2866
Copy link
Collaborator

Could be that the sdkconfig setting needs to be changed to ADC_CONTINUOUS_ISR_IRAM_SAFE in the sdkconfig when compiling the Arduino libs.
Details are here https://github.com/espressif/esp-idf/blob/release/v5.4/components/esp_adc/Kconfig#L9

@me-no-dev what do you think?

@TD-er
Copy link
Contributor

TD-er commented Apr 25, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Awaiting triage Issue is waiting for triage
Projects
None yet
Development

No branches or pull requests

3 participants