[Solved] FOTA Not Working
-
Hello, I'm using mysbootloader from @tekka and I'm trying to make FOTA to work on MyController from @jkandasa. I have MySensors 2.2.0 and a ATMEGA Flashed with the latest mysbootloader. Gateway is MQTT.
I load the firmware into MyController and add it to a node, I hit start upload And I can see the first package on the MQTT topic:
mygateway1-in/99/255/4/0/1
010001000003114C
At the same time I see my node debug
112152 TSF:MSG:READ,0-0-99,s=255,c=4,t=1,pt=6,l=12,sg=0:010001000003114CE8B01000
Then nothing, no more messages.
My settings:
- MySensors 2.2.0
- MQTT GW
- MyController
- MySbootloader (lattest)
- ATMEGA 328 8Mhz
- nRF24 Radios
I compiled the hex file in the Arduino IDE and Exported it with Sketch > Export Compiled Binary, I ended up with 2 hex, LightActuator.ino.standard.hex and LightActuator.ino.with_bootloader.standard.hex. I used LightActuator.ino.standard.hex
Just one extra question, I can't use the FTDI programmer to program my boards (but I'm able to see the serial monitor output), I was able to on the previews bootloader, but with the MySbootloader I can't. Is this normal?
Thank You
-
This post is deleted!
-
FOTA with MYSBootloader requires a reboot before the update kicks in - maybe @jkandasa can help you with MyController and the actions needed.
The latest MYSBootloader version handles both, serial and FOTA updates - make sure you have the correct fuse & baud settings.
-
Thank you @tekka , so the FTDI should work! Correct?
The reboot seems to be the problem! I lose communication with the node when I try to reboot, and I need to reset to make it work again!
Do I need to change the baud on the MySensors? What should I use on the 8Mhz ?
Thank you and great work
-
This is my read of the burn on the 8Mhz Burn with the Arduino IDE
-
@tekka , I think I'm getting to the root (or not) of what might be the problem... I stated that I was not able to upload sketches by FTDI, but now I can see that on some ATMEGA I can, and others I can't... I flashed the bootloader to all in series, all in the same way (some where fresh installs, other not, but I can't track witch ones are what). Some ATMEGA I can upload the sketch by FTDI (when I get home I will try the FOTA, and I hope that on the ones that I can upload by FTDI that the FOTA will work), but on others I can't and I get:
avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00
This seems the error that I get when I try to upload a sketch in the wrong frequency, but I double checked and all the ATMEGAS have the same fuses (the ones in the image above) and all where flashed in the same way.
Thank You
-
I tried to flash the several Bootloader into one of the ATMEGA that was not working, the results are strange:
FTDI Access:
- Arduino UNO Bootloader: OK
- ATMEGA on a Breadboard (8Mhz Internal Clock) OK
- MysBootloader 16Mhz OK
- MysBootloader 8Mhz NOK
- MysBootloader 1Mhz OK
I would assume that the problem was something on the config, but that would not explain way it works on some ATMEGA, and on others not... Can it be defective units (ATMEGA)? Only not working the 8Mhz??
My boards.txt from github Dev brantch... I only had to change 3 lines to make it work... in Linux at lest we need this on the sketch folder (MYSBL.upload.tool=arduino:avrdude, MYSBL.bootloader.tool=arduino:avrdude, MYSBL.build.core=arduino:arduino, MYSBL.build.variant=arduino:standard)
## Add these lines to your boards.txt file in the Arduino installation directory ## ## Arduino Pro or Pro Mini (3V3 & 5V, 1 - 16 MHz) w/ ATmega328 MYSBootloader ## ------------------------------------------------- menu.frequency=Frequency MYSBL.name=ATmega328 with MYSBootloader 1.3.0 MYSBL.upload.tool=arduino:avrdude MYSBL.upload.protocol=arduino MYSBL.upload.maximum_size=30720 MYSBL.upload.maximum_data_size=2048 MYSBL.bootloader.tool=arduino:avrdude MYSBL.build.mcu=atmega328p MYSBL.build.board=AVR_UNO MYSBL.build.core=arduino:arduino MYSBL.build.variant=arduino:standard MYSBL.menu.frequency.MYSBL16=16MHz XTAL MYSBL.menu.frequency.MYSBL16.build.f_cpu=16000000L MYSBL.menu.frequency.MYSBL16.upload.speed=115200 MYSBL.menu.frequency.MYSBL16.bootloader.low_fuses=0xFF MYSBL.menu.frequency.MYSBL16.bootloader.high_fuses=0xD2 MYSBL.menu.frequency.MYSBL16.bootloader.extended_fuses=0x06 MYSBL.menu.frequency.MYSBL16.bootloader.unlock_bits=0x3F MYSBL.menu.frequency.MYSBL16.bootloader.lock_bits=0x0F MYSBL.menu.frequency.MYSBL16.bootloader.file=MySensors/MYSBootloader_16MHz.hex MYSBL.menu.frequency.MYSBL8=8MHz RC MYSBL.menu.frequency.MYSBL8.build.f_cpu=8000000L MYSBL.menu.frequency.MYSBL8.upload.speed=115200 MYSBL.menu.frequency.MYSBL8.bootloader.low_fuses=0xE2 MYSBL.menu.frequency.MYSBL8.bootloader.high_fuses=0xD2 MYSBL.menu.frequency.MYSBL8.bootloader.extended_fuses=0x06 MYSBL.menu.frequency.MYSBL8.bootloader.unlock_bits=0x3F MYSBL.menu.frequency.MYSBL8.bootloader.lock_bits=0x0F MYSBL.menu.frequency.MYSBL8.bootloader.file=MySensors/MYSBootloader_8MHz.hex MYSBL.menu.frequency.MYSBL1=1MHz RC MYSBL.menu.frequency.MYSBL1.build.f_cpu=1000000L MYSBL.menu.frequency.MYSBL1.upload.speed=9600 MYSBL.menu.frequency.MYSBL1.bootloader.low_fuses=0x62 MYSBL.menu.frequency.MYSBL1.bootloader.high_fuses=0xD2 MYSBL.menu.frequency.MYSBL1.bootloader.extended_fuses=0x06 MYSBL.menu.frequency.MYSBL1.bootloader.unlock_bits=0x3F MYSBL.menu.frequency.MYSBL1.bootloader.lock_bits=0x0F MYSBL.menu.frequency.MYSBL1.bootloader.file=MySensors/MYSBootloader_1MHz.hex
-
The complete Log on trying to load the sketch with the FTDI to the ATMEGA! I don't know if not working with the FTDI has anyting related with not being able to flash with the MyController, but it's strange... Just giving all info as possible to try to get some help on the problem.
Arduino: 1.8.5 (Linux), Board: "ATmega328 with MYSBootloader 1.3.0, 8MHz RC" Warning: Board breadboard:avr:atmega328bb doesn't define a 'build.board' preference. Auto-set to: AVR_ATMEGA328BB Sketch uses 13290 bytes (43%) of program storage space. Maximum is 30720 bytes. Global variables use 714 bytes (34%) of dynamic memory, leaving 1334 bytes for local variables. Maximum is 2048 bytes. /opt/arduino-1.8.5/hardware/tools/avr/bin/avrdude -C/opt/arduino-1.8.5/hardware/tools/avr/etc/avrdude.conf -v -patmega328p -carduino -P/dev/ttyUSB0 -b115200 -D -Uflash:w:/tmp/arduino_build_550364/LightActuator.ino.hex:i avrdude: Version 6.3, compiled on Jan 17 2017 at 11:00:16 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/ Copyright (c) 2007-2014 Joerg Wunsch System wide configuration file is "/opt/arduino-1.8.5/hardware/tools/avr/etc/avrdude.conf" User configuration file is "/home/diogo/.avrduderc" User configuration file does not exist or is not a regular file, skipping Using Port : /dev/ttyUSB0 Using Programmer : arduino Overriding Baud Rate : 115200 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x00 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x00 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x00 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x00 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x00 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00 avrdude done. Thank you. Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions. This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.
Thank You
-
Can It be my version of the Arduino AVR Boards? I have 1.6.21, and the same occurs on 1.6.20.
Thank You
-
Ok, at this point I can't access by FTDI to the 8Mhz, all the other frequencies ar working... I only tested the FOTA with the 8Mhz, so I'll teste it again today with the 1Mhz and post back the results.
-
I can confirm that FOTA is working on all frequency, except 8Mhz... I can't get it working on FOTA or FTDI on the 8Mhz version of MYSBootloader!
Can any one help me with this?
Thank you
-
@soloam I assume 115200 baud@8Mhz could be an issue, decreasing it to 57600 may help (i.e. in mysbootloader & boards.txt settings)
-
@tekka said in FOTA Not Working:
57600
hello @tekka I tested out with:
57600
38400
19200
9600
4800
2400None worked, strange that is working on the 16Mhz and 1Mhz, and only the 8Mhz is giving problems... exactly the one that I wanted to use... lol
Thank You
-
-
@soloam When you tested the different baud settings, did you also change it in mysbootloader and recompiled it?
-
Do you mean over here @tekka?
/* set the UART baud rate defaults */ #ifndef BAUD_RATE #if F_CPU >= 8000000L #define BAUD_RATE 115200L #elif F_CPU >= 1000000L #define BAUD_RATE 9600L // 19200 also supported, but with significant error #elif F_CPU >= 128000L #define BAUD_RATE 4800L // Good for 128kHz internal RC #else #define BAUD_RATE 1200L // Good even at 32768Hz #endif #endif
No, I will try it... Can I do it in "Atom"? any special settings?
Thank You
-
@soloam Yes, that's the correct location (if BAUD_RATE is not set via compiler settings).
Sorry, but I have no experience with Atom.
-
@tekka it worked Thank you for your assist, it was my first time doing this... so...
I made the change to HW.h to
#ifndef BAUD_RATE #if F_CPU >= 16000000L #define BAUD_RATE 115200L #elif F_CPU >= 8000000L #define BAUD_RATE 57600L #elif F_CPU >= 1000000L #define BAUD_RATE 9600L // 19200 also supported, but with significant error #elif F_CPU >= 128000L #define BAUD_RATE 4800L // Good for 128kHz internal RC #else #define BAUD_RATE 1200L // Good even at 32768Hz #endif #endif
Compilled the new bootloader, and replaced it on the Arduino IDE folder... Flashed the new 8Mhz Bootloader to my node and now FTDI works... When I get home I'll test out FOTA and post back the results.
Will you change the GitHub Repo to take into account this change? Or is this a local problem only to me? Do you want me to submit change the code and hex file and submit a change request?
Thank You
-
@soloam well done! Yes, please go ahead and submit a PR with the necessary changes. I will review it later this week.
-
@tekka FOTA and FTDI now working on 8Mhz Bootloader... PR submited!
Thank you for your help
-
Just to end and close the topic, @tekka great work on the Bootloader and @jkandasa great work on MyController... Thank you