Listennode radio hang [solved]

Started by davegravy, May 05, 2016, 07:08:15 PM

davegravy

Been pulling my hair out a bit today...  Thought I'd broken the rfm69 on my moteino but really it seems it was hanging somehow. 

When in listen mode,  if I reboot (ground rst, dtr, or cycle power) I can't subsequently send or receive anything with the radio but get normal serial output etc from the moteino.

To get the radio back I have to remove power, remove my ftdi connections (I measured a steady 2.7v on the 3.3pin from having only the TX line connected from the ftdi adaptor) and short 3.3 to gnd to discharge the supply caps. If I skip any of these steps I think the radio remains powered and then it isn't usable after boot. With these steps the radio comes back every time.

I post this both as a warning to others,  but also to ask if there's any software means to accomplish the same thing (It's a lot of wires to plug/unplug every time I upload an updated sketch).

TomWS

You need to follow a very prescribed sequence to switch between Listen mode and normal mode.  If you restart your system in the middle of Listen Mode and don't follow the sequence to restart it then, you're right, you need to power off the radio to reset it.  There are a couple of alternatives.

1. directly write the reset sequence to the radio on power up before radio.initialize();
2. put this code in your own RFM69 initialize method.
3. hardwire a GPIO to the radio's reset pin and pulse it on power up.

Tom

emjay

Is the module talking on SPI at all?  You could probe with 0xAA/0x55 like the module driver does at init time.
If so, at least you could dump out some module state to help debugging before it all gets trashed by the reset.

The RFM12B has an obscure command to force a reset over SPI - never found one for the RFM69.

davegravy

Quote from: TomWS on May 05, 2016, 07:52:44 PM
You need to follow a very prescribed sequence to switch between Listen mode and normal mode.  If you restart your system in the middle of Listen Mode and don't follow the sequence to restart it then, you're right, you need to power off the radio to reset it.  There are a couple of alternatives.

1. directly write the reset sequence to the radio on power up before radio.initialize();
2. put this code in your own RFM69 initialize method.
3. hardwire a GPIO to the radio's reset pin and pulse it on power up.

Tom

Thanks! I just put radio.listenModeEnd() before radio.Initialize() and now seem to be able to reboot in the middle of listenmode.

Not sure if there's any harm in that command running if the radio's not actually in listenmode. Cleaner solution would be within initialize() to check radio state and then only transition it back to normal mode if we're in listenmode.

snorp

Quote from: davegravy on May 05, 2016, 09:40:09 PM
Thanks! I just put radio.listenModeEnd() before radio.Initialize() and now seem to be able to reboot in the middle of listenmode.

Not sure if there's any harm in that command running if the radio's not actually in listenmode. Cleaner solution would be within initialize() to check radio state and then only transition it back to normal mode if we're in listenmode.

In my listen mode extension (and TomWS's), we exit listenmode in initialize. It looks like Felix missed that part when he merged it with RFM69 in the ListenMode branch of his repo.