Main Menu

Reset radio?

Started by englund, October 06, 2013, 02:14:36 PM

englund

Hi, my moteino node seem to hang after 1-3days (randomly). I have enabled the watchdog (WDT0_8S) but that doesn't help. The only thing the moteino does is read from two DS18x20 and two DHT11 and sending that to the gateway every 5 seconds. I'm thinking maybe the radio ends up in some weird state after a while and stays in it when the watchdog resets the AVR. So my question is, is it possible to reset the radio using the RFM69 library?

john k2ox

If you are using anything like:
       long currPeriod = millis()/cycleInterval;

to control when you send/check something make sure cycleInterval is a 'long'.  If 'int' is used to code blows up at 32767.

'Int's used anywhere with millis will result in brain damage.

je

john k2ox

Thinking about it some more. 

915 MHz is in the ISM (industrial, science, medicine) and there are all kinds of devices out there sending signals.  It's possible that you might be a victim of interference.

In Felix's lib he checks to see if there is a signal above a certain threshold and if so, does not allow the radio to transmit.  This is intended to keep two radios from trying to send at the same time.  In the case of an industrial welder, an RFID, or whatever blasting out rf you can see this is problematic.

Other people have mentioned that the communictions seem to die randomly.  I mentioned the freq drift concern but, forgot to mention the interference possibility.

The code below is how I've been running for weeks without a tx hang.

bool RFM69::canSend()
{
  delay(5); //je
  if (_mode == RF69_MODE_RX && PAYLOADLEN == 0 ) //je  && readRSSI() < CSMA_LIMIT) //if signal stronger than -100dBm is detected assume channel activity
  {
    setMode(RF69_MODE_STANDBY);
    return true;
  }
  return false;
}

Try changing Felix's code as above and let us know what happens.

je

englund

#3
I did indeed have a millis overrun problem but I'm using long's so it should only occur after 25 days..

I'm using 868MHz but I guess I can still be a victim of interference. Though that shouldn't cause it to stop sending for hours until I cycle power. I have been logging the RSSI on the receiving end every 30 seconds and the graph shows it as very stable, hardly going below -60. The parts with no data is when the sending node has "hanged", requiring me to cycle power to get it going again.



Still, I will make the changes suggested and let it run some more, thanks for the quick reply John!

englund

I can report that it has been running without interruptions since my last post!
My RSSI graph still shows that the RSSI never drops below the -100 limit (-80 was the lowest recorded value during the last week).
This kindof makes me think that there is something wrong with the RSSI check since bypassing it makes it work even though the RSSI never goes to low. That and the fact that when it stopped working it stopped for good and not just during a few seconds/minutes of bad RSSI..

Felix

To be honest I didn't see such behavior, I also have nodes that ran for many weeks without interruptions. I've observed some slight degradation of signal in the morning when the nodes that are not inside the house (ex in the garage) are much colder than the receiver inside. Which is explained by the other topic in the forum where john k2ox goes over temperature drift vs frequency response.