LowPowerLab Forum

Software support => Wireless Programming (aka OTA) => Topic started by: djash40 on February 17, 2017, 03:45:32 PM

Title: Can't get OTA (aka wireless programming) to work
Post by: djash40 on February 17, 2017, 03:45:32 PM
I have about 4 r5 moteino's with fspi flash and I can't get wireless programming to work in linux or the windows various gui's.
I have all the new libraries install in linux and windows installed and of course first compiled them over usb.

#include <RFM69.h>         //get it here: https://www.github.com/lowpowerlab/rfm69
#include <SPI.h>
#include <SPIFlash.h>      //get it here: https://www.github.com/lowpowerlab/spiflash
#include <avr/wdt.h>
#include <RFM69_OTA.h> //get it here: https://github.com/LowPowerLab/WirelessProgramming/tree/master/WirelessHEX69


Have all that stuff.

And this part:
if (radio.receiveDone())
  {   
    CheckForWirelessHEX(radio, flash, true);
    Serial.print("Got [");
    Serial.print(radio.SENDERID);
    Serial.print(':');
    Serial.print(radio.DATALEN);
    Serial.print("] > ");
    for (byte i = 0; i < radio.DATALEN; i++)
      Serial.print((char)radio.DATA[i], HEX);
    Serial.println();
  }
  //else Serial.print('.');

but to no avail. What could I be doing wrong?
I have gateway id 1
Node id 4
output of windows program.

Available serial ports found: COM1, COM4
Opening COM4 @ 115200baud ...
SET TARGET: TO:4
Moteino: [Start wireless gateway...]FAIL: target set error, exiting...
Opening COM4 @ 115200baud ...
SET TARGET: TO:4
Moteino: [TO:4:OK]
TARGET SET OK
FLX?
FAIL: No response from Moteino programmer, is it connected to COM4?
Opening COM4 @ 115200baud ...
SET TARGET: TO:4FAIL: target set error, exiting...
Opening COM4 @ 115200baud ...
SET TARGET: TO:4
Moteino: [TO:4:OK]
TARGET SET OK
FLX?
FAIL: No response from Moteino programmer, is it connected to COM4?
Opening COM4 @ 115200baud ...
SET TARGET: TO:4FAIL: target set error, exiting...
Opening COM4 @ 115200baud ...
SET TARGET: TO:4FAIL: target set error, exiting...
Opening COM4 @ 115200baud ...
SET TARGET: TO:4
Moteino: [Start wireless gateway...]FAIL: target set error, exiting...
Opening COM4 @ 115200baud ...
SET TARGET: TO:4
Moteino: [TO:4:OK]
TARGET SET OK
FLX?
FAIL: No response from Moteino programmer, is it connected to COM4?

Is there a step by step tutorial somewhere.
I have watched louis youtube video but it's slightly outdated now.
I have also tried the other windows guis that are available.
Title: Re: Can't get ota aka wireless programming to work
Post by: Felix on February 17, 2017, 07:05:12 PM
Did you see this wireless programming guide page (https://lowpowerlab.com/guide/moteino/wireless-programming/) ?
A few good resources there...

What sketch is your gateway Moteino running?

Typically you'd have a dedicated programmer Moteino, which is the Moteino the windows program will talk to.
Title: Re: Can't get OTA (aka wireless programming) to work
Post by: djash40 on February 17, 2017, 09:59:12 PM
wireles programming gateway.
I see there is one in Examples>wireless programming OTA > called programmer.
I'll try that tomorrow!
Excited hope it works.
:D
Title: Re: Can't get OTA (aka wireless programming) to work
Post by: djash40 on February 18, 2017, 06:48:00 AM
Tried the programmer sketch and no go.

Opening COM4 @ 115200baud ...
SET TARGET: TO:4FAIL: target set error, exiting...

I think I'll try it back in linux with python command line see what happens.
Title: Re: Can't get OTA (aka wireless programming) to work
Post by: djash40 on February 18, 2017, 07:00:45 AM
python2.7 wp.py -t 4 -f WP_Node_Tank_LVL_010817.ino.standard.hex -s /dev/ttyUSB2

TO:4
Moteino: [TO:4:OK]
TARGET SET OK
File found, passing to Moteino...
FLX?

FLX?

FLX?

FLX?

No response from Moteino, exiting...

What am I doing wrong?
Title: Re: Can't get OTA (aka wireless programming) to work
Post by: djash40 on February 18, 2017, 07:44:37 AM
I just tried the example programmer and target only changing only the encryption key in both linux command line and windows wireless programing.exe and I cannot get them to work... :'(
Title: Re: Can't get OTA (aka wireless programming) to work
Post by: LukaQ on February 18, 2017, 11:55:32 AM
Make sure, you have enough current for Moteino, my serial driver did not manage to provide enough for HW version of radio (had to add LiFePO4 battery across power). Also with HW, programming was good, if nodes were not next to each other (or did have antenna in same direction)
Title: Re: Can't get OTA (aka wireless programming) to work
Post by: Felix on February 18, 2017, 07:59:45 PM
djash40,

I see you are you using a python program?
That will not work. You need to use the windows program. That needs to talk to a COM port which has a Moteino with the OTA programmer sketch (https://github.com/LowPowerLab/RFM69/blob/master/Examples/WirelessProgramming_OTA/Programmer/Programmer.ino).
Title: Re: Can't get OTA (aka wireless programming) to work
Post by: djash40 on February 20, 2017, 09:14:01 AM
A few of my tests were in a Windows 10 box I bought specifically for this wireless programming.
My many attempts failed and I'm not sure why. Could be windows 10 not sure.
I have read all the different posts on wireless programming throughout the site and cannot find a comprehensive post for the newer ota wireless programming. I did see perhaps windows 10 is not so good. Unfortunately I could not get windows 7. :(
Title: Re: Can't get OTA (aka wireless programming) to work
Post by: Felix on February 21, 2017, 12:26:35 PM
I'm sure it's some small detail somewhere, either a setting in the sketches or something to do with how you use the setup. It sounds like you're doing everything right, and I would probably not blame it on Windows10 at this point, but I haven't tried it on W10 yet, I'm still on W7 :P
Title: Re: Can't get OTA (aka wireless programming) to work
Post by: ssmall on February 21, 2017, 04:35:45 PM
I can confirm the OTA windows app works fine on Windows 10.
Title: Re: Can't get OTA (aka wireless programming) to work
Post by: djash40 on February 21, 2017, 05:40:04 PM
Could it be in fact too close as LukaQ suggested?
I can move the windows 10 box somewhere else as it is headless and I control it with nomachine nx.
My last attempt was with https://github.com/msjfb/Moteino-Wireless-Programming (https://github.com/msjfb/Moteino-Wireless-Programming). Installed the vb stuff and the program ran fine but it too failed.
Title: Re: Can't get OTA (aka wireless programming) to work
Post by: Felix on February 21, 2017, 09:35:56 PM
I can only support the official one :)
And it works, as confirmed by others.
A few things have to be done right, and it looks like you're on the right track, just can't see why it would fail on your end.
Sometimes sleeping over it makes a difference :)
Title: Re: Can't get OTA (aka wireless programming) to work
Post by: LukaQ on February 22, 2017, 04:37:51 AM
What you should do/check.
Set one moteino as programmer, check that sketch matches what you have (HW/non-HW, freq.), #define FREQUENCY_EXACT the same as will be on target or //#define FREQUENCY_EXACT if not used.

Set other moteino as target, check that sketch matches what you have (HW/non-HW, freq.), that CheckForWirelessHEX(radio, flash, true); is set to true instead of false

That's about it for WP. In my case, I also try not to have it next to each other, to have enough power (I don't use moteino)
Title: Re: Can't get OTA (aka wireless programming) to work
Post by: luisr320 on March 26, 2017, 05:43:02 PM
CheckForWirelessHEX(radio, flash, true);

What is the "true" for?
Title: Re: Can't get OTA (aka wireless programming) to work
Post by: Felix on March 27, 2017, 03:43:26 PM
Luis, it's for DEBUG:

void CheckForWirelessHEX(RFM69 radio, SPIFlash flash, uint8_t DEBUG=false, uint8_t LEDpin=LED);