nassir-malik / IOT-AC-Light-Dimmer-With-Alexa

IOT-Light-Dimmer
72 stars 61 forks source link

ISR not in IRAM! and dont work #3

Open kvvoff opened 5 years ago

kvvoff commented 5 years ago

I have flashed the firmware, but when it starts up the LED is constantly flashing. I opened the port monitor and that's what it gives out. Google did not help me, I do not know what it is

>>>stack>>>

ctx: cont
sp: 3ffffd60 end: 3fffffc0 offset: 01b0
3fffff10:  3fff00cc 00000000 402012a8 40201b40  
3fffff20:  00000000 00000000 ff000061 3ffef0b8  
3fffff30:  00000009 3ffefe14 3ffeed1c 401004e6  
3fffff40:  4020bcc0 faffffef ffffff8c 40202200  
3fffff50:  1300a8c0 ff000000 3ffefe14 402025ca  
3fffff60:  3ffe8da3 00000000 3ffeed1c 3ffef0b8  
3fffff70:  00000009 3ffefe14 3ffeed1c 402027b6  
3fffff80:  00000000 00000000 ffefeffe 00000000  
3fffff90:  00000000 ffefeffe feefeffe feefeffe  
3fffffa0:  3fffdad0 00000000 3ffef088 40209504  
3fffffb0:  feefeffe feefeffe 3ffe8528 401007d1  
<<<stack<<<

 ets Jan  8 2013,rst cause:2, boot mode:(3,7)

load 0x4010f000, len 1384, room 16 
tail 8
chksum 0x2d
csum 0x2d
vac02aff5
~ld

Connecting to WiFi
Connecting.........
Connected to VZ_WRLS
IP address: 192.168.0.19
ISR not in IRAM!

Abort called

And so in a circle constantly

kvvoff commented 5 years ago

On the other nodemcu board the same

lebif commented 4 years ago

Hi, same problem with all my board. Have you find solution ?

kvvoff commented 4 years ago

@lebif No friend, I never found a solution

lebif commented 4 years ago

Hi, @kvvoff, Solution is downgrade the esp822 board library to 2.4.2. (Arduino IDE go to board manager, esp8266 and install the 2.4.2 version.) Works fine !!

petanque commented 4 years ago

The developer says about 5.25 in his youtube video part 2 that you need version 2.3.0

kvvoff commented 4 years ago

@petanque thank you for info)

reynolds087 commented 4 years ago

There are two functions in the .ino file that you can put this in front of them and it works on later version. It tells the compiler to keep the ISR function in memory and is required for ESP core 2.5.1 and later.

ICACHE_RAM_ATTR

example:

ICACHE_RAM_ATTR void dimTimerISR() {

kvvoff commented 4 years ago

@reynolds087 Thanks! I'll try

nassir-malik commented 4 years ago

Downgrade to ESP8266 2.5.0 library using Arduino board manager

reynolds087 commented 4 years ago

@nassir-malik have you tried testing with the ICACHE_RAM_ATTR attribute on the two ISR functions? I believe this corrects the issues in newer library because I'm running your project on the latest version.

nassir-malik commented 4 years ago

Please downgrade ESP8266 support 2.5.0 in Arduino ide.

Send via mobile device

On Wed, Feb 26, 2020, 12:34 PM reynolds087 notifications@github.com wrote:

@nassir-malik https://github.com/nassir-malik have you tried testing with the ICACHE_RAM_ATTR attribute on the two ISR functions? I believe this corrects the issues in newer library because I'm running your project on the latest version.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nassir-malik/IOT-AC-Light-Dimmer-With-Alexa/issues/3?email_source=notifications&email_token=AC6UKGNJOKC7SYKUYC3F2DLRE2Y4DA5CNFSM4HNAL6D2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENBLU6A#issuecomment-591575672, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC6UKGOT2IXU7BWBA2OODHTRE2Y4DANCNFSM4HNAL6DQ .

rohitranjan1991 commented 4 years ago

I did downgrade to 2.5.0 as suggested, but I can still see intermittent flickering.

image

What else could I be doing wrong?

Anupam059 commented 4 years ago

@nassir-malik great tutorial. nodemcu getting connected to wifi but not connecting to MQTT error: INFO: Attempting MQTT connection... ERROR: failed, rc=-2DEBUG: try again in 5 seconds kindly help

l-u-k-a-s-m commented 3 years ago

@nassir-malik have you tried testing with the ICACHE_RAM_ATTR attribute on the two ISR functions? I believe this corrects the issues in newer library because I'm running your project on the latest version.

Confirmed solution for me. Board: Wemos NodeMCU LoLin (Esp8266), I edited the file "robotdyn_dimmer.h" and changed the following: void zcDetectISR() to void ICACHE_RAM_ATTR zcDetectISR()

After that, it worked fine with the latest ESP8266 library. Oddly i didnt need to add "ICACHE_RAM_ATTR" to the other ISR function.

nassir-malik commented 3 years ago

@nassir-malik have you tried testing with the ICACHE_RAM_ATTR attribute on the two ISR functions? I believe this corrects the issues in newer library because I'm running your project on the latest version.

Confirmed solution for me. Board: Wemos NodeMCU LoLin (Esp8266), I edited the file "robotdyn_dimmer.h" and changed the following: void zcDetectISR() to void ICACHE_RAM_ATTR zcDetectISR()

After that, it worked fine with the latest ESP8266 library. Oddly i didnt need to add "ICACHE_RAM_ATTR" to the other ISR function.

I will try it soon. Thank you

jamsyogendra commented 3 years ago

I have same problem but my scenario is defferent,,, please sir if you have solutions for me,,,,

jamsyogendra commented 3 years ago

Hello Everyone,,, "So lets talk about my Project"

Wifi Module: ESP8266 E-09 Server using Sinric Pro;

In my project, I am controlling, 2 Relays: ON/OFF And RobotDyn 1 Channel dimmer module for Fan Regulation.

Here is Codes:

#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <SinricPro.h>
#include <SinricProSwitch.h>
#include <SinricProDimSwitch.h>
#include <RBDdimmer.h>

#define SSID          ""                                              // WiFi SSID
#define PASS          ""                                              // WiFi Password

#define APPKEY        ""                                              // SinricPro AppKey
#define APPSECRET     ""                                              // SinricPro AppSecret

#define RELAY1_ID     ""                                              // SinricPro deviceId for relay1
#define RELAY2_ID     ""                                              // SinricPro deviceId for relay2
#define DIMSWITCH_ID  ""                                              // SinricPro deviceId for dimmer

#define RELAY1_PIN  D0                                                // PIN relay1 is connected to
#define RELAY2_PIN  D1                                                // PIN relay2 is connected to
#define DIMMER_PIN  D5                                                // PIN dimmer is connected to
#define ZEROCROSS   D6                                                // for boards with CHANGEBLE input pins

dimmerLamp dimmer(DIMMER_PIN, ZEROCROSS);                             //initialase port for dimmer for ESP8266, ESP32, Arduino due boards

SinricProSwitch &relay1       = SinricPro[RELAY1_ID];                 // declare SinricPro device for relay1 and add the device to SinricProSDK
SinricProSwitch &relay2       = SinricPro[RELAY2_ID];                 // declare SinricPro device for relay2 and add the device to SinricProSDK
SinricProDimSwitch &dimSwitch = SinricPro[DIMSWITCH_ID];              // declare SinricPro device for dimmer and add the device to SinricProSDK                

int  dimLevel = 100;     // keeps the current dimming value (0..100) | initialized to 100 at start
bool pwrState = false;  // keeps the dimmer on/off state            | initialized to false (which means off) at start

// callback for onPowerState (relay1)
bool onPowerStateRelay1(const String& deviceId, bool &state) {
  digitalWrite(RELAY1_PIN, state);                                    // turn RELAY1_PIN on/off (depending on state parameter)
  Serial.printf("[Relay1]: turn %s\r\n", state ? "on" : "off");       // just some output on serial monitor
  return true;
}

// callback for onPowerState (relay2)
bool onPowerStateRelay2(const String& deviceId, bool &state) {
  digitalWrite(RELAY2_PIN, state);                                    // turn RELAY1_PIN on/off (depending on state parameter)
  Serial.printf("[Relay2]: turn %s\r\n", state ? "on" : "off");       // just some output on serial monitor
  return true;
}

// callback for onPowerState (dimmer)
bool onPowerStateDimSwitch(const String& deviceId, bool &state) {
  pwrState = state;                                                   // store the requested state in global variable (this state will be used in onPowerLevelDimSwitch )
  dimmer.setPower(pwrState? dimLevel : 0);
  Serial.printf("[DimSwitch]: turn %s (level: %d)\r\n",               // just some output on serial monitor
                state ? "on" : "off", dimLevel);
  return true;
}

// callback for onPowerLevel (dimmer)
bool onPowerLevelDimSwitch(const String &deviceId, int &level) {
  dimLevel = level;                                                   // store requested level in global variable (this state will be used in onPowerStateDim )
  dimmer.setPower(level);
  Serial.printf("[DimSwitch]: set level %d (state: %s)\r\n",          // just some output on serial monitor
                level, pwrState ? "on" : "off");
  return true;
}

// setup part for pin initialization (just to keep setup() nice and clean)
void setupPins() {
  pinMode(RELAY1_PIN, OUTPUT);                                        // initialize RELAY1_PIN as OUTPUT
  pinMode(RELAY2_PIN, OUTPUT);                                        // initialize RELAY2_PIN as OUTPUT
  dimmer.begin(NORMAL_MODE, ON);                                      //dimmer initialisation: name.begin(MODE, STATE)
}

// setup part for connecting to WiFi (just to keep setup() nice and clean)
void setupWiFi() {
  Serial.printf("[WiFi]: Connecting to %s", SSID);                    // print to which WiFi we are trying to connect to
  WiFi.begin(SSID, PASS);                                             // start connecting to WiFi
  while (WiFi.status() != WL_CONNECTED) {                             // wait until WiFi has been connected
    Serial.printf(".");                                               //    meanwhile print a dot
    delay(250);                                                       //    every 250ms  
  }
  Serial.printf("connected\r\n");                                     // print to serial that we are connected to wifi now
}

// setup part for SinricProSDK (just to keep setup() nice and clean)
void setupSinricPro() {
  relay1.onPowerState(onPowerStateRelay1);                            // assign onPowerStateRelay1 callback function to relay1 device
  relay2.onPowerState(onPowerStateRelay2);                            // assign onPowerStateRelay2 callback function to relay2 device
  dimSwitch.onPowerState(onPowerStateDimSwitch);                      // assign onPowerStateDimSwitch callback function to dimSwitch device
  dimSwitch.onPowerLevel(onPowerLevelDimSwitch);                      // assign onPowerLevelDimSwitch callback function to dimSwitch device

  SinricPro.onConnected([]() {                                        // instead of writing a full callback function we use a lambda function which get called when ESP is connected to SinricPro
    Serial.printf("[SinricPro]: Connected\r\n");                      // and this function does: output to serial "[SinricPro]: Connected"
  });

  SinricPro.onDisconnected([]() {                                     // instead of writing a full callback function we use a lambda function which get called when ESP is disconnected from SinricPro
    Serial.printf("[SinricPro]: Disconnected\r\n");                   // and this function does: output to serial "[SinricPro]: Disconnected"
  });

  SinricPro.begin(APPKEY, APPSECRET, "testws.sinric.pro");                                 // initialize SinricProSDK with APPKEY and APPSECRET
}

void setup() {
  Serial.begin(115200);                                               // initialize Serial to baudrate 115200
  Serial.println();                                                   // print a single line (to get rid of the junk)
  setupPins();                                                        // call setupPin function
  setupWiFi();                                                        // call setupWiFi function
  setupSinricPro();                                                   // call setupSinricPro function
}

void loop() {
  SinricPro.handle();                                                 // do the magic...
}

Code compiling with zero error no any issues in compelling: the only problem is the codes,the not running in my ESP8266

My serial monitor details are given below here:

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 3584, room 16 tail 0 chksum 0xb0 csum 0xb0 v2843a5ac ~ld

ISR not in IRAM!

User exception (panic/abort/assert) --------------- CUT HERE FOR EXCEPTION DECODER ---------------

Abort called

stack>>>

ctx: cont sp: 3ffffec0 end: 3fffffc0 offset: 0000 3ffffec0: feefeffe feefeffe feefeffe feefeffe 3ffffed0: 000000fe 00000000 00000000 00000000 3ffffee0: 00000000 00000000 00000000 00ff0000 3ffffef0: 5ffffe00 5ffffe00 feefeffe 00000000 3fffff00: 00000002 00000005 00000005 4020e36e 3fffff10: 40100816 feefeffe feefeffe 4020e380 3fffff20: 4020f31d 3fff0e54 00000005 4020e889 3fffff30: 00000000 00000000 535b000a 4020ef99 3fffff40: 3ffe89b1 4020f501 ffffffff 3ffef4e4 3fffff50: 3fffdad0 00000000 00000005 4020e938 3fffff60: 4020c5f8 3ffef38c 3ffe89af 4020c471 3fffff70: 4020c5f8 3ffef38c 3ffeeeb0 4020c4aa 3fffff80: 3fffdad0 00000000 3ffef38c 402020b8 3fffff90: 3fffdad0 00000000 3ffef38c 40202c71 3fffffa0: feefeffe feefeffe 3ffef4a4 4020df20 3fffffb0: feefeffe feefeffe 3ffe8500 40101111 <<<stack<<<

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 3584, room 16 tail 0 chksum 0xb0 csum 0xb0 v2843a5ac ~ld

ISR not in IRAM!

User exception (panic/abort/assert) --------------- CUT HERE FOR EXCEPTION DECODER ---------------

Abort called

stack>>>