OTA attemp failed

Started by sparky, September 08, 2016, 11:17:33 AM

sparky

Everything works as far as communicating to the IOShield but when I attempt OTA I get the following error;

Available serial ports found: COM4
Opening COM4 @ 115200baud ...
SET TARGET: TO:2FAIL: target set error, exiting..

- I downloaded WirelessProgramming again to make sure everything is current,
- I checked both sketches to insure CheckForWirelessHEX was there,
- I uploaded both sketches again,
- Both Moteinos are sitting within 4" of each other.

PiGateway;
Quote
    CheckForWirelessHEX(radio, flash, false); //non verbose DEBUG

    if (radio.ACKRequested())


IOShield;
Quote
    CheckForWirelessHEX(radio, flash, true);


What's missing?

Edit:  I'm using Felix's OTA Programmer, v1.3
Thanks

Felix

#1
Yes, this is missing on your programmer Moteino:

CheckForSerialHEX((byte*)input, inputLen, radio, targetID, TIMEOUT, ACK_TIME, false);

This code listens to the Windows app.

I would keep the programmer separate from your gateway. Ie use another dedicated programmer Moteino for OTA programming of Moteino nodes. This is not to sell another Moteino but to make it easy and convenient. Usually your gateway Moteino is busy with receiving messages and being tied to a serial port on your PC or Pi. The programmer Moteino does the OTA transfer on a separate channel hence and it can take 30s for large sketches. You would not want to disconnect or take your gateway offline for that amount of time, hence the separate programmer reasoning.

Rather than copy-paste-trial-and-error, I would encourage reading the topics to better understand how the code and various features like OTA/WP work.
Please visit this page and look at the video by Luis, he explains how he did it - he uses the old python script approach since my Windows tool didn't exist at that time, but it's a great prime and conceptual explanation of the functionality and code review. His video included below.
Also please see the blog posts related to Wireless Programming to better understand how this actually works.

https://www.youtube.com/watch?v=tjYz24aFGJI

TomWS

Quote from: Felix on September 08, 2016, 12:09:13 PM
I would keep the programmer separate from your gateway. Ie use another dedicated programmer Moteino for OTA programming of Moteino nodes.
Sounds like a Nifty(TM) device!   :)

Joe, are you listening???

Tom

sparky

So the code;

CheckForSerialHEX((byte*)input, inputLen, radio, targetID, TIMEOUT, ACK_TIME, false);

was not forgotten, it was not meant to be in your PiGateway sketch, correct?  As you already know, I can't just paste the above code in the pigateway sketch without getting a bunch of errors, correct?

Felix

Quote from: GM on September 08, 2016, 01:23:23 PM
So the code;

CheckForSerialHEX((byte*)input, inputLen, radio, targetID, TIMEOUT, ACK_TIME, false);

was not forgotten, it was not meant to be in your PiGateway sketch, correct?
Correct

Quote from: GM on September 08, 2016, 01:23:23 PM
As you already know, I can't just paste the above code in the pigateway sketch without getting a bunch of errors, correct?
Since the above is correct, using this line in the wrong place is not very lucrative.
Please use a 3rd moteino (if you just have 2 moteinos, then reprogram the other one temporarily for the OTA exercise) with the WirelessProgramming programmer sketch, which includes the line above.
All these examples are given as working examples and starting point. You can always customize these as you wish but if you are not familiar with the inner workings of the libraries I would stick with the examples and default working/recommended setup.