FOTA not working
-
Hi,
I'm trying for the first time to use FOTA updates.
I followed instructions on https://www.mysensors.org/about/fota.
I changed fuse settings with AVRdudess, then I burned MYSBootloader on a Pro Mini 3.3V 8Mhz using USBasp.
I uploaded a basic sketch with a mock sensor sending fixed value every 10 seconds (I has to upload using the programmer because with this bootloader the FT232 returns an error).
The node connects and works as expected:// Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 #define MY_RF24_PA_LEVEL RF24_PA_LOW #define MY_RF24_DATARATE RF24_250KBPS #define MY_RF24_CHANNEL 125 #define MY_NODE_ID 50 #define SENSOR_ID 2 #include <MySensors.h> MyMessage msg(SENSOR_ID, V_TEMP); void setup() { } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Test", "1.1"); present(SENSOR_ID, S_TEMP); } void loop() { send(msg.set(21)); smartSleep(10000); }
Then I did small changes on the sketch (updated version and changed the sensor fixed value), compiled and took the generated hex file.
I created a type/version/firmware in MyController, uploaded the hex file and associated it to the node.
Then I selected "upload firmware", but nothing happened when the node woke up.
This is from MyController log:2018-09-30 10:12:17,872 INFO [mc-th-pool-2] [org.mycontroller.standalone.provider.EngineAbstract:232] Seems like failed to send this message. There is no ACK received! Retried 1 time(s). MessageImpl(gatewayId=3, nodeEui=50, sensorId=SENSOR_BC, type=Stream, subType=Firmware config response, ack=1, payload=03000300B8037A8A, isTxMessage=true, timestamp=1538295134829, properties=null)
I guessed there was something related to acknowledge (which is enabled in my network), so I tried disabling it.
Now I can see the firmware check in the node log, it seems to send the new firmware but nothing changes (i.e. same version, same sensor value).
I tried sending the reboot command from MyController, but the node didn't reboot at all.
I tried also an hard reset on the node, but again I got the same values sent out.Did I miss some step?
Thank
Daniele -
@daniele It is important to enable
Smart sleep enabled
in your node settings. Otherwise, this node will be treated as a normal node.MYSBootloader
: we need to sendReboot
commandDualoptiboot
: we need to sendUpload firmware
-
@jkandasa, I forgot to tell that I flagged "smartsleep" in the node page of mycontroller.
I tried sending reboot and also resetting the arduino, but still nothing changes.
BTW, any idea why it neither sends the firmware config when ack is enabled? -
@daniele It should work, non-sleeping node firmware update works ok?
I never tested sleep node firmware, needs to check. How about other data for sleep node, working as expected?
-
I tried reaplacing smartSleep with wait, but still nothing happens (and no errors in the log).
All other things are working as expected. -
@daniele can you increase
MY_SMART_SLEEP_WAIT_DURATION_MS
value something to 1000ms?#define MY_SMART_SLEEP_WAIT_DURATION_MS (1000ul)
-
I tried, but without any luck.
After the reboot command, the node log is a continuous flow of MySensors splash screen:3485 TSF:MSG:SEND,50-50-0-0,s=255,c=3,t=33,pt=5,l=4,sg=0,ft=0,st=OK:10000 3495 TSF:MSG:SEND,50-50-0-0,s=2,c=1,t=0,pt=2,l=2,sg=0,ft=0,st=OK:21 3502 MCO:SLP:MS=10000,SMS=1,I1=255,M1=255,I2=255,M2=255 3510 TSF:MSG:SEND,50-50-0-0,s=255,c=3,t=32,pt=5,l=4,sg=0,ft=0,st=OK:1000 3831 TSF:MSG:READ,0-0-50,s=255,c=3,t=13,pt=0,l=0,sg=0: 3837 TSF:MSG:ACK REQ 3842 TSF:MSG:SEND,50-50-0-0,s=255,c=3,t=13,pt=0,l=0,sg=0,ft=0,st=OK: __ __ ____ | \/ |_ _/ ___| ___ _ __ ___ ___ _ __ ___ | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __| | | | | |_| |___| | __/ | | \__ \ _ | | \__ \ |_| |_|\__, |____/ \__⸮ __ __ ____ | \/ |_ _/ ___| ___ _ __ ___ ___ _ __ ___ | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __| | | | | |_| |___| | __/ | | \__ \ _ | | \__ \ |_| |_|\__, |____/ \__⸮ __ __ ____ | \/ |_ _/ ___| ___ _ __ ___ ___ _ __ ___ | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __| | | | | |_| |___| | __/ | | \__ \ _ | | \__ \ |_| |_|\__, |____/ \___ __ __ ____```
-
@daniele Can you check, Have you burned
MYSBootloader
properly? Fuse settings are important.I had this reboot issue while ago with
Pro mini
default boot loader. -
I tried re-burning the bootloader, taking the dev branch this time.
No I don't have the reboot issue, everything goes without any error, but the sketch is not updated.
In the folder with generated files I have 2 hex files: one with the name of my sketch, and one with the same name + .with_bootloader, I used the first one in my tests, is this wrong?
Could this be related to the 250kbps parameter I used? -
@daniele You should use the hex without bootloader,
If you use burned bootloader from dev branch(hex file from GitHub), it should not work in your environment, since you are using non-default channels(
MY_RF24_CHANNEL
).I guess, 250kbps is a default
MY_RF24_DATARATE
- your settings,
#define MY_RF24_CHANNEL 125
- default settings,
#define MY_RF24_CHANNEL (76)
- your settings,
-
So I cannot use FOTA with a custom channel?
Or should I use the master branch from GitHub? -
-
@Daniele You need to compile the MYSbootloader for the right channel. You can get all kind of flavors here: https://github.com/guillebot/MYSensors-Bootloaders
-
@skywatch You can use every channel!
Take a look:
https://github.com/guillebot/MYSensors-Bootloaders
I would be great some form of scanning or automation, but for the moment this will do.
-
@guille That is a great resource, thanks.
My only comment would be that channels 111-125 are missing in the current version.