Pin change interrupt not firing with MySensors
-
Hi.
Perhaps I ran into a similar issue?
I created a new node with older 1.5.x version of my sensors-library.
But I was not able to get a door-contact working via interrupt on pin 3 with a sketch I used more than 5 times before.
Last change I can remember, was updating Arduino IDE for MacOS Sierra....How can I get back a working interrupt controlled door-switch?!
-
Hi.
Perhaps I ran into a similar issue?
I created a new node with older 1.5.x version of my sensors-library.
But I was not able to get a door-contact working via interrupt on pin 3 with a sketch I used more than 5 times before.
Last change I can remember, was updating Arduino IDE for MacOS Sierra....How can I get back a working interrupt controlled door-switch?!
-
@idstone: Have you tried passing another mode (e.g. LOW) to gw.sleep method? The issue I am having is that with LOW the interrupt fires, but with CHANGE (which is the default in the sketches) it does not.
@elysion Issues were fixed in the 2.1 beta of the MySensors library, so you'd better have a look at this code to see how to wake from interrupt.
Furthermore, you're using the ATmega out of spec when trying to wake from CHANGE; see http://forum.mysensors.org/topic/250/how-do-i-use-the-interrupt/5 -
@idstone: Have you tried passing another mode (e.g. LOW) to gw.sleep method? The issue I am having is that with LOW the interrupt fires, but with CHANGE (which is the default in the sketches) it does not.
Hi. It seems, that the problem is related to complete charge of my 3,3V arduino pro's.
Reaction on interrupt while closing a door-switch on pin 3 works on an older 5V arduino.
I've read about problems at a customer-evalutation (amazon), especially with arduino pro clones and their interrupt-function.
Bought some more over store from mysensors on ebay... hope these will work correctly :( -
Hi. It seems, that the problem is related to complete charge of my 3,3V arduino pro's.
Reaction on interrupt while closing a door-switch on pin 3 works on an older 5V arduino.
I've read about problems at a customer-evalutation (amazon), especially with arduino pro clones and their interrupt-function.
Bought some more over store from mysensors on ebay... hope these will work correctly :( -
@idstone said:
I've read about problems at a customer-evalutation (amazon), especially with arduino pro clones and their interrupt-function.
Can you quote your source please?
@Yveaux
https://www.amazon.de/Aukru-Redesign-atmega328-ATmega128-Compatible/dp/B00PLD3E1S5.0 von 5 SternenWunderbar!
Von Ludwig Enfield am 19. Juli 2015Bei den Arduino Remakes gibt es immer wieder kleine Abweichungen im Pinout. Also aufpassen - das betrifft hier insbeondere die Interrupt-Pins 0 und 1 bzw. die Pins A6/A7 (u.a. Analog-Ports).
-
@Yveaux
https://www.amazon.de/Aukru-Redesign-atmega328-ATmega128-Compatible/dp/B00PLD3E1S5.0 von 5 SternenWunderbar!
Von Ludwig Enfield am 19. Juli 2015Bei den Arduino Remakes gibt es immer wieder kleine Abweichungen im Pinout. Also aufpassen - das betrifft hier insbeondere die Interrupt-Pins 0 und 1 bzw. die Pins A6/A7 (u.a. Analog-Ports).
@idstone thanks!
If I understand it correctly, the feedback states the pinout of arduino pro mini clones is often slightly different, especially on interrupt pins and analog.
For analog pins this is certainly true, for interrupt pins I have not experienced this myself (yet). -
In one sketch I am using pin change interrupt. But that is a node I built from scratch. I have the feeling the issues arise with the MyS function "sleep()" in combination with a set time. As long as I call
sleep(0xff,0x00, 0xff, 0x00, 0);
pin change interrupts work. As soon as I change any of the parameters, the node will not wake up anymore.That was on 2.0 I have yet to convert and try it on 2.1.
As soon as I have done that, I will post the code .
-
In one sketch I am using pin change interrupt. But that is a node I built from scratch. I have the feeling the issues arise with the MyS function "sleep()" in combination with a set time. As long as I call
sleep(0xff,0x00, 0xff, 0x00, 0);
pin change interrupts work. As soon as I change any of the parameters, the node will not wake up anymore.That was on 2.0 I have yet to convert and try it on 2.1.
As soon as I have done that, I will post the code .
-
@DavidZH Just a shot in the dark, but could you try @tekka workaround from https://github.com/mysensors/MySensors/issues/725 and see if it still crashes ?
@Yveaux I will try that as soon as I'm back from my winter sports vacation (as far as you can call lush green Alpine meadows that. At least the slopes are well maintained!). I have no access to a node and gateway now.
For me it worked for that sketch as it's main function is reading momentary switches, either on mains power or on battery. As soon as I want to add a sensor that needs to send it's info on a set interval I needed it to be on mains power.
But like I said, I will convert the sketch to 2.1 this week, and next week I'll give the workaround a shot.
Keep you posted! -
@idstone thanks!
If I understand it correctly, the feedback states the pinout of arduino pro mini clones is often slightly different, especially on interrupt pins and analog.
For analog pins this is certainly true, for interrupt pins I have not experienced this myself (yet).Hey!
Got some news... the new charge of Arduino Pros arrived, but the problem persists. So I started more trail ' n error and got something:I installed the Arduino-IDE and mysensors-1.5.4-library on an manjaro-based notebook. I had to do some symlinking to get a newer version of avrdude working and now the same sketch I used before works now!
Back to my Mac, flashing the same sketch, the node doesn't work correctly?!
So problem seems to be the version of avrdude, which is offered by the arduino-ide?!
I finally downgraded to IDE 1.6.8 and especially AVR Boards 1.6.8.
Now everything works as expected .... :D -
So it was just a bug in the latest updates of the ide and boards? I'm having probably the same problem on a mega2560
I'm not familiar with your problem, but mine was, that the interrupt on pin3 didn't work as expected. So I was not able to use my new sensor as watchdog for my windows/doors. With downgrade of the Arduino-IDE AND especially AVR Boards 1.6.8 my problem is solved now and every change on that interrupt-pin is correctly recognised and send to gateway.
-
I'm not familiar with your problem, but mine was, that the interrupt on pin3 didn't work as expected. So I was not able to use my new sensor as watchdog for my windows/doors. With downgrade of the Arduino-IDE AND especially AVR Boards 1.6.8 my problem is solved now and every change on that interrupt-pin is correctly recognised and send to gateway.
-
@idstone if you don't mind, please take a look at last line of my code https://forum.mysensors.org/topic/5807/interrupt-and-sleep
-
Hi again. I can confirm, that I got similar problems... the state of the interrupt pin wasn't correctly recognized, too.
May be You could try downgrading Arduino-IDE and (very important) avr boards (1.6.8) ?!I'll see if I can find time today or tomorrow to try this. Also might be interesting to see whether it would be possible to get around the issue using Platform.io.
-
Hi again. I can confirm, that I got similar problems... the state of the interrupt pin wasn't correctly recognized, too.
May be You could try downgrading Arduino-IDE and (very important) avr boards (1.6.8) ?! -
I updated my sensors to use v2 of the MySensors library and this issue went away. Used the same board with same fuses and same Arduino IDE and boards file version. Imho this would suggest that there is an issue in MySensors.
Before migrating to v2 I ran some tests using a button in place of the PIR sensor and it seemed that using a short timeout for the gw.sleep would work, but a longer would not. Did not dig deeper into this though, so might be that it just seemed to work better.