Wireless programming not working

Started by englund, August 06, 2013, 05:47:32 PM

englund

Hi, I asked a question in the wordpress comments and got an answer but before I could continue the conversation the comments where disabled so I will continue it here after first pasting the initial two posts:

Lars Englund on August 6, 2013 at 9:04 pm said:

Hi, I just got started with my red hot R3:s :)
I tried the RFM69 demo with node and gateway and got excellent performance! No problem communicating from a node inside my house to a node inside my garage which is 100m away – and there are two other houses in between!
However I can't get the wireless programming to work. It seems to be able to send a random amount of data successfully and then fails like shown below. Any ideas?

Moteino: RFTX > 464c583a3230383aa5038091a50383508093a2038091a503
Moteino: RFTX > 464c583a3230383aa5038091a50383508093a2038091a503
Moteino: RFTX > 464c583a3230383aa5038091a50383508093a2038091a503
Moteino: RFTX > 464c583a3230383aa5038091a50383508093a2038091a503
Timeout, retry...

TX > FLX:208:100D0000A5038091A50383508093A2038091A5033E
Moteino: Timeout waiting for packet ACK, aborting FLASH operation ...
Moteino: FLASH IMG TRANSMISSION FAIL
Moteino: SERIAL IN > FLX:208:100D0000A5038091A50383508093A2038091A5033E
Timeout, retry...

TX > FLX:208:100D0000A5038091A50383508093A2038091A5033E
Moteino: SERIAL IN > FLX:208:100D0000A5038091A50383508093A2038091A5033E
TIMEOUT, aborting...


    Felix on August 6, 2013 at 9:09 pm said:

    Hey Lars,
    So there's a timeout, meaning some packet gets lost or something like that. If your node is far away that might happen. I would try at closer range, I've always tested within a few feet away, to avoid such issues. The idea for wireless programming is to be able to program without wires, but close range will still be a necessity to avoid any dropped packets... for longer range the WirelessHEX library might need to be tweaked to allow more latency and more redundancy. I hope this makes sense.


The nodes are just 40cm apart sitting on my desk so distance should not be a problem.
I increased all timeouts and number of retries in the gateway and python script and noticed that the node resets after a failure while the gateway keeps trying.
Any other ideas what might be failing?

As a side note, the whole point of being able to program wirelessly is to do it at a distance so if that doesn't work it's something that really should be looked into! Got any hints as to what should be changed to increase reliability at long range?

Felix

Lars,
Thanks and sorry if I closed the comments while you still wanted to post more, but I think it's better in the forum (posts get long and hard to follow).
Actually when I tested wireless programming I would never get a timeout. I will look into it when I get a little time.

I am not sure how distance will affect wireless programming, because there are a LOT of packets flying back/forth when you wirelessly program a Moteino. So ... I am not saying you have to be at a few feet distance otherwise it won't work. But I would recommend being well within the range of Moteino, to avoid packet loss and failures.
One nice fail safe feature with the external FLASH chip is that if the program gets transmitted only partially then the old program is not corrupted and will resume.

englund

Ok, thanks, I'll see if I can find another FTDI-cable so I can see what's going on on the node when it fails.

Felix

Lars ... your observations are correct!  8)
What actually happens is sometimes an ACK from the target gets lost and when the host retries the node will not respond with subsequent ACKs. In a large program of hundreds or thousands of packets the chance of this happening is pretty high.

I have added a code patch to the library for both WirelessHEX (RFM12B) and WirelessHEX69 (RFM69).

Please retry with the latest code from github, it should now work much better!  :)
Attached is the node log after a complete reflash. It takes ~34 seconds to reload a modified WirelessProgramming_node.ino (vs ~10.7 seconds when you do it directly from IDE).

Many thanks for reporting this!  ;)

englund

Morning Felix,
I just woke up and couldn't believe my eyes when I saw that you posted a fix already! Had to try it before breakfast and it works perfectly!
Just awesome work and response time Felix! Many thanks! ♥