Porting MySensors to work with the RadioHead library
-
My current guess is that the watchdog timer resets the chip after the time period instead of throwing an interrupt to wake the system...?
-
I narrowed it down even further. It appears that there is no appropriate interrupt and present to handle when the watchdog fires. I have no idea why this is the case, and I do not know if this fix is correct, but by a placing this code somewhere in MySensors.cpp everything works nicely:
ISR( WDT_vect ) { /* dummy */ } -
I narrowed it down even further. It appears that there is no appropriate interrupt and present to handle when the watchdog fires. I have no idea why this is the case, and I do not know if this fix is correct, but by a placing this code somewhere in MySensors.cpp everything works nicely:
ISR( WDT_vect ) { /* dummy */ }Ok, strange. Would be nice to know why this fixes the problem,
It should probably be placed here if it's atmega328 related (and only need to be called once):
https://github.com/mysensors/Arduino/blob/development/libraries/MySensors/MyHwATMega328.h#L22 -
Ok, strange. Would be nice to know why this fixes the problem,
It should probably be placed here if it's atmega328 related (and only need to be called once):
https://github.com/mysensors/Arduino/blob/development/libraries/MySensors/MyHwATMega328.h#L22@hek
As far as I know the function is the interrupt routine that is called by the watchdog when the time expires. I guess it doesn't matter where it is defined so it should be fine to move it. It is not called explicitly anywhere in the code, but by the watchdog. As such, I don't think it should be defined as is done in the header file for the other functions.My question is why is it not working for me without this code, I assume it has been working for everyone else?
-
Glad I could help :-). I guess my prize will be that you patch this so that I do not have to create a pull request ;)
-
I might as well continue while I'm at it :-)
Another weird issue I'm having is that every node requests a new ID whenever it starts, but it does not switch to the new ID it receives. It just continues with the old ID it already had.
When I wipe the ROM it requests a new ID as expected, and this time it is saved and used for subsequent communication. Why is it requesting a new ID when it boots, when it already has one?
-
I might as well continue while I'm at it :-)
Another weird issue I'm having is that every node requests a new ID whenever it starts, but it does not switch to the new ID it receives. It just continues with the old ID it already had.
When I wipe the ROM it requests a new ID as expected, and this time it is saved and used for subsequent communication. Why is it requesting a new ID when it boots, when it already has one?
-
I can also report success and things look pretty good. Had to change the line:
//MyTransportRFM69 transport; MyTransportRFM69 transport(RFM69_FREQUENCY, RFM69_NETWORKID, RF69_SPI_CS, RF69_IRQ_PIN, true, RF69_IRQ_NUM);So that the rfm69HW could be supported.
Now, on to see if I can get the MQTT working.
-
I can also report success and things look pretty good. Had to change the line:
//MyTransportRFM69 transport; MyTransportRFM69 transport(RFM69_FREQUENCY, RFM69_NETWORKID, RF69_SPI_CS, RF69_IRQ_PIN, true, RF69_IRQ_NUM);So that the rfm69HW could be supported.
Now, on to see if I can get the MQTT working.
@reddy11 I had to do the same, although I did the change in the default parameters for the function definition since all my radios are HW :-).
I'm not using the MQTT gateway, I'm using the serial gateway together with a Perl script someone here made which functions as a MQTT gateway, and which I modified to handle node ID assignments.
-
Ok, finally got the thumbs out and actually tested the RFM69 code using a couple of Moteinos. They seem to communicate just fine. :)
Tested with SerialGateway<->RelayActuator-Example.
-
-
Thanks everybody for the nice work! My initial tests also work out of the box with a serial gateway and humidity node. I will let it run over the weekend to see if there are any issues coming up.
-
I have serial gateway running on a MoteinoMega and a node running on a Moteino with RFM69HW radios... Using the 2April2015 build of the development arm... with the addition of the :
//MyTransportRFM69 transport;
MyTransportRFM69 transport(RFM69_FREQUENCY, RFM69_NETWORKID, RF69_SPI_CS, RF69_IRQ_PIN, true, RF69_IRQ_NUM);and the correct pin-out for the radios and LED for these boards...
I needed to mod the MsTimer2.cpp file to add 'AVR_ATmega1284P ' to each of the #ifdef line to support the Mega
As I do not yet have a controller running, I see the gateway output as below when the node TX's:
0;0;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:255;255;3;0;3;
-
@reddy11 I had to do the same, although I did the change in the default parameters for the function definition since all my radios are HW :-).
I'm not using the MQTT gateway, I'm using the serial gateway together with a Perl script someone here made which functions as a MQTT gateway, and which I modified to handle node ID assignments.
@kolaf I gave up on getting the MQTT gateway working. I just dont think there is enough memory in my moteino to use the rf69 and the uipethernet library. I was able to get it to work, but it would crash after a few min. When I updated to the latest UIPEthernet library for the 1.5 series, It was too large to upload. So....anyway...can you elaborate on, or point me to the serial-mqtt script you were referring to?
Thanks! -
@kolaf I gave up on getting the MQTT gateway working. I just dont think there is enough memory in my moteino to use the rf69 and the uipethernet library. I was able to get it to work, but it would crash after a few min. When I updated to the latest UIPEthernet library for the 1.5 series, It was too large to upload. So....anyway...can you elaborate on, or point me to the serial-mqtt script you were referring to?
Thanks!@reddy11 Sure, you can find it here: https://github.com/Yveaux/MySensors_MQTTGateway
You will want to use version 2 of the script.
It does simple note ID assignments by keeping a list of all ids it has seen and choosing the first ID not in this list when receiving an ID request.
There are some dependencies, but you will notice that as you start the script :-)