StoreProhibited Exception on variable access from class

Posts: 1
Joined: Fri Jul 13, 2018 5:15 am

StoreProhibited Exception on variable access from class

Postby terratrembel » Fri Jul 13, 2018 5:48 am

I'm trying to update via a Webinterface the SSID, Password, Port, etc. on my ESP32.
For that I've written a class, to handle everything which depends on WiFi. When I try to update a variable, I get the error:

Code: Select all

Guru Meditation Error: Core  1 panic'ed (StoreProhibited). Exception was unhandled.
Core 1 register dump:
PC      : 0x4000169e  PS      : 0x00060330  A0      : 0x800da3a1  A1      : 0x3ffbf650
A2      : 0x00000021  A3      : 0x3ffaf219  A4      : 0x0000000b  A5      : 0x0000ff00

A6      : 0x00ff0000  A7      : 0xff000000  A8      : 0x00000064  A9      : 0x3ffbf620
A10     : 0x00000021  A11     : 0x000000ff  A12     : 0x000000ff  A13     : 0x0000ff00
A14     : 0x00ff0000  A15     : 0xff000000  SAR     : 0x0000000a  EXCCAUSE: 0x0000001d
EXCVADDR: 0x00000021  LBEG    : 0x40001699  LEND    : 0x400016aa  LCOUNT  : 0xffffffff

Backtrace: 0x4000169e:0x3ffbf650 0x400da39e:0x3ffbf660 0x400d9699:0x3ffbf680 0x400d98da:0x3ffbf6b0 0x400d1f8b:0x3ffbf6d0 0x400d56f1:0x3ffbf7
10 0x400d576d:0x3ffbf760 0x4012d681:0x3ffbf780 0x4012d8ad:0x3ffbf7d0


My Code is the following:


Code: Select all

#ifndef __CREDENTIALS_H__
#define __CREDENTIALS_H__
#include <Arduino.h>

struct Credentials{
        char ssid[33];
        char password[65];
        char name[33];
        int port;



Code: Select all


#include "Arduino.h"
#include "WiFi.h"
#include "ESPmDNS.h"
#include "ESPAsyncWebServer.h"

#include "Credentials.h"

class WiFiConfig {
  WiFiConfig(Credentials &, AsyncWebServer &);
  bool changeSSID(AsyncWebServerRequest *request);
  bool setCONFIGMode();

  struct Credentials* _configs;
  AsyncWebServer* _webServer;



Code: Select all

#include "WiFiConfig.h"

WiFiConfig::WiFiConfig(Credentials &configs, AsyncWebServer &webServer) : _configs(&configs), _webServer(&webServer)

bool WiFiConfig::changeSSID(AsyncWebServerRequest *request)
       AsyncWebParameter* param = request->getParam("ssid_input",true);
       param->value().toCharArray(_configs->ssid,sizeof(_configs->ssid));   //This line causes the failure
       return true;

bool WiFiConfig::setCONFIGMode()
       IPAddress apIP(192, 168, 1, 1);
       IPAddress &gateway = apIP;
       IPAddress subnet(255,255,255,0);
       WiFi.softAPConfig(apIP, gateway, subnet);
       WiFi.softAP(_configs->ssid, _configs->password);
       if (!MDNS.begin(_configs->name)) {
          Serial.println("Error setting up MDNS responder!");
       MDNS.addService("http", "tcp", _configs->port);
       _webServer->on("/", HTTP_GET, [](AsyncWebServerRequest *request){
       _webServer->on("/changeSSID", HTTP_POST, [this](AsyncWebServerRequest *request)
       return true;


Code: Select all

#include "Arduino.h"

#include "Credentials.h"
#include "WiFiConfig.h"

Credentials configs = {"SamplePWD", "ExamplePWD", "ExampleMDNS", 80}; //last one is the port
AsyncWebServer webServer(configs.port);

void setup(){
       WiFiConfig wifi(configs, webServer);

void loop() {}

This is a minimal version of my source, since it's where the Exception is thrown.
The problem is caused on accessing "_configs->ssid" from a "_webServer->on" function.

Has somebody had a similar error, or knows what I'm doing wrong?


Who is online

Users browsing this forum: No registered users and 3 guests