MYSBootloader 1.3.0-beta.3
-
@tekka I've noticed some odd things with my nodes when running the bootloader.
To test I uploaded a simple count time sketch. When running the MYS bootloader the timer resets every 10 seconds, see:
Time: 999 Time: 2000 Time: 3000 Time: 4001 Time: 5001 Time: 6002 Time: 7004 Time: 8003 Time: 9005 Time: 0 Time: 999 Time: 2000 Time: 3000 Time: 4001 Time: 5001 Time: 6002 Time: 7004 Time: 8003 Time: 9005 Time: 0
Using the stock Pro Mim 8Mhz 3.3v bootloader it works fine, any ideas?
Perhaps this is because I'm testing using a non-MySensors sketch?
-
@Mark-Swift yeah, this is intended behavior: the watchdog kicks in after ~8s, so either you reset it in loop() or disable it in setup().
-
Is there a version or branch of this for the rfm69?
-
@rmtucker No, but everybody is welcome to contribute and enhance the functionality.
-
@tekka, I'm trying to compile the HEX using OSX. I have installed avr-gcc with homebrew but I get
rm *.o
rm: *.o: No such file or directory
make: [clean] Error 1 (ignored)
rm *.elf
rm: *.elf: No such file or directory
make: [clean] Error 1 (ignored)
rm *.hex
rm: *.hex: No such file or directory
make: [clean] Error 1 (ignored)
"avr-gcc" -funsigned-char -funsigned-bitfields -DF_CPU=16000000L -Os -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -Wall -Wextra -Wundef -pedantic -mmcu=atmega328p -c -std=gnu99 -MD -MP -MF "MYSBootloader.d" -MT"MYSBootloader.d" -MT"MYSBootloader.o" -I MYSBootloader.c -o MYSBootloader.o
avr-gcc: fatal error: no input files
compilation terminated.
make: *** [MYSBootloader.o] Error 1When issueing the Make command, can you help, any suggestions?
-
@Mark-Swift I haven't tested that with OSX - maybe somebody can help here?
-
@tekka, started a windows VM, run via MinGW and got this when running makefile, does it look okay?
C:\MySensorsBootloaderRF24-development>mingw32-make.exe rm *.o process_begin: CreateProcess(NULL, rm *.o, ...) failed. make (e=2): The system cannot find the file specified. Makefile:40: recipe for target 'clean' failed mingw32-make.exe: [clean] Error 2 (ignored) rm *.elf process_begin: CreateProcess(NULL, rm *.elf, ...) failed. make (e=2): The system cannot find the file specified. Makefile:40: recipe for target 'clean' failed mingw32-make.exe: [clean] Error 2 (ignored) rm *.hex process_begin: CreateProcess(NULL, rm *.hex, ...) failed. make (e=2): The system cannot find the file specified. Makefile:40: recipe for target 'clean' failed mingw32-make.exe: [clean] Error 2 (ignored) "C:/Arduino/hardware/tools/avr/bin/avr-gcc" -funsigned-char -funsigned-bitfields -DF_CPU=16000000L -Os -ffunction-sections -fdata-sections -fpack-struct -fshort -enums -mrelax -Wall -Wextra -Wundef -pedantic -mmcu=atmega328p -c -std=gnu99 -M D -MP -MF "MYSBootloader.d" -MT"MYSBootloader.d" -MT"MYSBootloader.o" -IC:/Ardu ino/hardware/tools/avr/avr/include/avr MYSBootloader.c -o MYSBootloader.o In file included from Core.h:40:0, from MYSBootloader.c:69: HW.h:51:2: warning: #warning is a GCC extension #warning BAUD_RATE error greater than 2% ^ HW.h:51:2: warning: #warning BAUD_RATE error greater than 2% [-Wcpp] In file included from Core.h:42:0, from MYSBootloader.c:69: MyMessage.h:292:3: warning: ISO C99 doesn't support unnamed structs/unions [-Wpe dantic] }; ^ "C:/Arduino/hardware/tools/avr/bin/avr-gcc" -nostartfiles -Wl,-s -Wl,-static -Wl ,-Map=".map" -Wl,--start-group -Wl,--end-group -Wl,--gc-sections -mrelax -Wl,-se ction-start=.text=0x7800 -mmcu=atmega328p -o MYSBootloader.elf MYSBootloader.o -lm "C:/Arduino/hardware/tools/avr/bin/avr-objcopy" -O ihex -R .eeprom MYSBootloader .elf MYSBootloader.hex "C:/Arduino/hardware/tools/avr/bin/avr-size" MYSBootloader.elf text data bss dec hex filename 2036 6 72 2114 842 MYSBootloader.elf
-
@tekka Just wanted to check if the above log looks okay, currently rolling the bootloader out to 14 nodes (painful process!) and wanted to check if it looks okay before I do.
I'm also using this board.txt, I made a separate entry for my Uno's, do they all look okay? I basically used the fuses from the standard Arduino boards.txt with the change of 0x05 to 0x06 for the BOD? I noticed in the makefile that you can specify the fuses, do I need to compile a bootloader for each device with the exact fuses, or will one bootloader for 16 / 8 / 1Mhz suffice?
Thank you very much in advance, the bootloader is amazing work.
menu.cpu=Processor ############################################################## pro.name=MySensors Bootloader for Pro Mini pro.upload.tool=arduino:avrdude pro.upload.protocol=arduino pro.upload.maximum_size=30720 pro.upload.maximum_data_size=2048 pro.bootloader.tool=arduino:avrdude pro.bootloader.unlock_bits=0x3F pro.bootloader.lock_bits=0x0F pro.build.mcu=atmega328p pro.build.board=AVR_PRO pro.build.core=arduino:arduino pro.build.variant=arduino:standard ## Arduino with MYSBootloader Beta 2 ## ------------------------------------------------- ## pro.menu.cpu.16MHzatmega328=ATmega328 16MHz (XTAL, BOD1V8) 1.3 Beta 2 ## pro.menu.cpu.16MHzatmega328.upload.speed=115200 ## pro.menu.cpu.16MHzatmega328.bootloader.low_fuses=0xFF ## pro.menu.cpu.16MHzatmega328.bootloader.high_fuses=0xDA ## pro.menu.cpu.16MHzatmega328.bootloader.extended_fuses=0x06 ## pro.menu.cpu.16MHzatmega328.bootloader.file=MYSBootloader/MYSBootloader_B2_16Mhz.hex ## pro.menu.cpu.16MHzatmega328.build.f_cpu=16000000L ## pro.menu.cpu.8MHzatmega328=ATmega328 8MHz (RC, BOD1V8) 1.3 Beta 2 ## pro.menu.cpu.8MHzatmega328.upload.speed=38400 ## pro.menu.cpu.8MHzatmega328.bootloader.low_fuses=0xE2 ## pro.menu.cpu.8MHzatmega328.bootloader.high_fuses=0xDA ## pro.menu.cpu.8MHzatmega328.bootloader.extended_fuses=0x06 ## pro.menu.cpu.8MHzatmega328.bootloader.file=MYSBootloader/MYSBootloader_B2_8Mhz.hex ## pro.menu.cpu.8MHzatmega328.build.f_cpu=8000000L ## pro.menu.cpu.1MHzatmega328=ATmega328 1MHz (RC/8, BOD1V8) 1.3 Beta 2 ## pro.menu.cpu.1MHzatmega328.upload.speed=9600 ## pro.menu.cpu.1MHzatmega328.bootloader.low_fuses=0x62 ## pro.menu.cpu.1MHzatmega328.bootloader.high_fuses=0xDA ## pro.menu.cpu.1MHzatmega328.bootloader.extended_fuses=0x06 ## pro.menu.cpu.1MHzatmega328.bootloader.file=MYSBootloader/MYSBootloader_B2_1Mhz.hex ## pro.menu.cpu.1MHzatmega328.build.f_cpu=1000000L ## Arduino with MYSBootloader Beta 3 ## ------------------------------------------------- pro.menu.cpu.16MHzatmega328=ATmega328 16MHz (XTAL, BOD1V8) 1.3 Beta 3 pro.menu.cpu.16MHzatmega328.upload.speed=115200 pro.menu.cpu.16MHzatmega328.bootloader.low_fuses=0xFF pro.menu.cpu.16MHzatmega328.bootloader.high_fuses=0xDA pro.menu.cpu.16MHzatmega328.bootloader.extended_fuses=0x06 pro.menu.cpu.16MHzatmega328.bootloader.file=MYSBootloader/MYSBootloader_B3_16Mhz.hex pro.menu.cpu.16MHzatmega328.build.f_cpu=16000000L pro.menu.cpu.8MHzatmega328=ATmega328 8MHz (RC, BOD1V8) 1.3 Beta 3 pro.menu.cpu.8MHzatmega328.upload.speed=38400 pro.menu.cpu.8MHzatmega328.bootloader.low_fuses=0xFF pro.menu.cpu.8MHzatmega328.bootloader.high_fuses=0xDA pro.menu.cpu.8MHzatmega328.bootloader.extended_fuses=0x06 pro.menu.cpu.8MHzatmega328.bootloader.file=MYSBootloader/MYSBootloader_B3_8Mhz.hex pro.menu.cpu.8MHzatmega328.build.f_cpu=8000000L pro.menu.cpu.1MHzatmega328=ATmega328 1MHz (RC/8, BOD1V8) 1.3 Beta 3 pro.menu.cpu.1MHzatmega328.upload.speed=9600 pro.menu.cpu.1MHzatmega328.bootloader.low_fuses=0x62 pro.menu.cpu.1MHzatmega328.bootloader.high_fuses=0xDA pro.menu.cpu.1MHzatmega328.bootloader.extended_fuses=0x06 pro.menu.cpu.1MHzatmega328.bootloader.file=MYSBootloader/MYSBootloader_B3_1Mhz.hex pro.menu.cpu.1MHzatmega328.build.f_cpu=1000000L ############################################################## ############################################################## ############################################################## ############################################################## ############################################################## menu.cpu=Processor ############################################################## uno.name=MySensors Bootloader for Uno uno.upload.tool=arduino:avrdude uno.upload.protocol=arduino uno.upload.maximum_size=32256 uno.upload.maximum_data_size=2048 uno.bootloader.tool=arduino:avrdude uno.bootloader.unlock_bits=0x3F uno.bootloader.lock_bits=0x0F uno.build.mcu=atmega328p uno.build.board=AVR_UNO uno.build.core=arduino:arduino uno.build.variant=arduino:standard ## Arduino with MYSBootloader Beta 2 ## ------------------------------------------------- ## uno.menu.cpu.16MHzatmega328=ATmega328 16MHz (XTAL, BOD1V8) 1.3 Beta 2 ## uno.menu.cpu.16MHzatmega328.upload.speed=115200 ## uno.menu.cpu.16MHzatmega328.bootloader.low_fuses=0xFF ## uno.menu.cpu.16MHzatmega328.bootloader.high_fuses=0xDA ## uno.menu.cpu.16MHzatmega328.bootloader.extended_fuses=0x06 ## uno.menu.cpu.16MHzatmega328.bootloader.file=MYSBootloader/MYSBootloader_B2_16Mhz.hex ## uno.menu.cpu.16MHzatmega328.build.f_cpu=16000000L ## Arduino with MYSBootloader Beta 3 ## ------------------------------------------------- uno.menu.cpu.16MHzatmega328=ATmega328 16MHz (XTAL, BOD1V8) 1.3 Beta 3 uno.menu.cpu.16MHzatmega328.upload.speed=115200 uno.menu.cpu.16MHzatmega328.bootloader.low_fuses=0xFF uno.menu.cpu.16MHzatmega328.bootloader.high_fuses=0xDA uno.menu.cpu.16MHzatmega328.bootloader.extended_fuses=0x06 uno.menu.cpu.16MHzatmega328.bootloader.file=MYSBootloader/MYSBootloader_B3_16Mhz.hex uno.menu.cpu.16MHzatmega328.build.f_cpu=16000000L
-
@Mark-Swift What changes did you make to the bootloader - the code size seems increased
-
@tekka None that I'm aware of?
I just changed the fuses in the makefile to match the ones in my boards.txt, not sure if that's required, can you take a look at my questions above, I really want to be sure I'm doing all of this right before deploying.
To recap with regards the bootloader.
- Installed Windows 7
- Installed mingw (core and c++ compiler)
- Installed Arduino IDE and MySensors library (Installed at the same location as you, at c drive root)
- Downloaded bootloader from github
- Edited the fuses and clock speed at the top of the makefile to match my boards.txt
- Ran makefile from cmd
-
@Mark-Swift ok, most probably a false alarm. I assume you tested it after compilation?
-
@tekka It seems to work? I guess if there was an issue it wouldn't work at all?
Please can you conform my fuses look okay in the boards.txt I posted above? Also, do I need to change the fuses in the makefile and make a file for each device, or just 1 x 16Mhz and 1 x 8Mhz for example?
-
@Mark-Swift I'm not at my workstation right now - you have to adjust the fuse settings according to your HW configurations and preferences. The fuse settings in the makefile are obsolete if you use the Arduino IDE / boards.txt for flashing. Please use the AVR fuse calculator to calculate to correct fuse settings:
-
I @tekka, I thought as much, so basically I just need a bootloader with the right Mhz and then set fuses in the Arduino IDE boards.txt.
I used the fuse settings from the original boards.txt included with the Arduino IDE, but adjusted the extended one to 0x06 (Adjust BOD).
I noticed you used slightly different fuses to the Arduino IDE, you're using fuses that indicate a floating crystal or something?
-
First of all, thanks for working so hard on the new version of the BL.
My setup:
- MYSBootloader 1.3.0-beta3 (md5 49ef3dc263110613c9c25ac21a8c3d83)
- MYSController 1.0.0.beta (updated to latest version)
- GW on Arduino Nano
- Node on Arduino Pro Mini @ 5V 16 Mhz with MockMySensors sketch running
What I did:
- Flashed latest bootloader version from github on the Pro Mini ATMEGA328P (using AVRDUDESS 2.4 & USBasp, fuses L: 0xFF, H: 0xDA, E: 0x05)
- Flashed latest mysensors lib on both node & gw (tested with both 2.0.0 & 2.1) on the Nano
What I got:
- FW upgrade through MYSController: Working
- Reboot through MYSController: Working
- Serial flashing with Arduino IDE: Working
- Request presentation through MYSController: Working
Request heartbeat through MYSController: Working
But...
Reassign ID through MYSController: NOT WORKING (the node reboots but still preserves the old ID)
(MY_NODE_ID IS NOT DEFINED / THUS SET AS AUTO AS PER MYSENSORS DEFAULTS)
Clear EEPROM through MYSController: NOT WORKING (the node reboots but still holds the value saved in EEPROM using saveState)Node bootlog after Clear EEPROM from MYSBootloader (you can see my debug LOADSTATE which still loads the value 123 from EEPROM):
Starting sensor (RNNNA-, 2.0.0) TSM:INIT TSM:RADIO:OK TSP:ASSIGNID:OK (ID=4) TSM:FPAR TSP:MSG:SEND 4-4-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSP:MSG:READ 150-150-255 s=255,c=3,t=7,pt=0,l=0,sg=0: TSP:MSG:BC TSP:MSG:READ 0-0-4 s=255,c=3,t=8,pt=1,l=1,sg=0:0 TSP:MSG:FPAR RES (ID=0, dist=0) TSP:MSG:PAR OK (ID=0, dist=1) TSM:FPAR:OK TSM:ID TSM:CHKID:OK (ID=4) TSM:UPL TSP:PING:SEND (dest=0) TSP:MSG:SEND 4-4-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1 TSP:MSG:READ 0-0-4 s=255,c=3,t=25,pt=1,l=1,sg=0:1 TSP:MSG:PONG RECV (hops=1) TSP:CHKUPL:OK TSM:UPL:OK TSM:READY GW Started LOADSTATE 123
And...is it expected that the "Info" tab on my node shows bootloader version 1.2?
Is there anything I'm missing to have these features working?
Thanks in advance
-
@andreground Yes, re-assigning can be done nowadays with the MySensors framework, i.e. send a C_INTERNAL/I_ID_RESPONSE/<NEW ID> message to the (active) node.
-
@tekka is it okay to use the bootloader on the gateway?
-
@Mark-Swift That depends on the use case - what do you have in mind?
-
@tekka I'd like to put my gateway in quite an isolated place and update the sketches OTA, but I presume that's not possible as without the gateway live, there's nothing to action the OTA
I've tried the ESP as it allows OTA updates, but the ESP still has blocking code and it can't handle all my nodes without dropping messages.
-
I don't know if it the right place to ask, but I am planning to make a wired sensor network (I already have cables) like an RS485 or whatever better technology, so is there any good solution to implement OTA updates? Thanks
-
@tekka thanks, it works.
2 more questions:
- Should the clearing eeprom function in MYSBootloader be working?
- From what I understand, Watchdog is enabled by default (8S timeout) in the bootloader; that means that I've to either call wdt_reset in my loop or call wdt_disable in setup to prevent unexpected reboots. Am i right?
-
@andreground said in MYSBootloader 1.3.0-beta.3:
@tekka thanks, it works.
2 more questions:
- Should the clearing eeprom function in MYSBootloader be working?
No, this has also been moved to the MySensors framework:
Add:
If MY_DEBUG is disabled, you can add
#define MY_SPECIAL_DEBUG
and then send a C_INTERNAL / I_DEBUG / E to the node. For the sake of completeness, here are the special debug commands:
E: Clear EEPROM (node replies with OK and reboots)
V: Report CPU voltage in mV (if supported)
F: Report frequency in cHz
M: Report free memory
R: Report routing table (if node is a repeater/gateway)- From what I understand, Watchdog is enabled by default (8S timeout) in the bootloader; that means that I've to either call wdt_reset in my loop or call wdt_disable in setup to prevent unexpected reboots. Am i right?
wdt_reset() is called within the framework, so no need to call it unless you have blocking code of >8s. Alternatively, you can also disable it (AVR: if the wdton fuse is cleared).
-
I've never used the clear EEPROM feature but would like to.
I've added:
#define MY_SPECIAL_DEBUG
To my sketches. Using the latest MYSController, will the menu option 'Clear EEPROM' still do the trick, or does the application need some updates?
-
Hi,
Is there going to be 1 and 8MHz MySBootloader hex files?
Thanks!
-
@tekka, I tested this bootloader and facing an issue.
https://github.com/mysensors/MySensorsBootloaderRF24/issues/7
-
How do I do a remote reboot of a node? Node is not responding to MYSController command (I think due to changed things as with reassigning node-ID). DO I have to write a receive event or enable it somehow? Node is sleeping most time, maybe that's a problem.
-
I'm very interested in testing your development for the latest MYSBootloader as the bootloader for OTA updates on my new hardware designs that i'm starting to design, but i would like a stable one first to make sure my system and setup are working fine with the stable. Is the stable bootloader the one in the master branch of https://github.com/mysensors/MySensorsBootloaderRF24/tree/master. The MYSBootloader.hex file or does this still need to be compiled for use?
Or do you happen to have a download link for the stable version, should we be using the one that you bundle together with MYSController?
Also, @tekka - Do you advise a stable one that works for MyController.org please?
-
With this bootloader, i can not upload scetch with serial or USB.
Where does i made a mistake?
Is there a configuration that is specific to the bootloader?
Thanks
-
@Nicolas-Charrier Welcome to MySensors. Please do not post the same question in different threads. Maybe you can give additional information that help to understand what you tried so far (logs, screenshots, HW configuration, CPU frequency, etc.). Did you follow the OTA/bootloader instructions here?
-
@tekka
I can now program my board with serial line. It's work perfectly.
It's an issue with my serial converteur and an usb hub. The usb hub add a delay that is not compatible with the bootloader.
Sorry for the question.
Nico
-
@Nicolas-Charrier Good to know, thanks for your feedback
-
Excuse me for beeing an idiot. But how do you compile the bootloader from source? Do you do it from Atmel studio or from Arduino IDE. And how is it done? When I compile it in Atmel studio it gets an base adress of 0x0000 which is wrong.
I am used to program in assembler in Atmel studio and when I program in C i don't touch anyting else than the .c file. So some form of tutorial kind of thing would be helpful.
Thank you
-
Hey all,
I've compiled the bootloader and was able to install it with Arduino as ISP to a Nano. I couldn't find the lines necessary for the Nano in boards.txt so I created this:
############################################################## nanomysbootloader.name=Arduino Nano MYSBootloader nanomysbootloader.upload.tool=avrdude nanomysbootloader.upload.protocol=arduino nanomysbootloader.bootloader.tool=avrdude nanomysbootloader.bootloader.unlock_bits=0x3F nanomysbootloader.bootloader.lock_bits=0x0F nanomysbootloader.build.f_cpu=16000000L nanomysbootloader.build.board=AVR_NANO nanomysbootloader.build.core=arduino nanomysbootloader.build.variant=eightanaloginputs ## Arduino Nano w/ ATmega328 ## ------------------------- nanomysbootloader.menu.cpu.atmega328=ATmega328 nanomysbootloader.menu.cpu.atmega328.upload.maximum_size=30720 nanomysbootloader.menu.cpu.atmega328.upload.maximum_data_size=2048 nanomysbootloader.menu.cpu.atmega328.upload.speed=115200 nanomysbootloader.menu.cpu.atmega328.bootloader.low_fuses=0xFF nanomysbootloader.menu.cpu.atmega328.bootloader.high_fuses=0xDA nanomysbootloader.menu.cpu.atmega328.bootloader.extended_fuses=0xFD nanomysbootloader.menu.cpu.atmega328.bootloader.file=MySensors/MYSBootloader.hex nanomysbootloader.menu.cpu.atmega328.build.mcu=atmega328p
Is this correct? Besides, on some devices I cannot program over serial anymore now, only through another ISP. Could that be caused by incorrect settings? Is it possible to recover from that?
The error I'm getting is this one:
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x32Thanks and happy easter!
Rene
-
Hi All,
I'm currently upgrading to MySensors 2.0.0 and it would make sense to change over to the MYSBootloader as I upgrade each node. (I'd like to be able to use the remote re-boot command from MYSController).
I have been reading about the MYSBootloader and have some questions . . .
Q1 - My nodes are a mixture of Pro-Micro's, Leonardo's, Mega 2560's and the odd UNO. From what I can see, the MYSbootloader.hex file is for the Mega328p, is this correct, or can the same bootloader be adjusted (fuse settings etc) for others like the Leonardo processor?
Q2 - One post I read seemed to imply that to use the remote reboot feature you needed 'either' the MYSBootloader OR OptiBoot. In the OptiBoot readme, it doesn't mention reboot as a feature, so I am wondering if it really does support reboot - can anyone please confirm?
Many thanks,
Paul
-
Q1) Yes, correct.
Q2) The reboot is handled automatically when new firmware has been downloaded by the library. Note: When using DualOptiboot you must also enable the MY_OTA_FIRMWARE_FEATURE when compiling the sketch to allow updates.
-
Hi,
Is it possible to add support for rs485 network? In my opinion bootloader which exists need only de-pin management. I'm using hardware serial (rx tx) in nod's.
-
Can someone please tell me how long it is supposed to take to upload a hex file with MYSBootloader. I am trying out OTA Updates with the latest dev branch of MYSBootloader and it takes almost 2 hours to upload a 64k hex file. Is this normal or should it be a lot quicker?
-
How far is the node from gateway? It should take much less time actually
-
@gohan I have tried 2 different nodes in 2 different locations. The one node is about 8m away from the gateway. The other node is around 12m away.
-
Ok, if you put it like 2 meters away do you notice any difference?
-
@gohan Seems to be taking the same time at 2 meters apart. Can you tell me how long it should take to do an OTA update? You say "much less time" .. what should it take for a 64k update?
-
I don't have direct experience (I am waiting for my mini pro to be delivered) but I read other sending in around 10 minutes but I don't know what was the hex file size.
I asked for the distance just to make sure it wasn't related to range issues.
-
I am getting good range here. I have a repeater node (not using MYSBootloader yet) that is 100m away and works fine and another node 200 to 300m away (hence the repeater at 100m). The far node was dropping some messages but that is not too critical as its only a water tank level sensor. I plan to put in a long range PA+SMA type nrf24L01 on that one. The gateway and repeater already have the long range nrf's. I am now testing OTA to a weather station node that is just outside - around 10m from gateway. And I have a test node on my desk around 8m from the gateway. Both the weather station and the test node on my desk give same results for OTA - around 30min or so for every 20k of hex file.
-
how long is the sleep time of your nodes?
-
@gohan The weather station does not sleep - it uses wait() and does so for 5 seconds every loop. The test node first waits for 5 seconds then sleeps for 55 seconds. Both these node seem to update at the same rate. However, it also seems MYSBootloader does the firmware update then launches the sketch code, so the wait / sleep cycle is irrelevant as it first updates the bootloader then runs the sketch
-
it is relevant because if it is long, the node will start the ota update only when it exits the sleep, so I was just making sure you didn't overlooked that
-
@gohan not overlooked All seems to be working - range is good, MYSBootloader and OTA updates work. It just incredibly slow. It seems to do some message updates then pause for maybe 5 seconds or so, then carry on going. So when there are 1000 messages - these 5 sec pauses probably add up to what is making it take hours instead of minutes
-
@slt1 If you are using
wait()
to repeat some function. I recommend using http://playground.arduino.cc/Code/SimpleTimer, to avoid complete blocking when executingwait()
.
-
@jkandasa Thanks for the help, but the problem I am having cannot be in the sketch. The firmware update does gets started after a reboot. So that part is all working fine. Once the firmware is updating then no sketch code runs until it completes. The firmware updating is what is very very slow
-
@slt1 I hope you are also facing this kind of issue: https://github.com/mysensors/MySensorsBootloaderRF24/issues/12
-
@jkandasa I added some basic shielding around NRF's and now getting the 60Kb hex file transferred in around 15 minutes (was 2 hours!), and a 30Kb hex file transferred in about 7 minutes (prev was about 1 hour). So its a lot better, but still rather slow ! I am not sure if that is a good transfer rate for OTA and if what I am now getting can still be improved. I cannot find any information on what transfer speeds one should expect with OTA updates.
I am also using MyController, but using the 5V / 16Mhz MySBootloader file in development branch. So I am not sure if my issue is same as yours.
-
@slt1 Thanks for the detailed information. If you have enough time would you mind to give a try to https://forum.mysensors.org/topic/4991/mysbootloader-1-3pre2-testing ?
Bootloader link: https://forum.mysensors.org/uploads/files/1475275020003-mysbootloader_v13pre2.zip
-
@jkandasa Using the bootloader in your zip file link I get the same result - around 15 minutes for a 60KB hex sketch file. I used MyController - not MYSController.
Can you please tell me how long it takes you to do an OTA update - the time + hex file size?
-
@slt1 Thanks for the report. I tested on two different nodes. Controller: MyController.org. Gateway MQTT(ESP8266), Radio: NRF24L01+
- 8 MHz internal crystal on the noisy environment: for 47K hex file takes 6 minutes and 42 seconds
- 16 MHz external crystal on clean environment: for 26K hex file takes 36 seconds
Bootloaders I use: https://forum.mysensors.org/uploads/files/1475275020003-mysbootloader_v13pre2.zip
Initial days I face coverage problem with NRF24L01+. I changed my antenna as per this specification, from this point I see notable improvement on coverage.
-
@jkandasa Thank you very much ! That is very helpful. It seems like you are getting excellent update speed.
For my testing of OTA the test sensor node is about 8m away from Gateway.
I am also using MyController.org, Gateway is ESP8266 (Ethernet), Radio NRF24L01+ (PA+LNA 1.1km range like the one shown here)
Current "live" sensor nodes are ...
Gateway (with PA+LNB) <------ 100 to 120m -----> Repeater Node / Pump Control Sensor (with PA+LNB) <-------- 120m to 150m -------> Water Tank Level Sensor (PCB antenna nrf24l01)To get that range it needs good line of sight which luckily I have.
I will look into the antenna mod as well though, so thank you for the tips. I would be very happy if I can get about 1 to 2 minutes for updates on 16Mhz sensors.
-
@jkandasa I tried the modified antenna out and also removed the adapter board for the nrf and soldered a header in close to the arduino pro mini to insert the nrf24l01. And after doing, with all other sensor nodes turned off I can now get around 5 seconds for blink, about 30 seconds for TimeReporter and about 60 seconds for the 60kb custom sketch.
So thank you for the tip on antenna mod. That does help. The major issue I think though was the adapter board for the nrf24l01 - for some reason that was causing lots of pauses in the OTA updates.The tests were all using MYSController - the windows app.
I am having a few strange issues MYController.org. It appears to be getting stuck when doing a few updates in a row and also I can't seem to roll back to a previous version.
-
What adapter were you using?
-
@gohan The manufacturer on the bottom of the board says robotdyn.com - lookinf at their website this is the exact one : http://robotdyn.com/catalog/adaptors/socket_adapter_for_nrf24l01_with_regulator_3_3v/
-
that is missing the decoupling capacitor. Did you solder one yourself?
-
@gohan I soldered a 4.7uF tantulum capacitor directly onto the nrf24L01. Didn't help !
-
did you try a bigger one like 47uF? Or maybe that voltage regulator is just rubbish
-
I use these adaptor boards, I presumed they worked okay, what is missing @gohan, are the capacitors present on other adapter boards do you know? BTW the robotdyn stuff seems very well made but I've actually found their NRF's to perform very poorly.
-
@gohan The regulator is an AMS1117 on the one I got here. I will try them again as they are useful for prototyping. It was working fine for a regular sensor sending updates, but got into the issues when using OTA and trying to get some decent speed of updates going. I also thought perhaps it was a dud unit - so i tried a few others and all gave same results. So perhaps a bigger capacitor will do the trick.
-
I got some adapters on gearbest (there is only one model available) and they have also caps and so far they are working, but haven't stressed them much because my nrf modules are rubbish and I am waiting for some new ones
-
This is my first post in this forum - so hello everyone! And many kudos for all developers and contributors.
I am on my way of building distributed sensors and actuators system for astroimagers, and would love to have OTA firmware update possibility. I use nR24L01 radio and each node will be based on Atmega328 working at internal 8MHz and 3V, and have two questions:- which bootlader hex should I write?
- does MYSbootloader support programming via serial? I tried several hex files with several fuses combinations and never succeeded to program Atmega328P via serial
-
Welcome @jolo !
All you need should be available at https://www.mysensors.org/about/ota
If it isn't, feel free to ask awaySounds like a cool project. Can you share more details?
-
Ok, what I've done so far according to https://www.mysensors.org/about/ota:
- connected USBasp to Arduino Pro Mini and set fuses to 16MHz external oscillator (using AVRDUDESS)
- then tried to upload MYSbootlader using Arduino IDE (versions 1.6.11 and 1.8.1) but it failed with some "cannot set sck period"
- so I uploaded bootloader with AVRDUDESS
Question is - at this stage should I be able to program Arduino Pro Mini with serial programmer, or now it can be done only using OTA? Because I am not able to do it with serial programmer and Arduino IDE.
Burning bootloader with AVRDUDESS works fine because I changed it many times from original to MYSbootlader, also programming Arduino with precompiled sketch works fine.
I will describe my project little bit later, when I will have more nodes working Currently I am on stepper motor controller node.
-
@jolo yes, MYSbootlader supports only ota. No serial.
I have updated the ota page to mention the lack of serial.
-
@mfalkvidd actually looking at the code of mysbootloder, it does support STK500 protocol. I haven't test if it really works...maybe it doesn't.
-
@gonzalonal it did not a while ago according to this, but that might have changed. Maybe @tekka can shed a light?
-
@mfalkvidd The most recent MYSBootloader supports OTA and serial uploads via STK500, see here: https://github.com/mysensors/MySensorsBootloaderRF24/tree/development
-
@tekka thanks.
I did look there, but didn't find anything that I understood was related to serial. I also looked at the list of commit messages but none of them mentions anything about added support.Anyway, thanks for clarifying. I'll update the ota page again.
-
Does that work for both nrf24 and rfm69?
-
Many thanks for help - today I made it work Here are my steps that worked for me:
- I used MYSController 1.0.0 beta, took bootloader MYSBootloaderV13pre.hex and uploaded to Arduino Mini Pro with AVRDUDESS and USBasp programmer
- then uploaded serial gateway sketch to another Mini Pro
- attached nR24L01+ radios to both
- connected MYSController, configured serial connection and all just started to work
- then uploaded simple DHT sketch, edited csv file in MYSController and selected it for OTA FW update
After less than minute new FW was already at the node and it started to send data. I am very happy I played with Arduino projects for several years, but this stuff you have made is absolutely amazing! Now time for some real nodes - first one will be stepper controller for telescope focuser.
-
It still works fine - however I have one more question, maybe stupid About RF channels. I use nR24L01+ radios at default channel 76, however for final solution I would like to switch to some higher freq. Does precompiled bootlader work only at this default channel 76? So if I would like to switch to channel 101 I need to compile bootloader with this setting? Or there is some magic behind that makes it work some other way?
-
@jolo Glad to hear that re RF24 channel: yes, you need to change and recompile the bootloader for different communication settings. See here: https://github.com/mysensors/MySensorsBootloaderRF24/blob/development/MYSBootloader.c#L45-L51
-
Really want to try FOTA with MYSBoatloader but a little bit confused. First - do i have to burn the fuses (i'm using a chinese arduino mini pro 16Mhz) or can simply download MYSBootloader_16MHz.hex from dev brach and i'm good to go?
Another thing - i'm using an MQTT gateway attached to RPi3. Don't really want to change the gateway type - so is there a way to do OTA update? I have a spare UNO which i can connect to a notebook.
-
It was mentioned in a previous thread that mycontroller can do fota also through mqtt
-
@gohan
Excellent.Searched through the thread but couldn't find any mentions how it can be done via mqtt What about the fuses?
-
Just try using mycontroller, the procedure should be the same as the ethernet gateway
-
Yes thank you for the tip! Mycontroller works.
For Mini Pro - no fuses are needed. Just download the hex - rename and flash.
What about the nano?
Looking at boards.txt i see only two difeerencesNano
nano.menu.cpu.atmega328.bootloader.low_fuses=0xFF
nano.menu.cpu.atmega328.bootloader.extended_fuses=0xFDMys
proMYSBL.bootloader.low_fuses=0xF7
proMYSBL.bootloader.extended_fuses=0x06But at the same time PRO mini is same as nano... So can also flash straight away?
-
Nano also doesn't need any fuses. So everything works. Except to begin the flash procedure i have to unplug and plug the node. Is this intended behaviour? Otherwise i only see in MQTT one line of code and no response from node
-
Is the node doing any kind of sleep?
-
No it's powered off mains so no sleep functions added
-
I think you have to issue a reboot node from the mycontroller or myscontroller to have the OTA start
-
@gohan So is it first reboot. Or start flashing - reboot?
-
You assign firmware to upload to node and then you send a reboot, if I remember correctly
-
@moskovskiy82 If you use MyController, Yes, you should assign the firmware for the node and send reboot.
-
@jkandasa Thank you!
One more question. Now need to use a 3,3V arduino Pro (chinese version) (Nano and 5V version flashed via the uno without a hitch)
This is what i put into boards.txt The MYSBootloader_8Mhz.hex is from the dev branch
proMYSBL8.name=ATmega328 8Mhz MYSBootloader proMYSBL8.name=ATmega328 internal 8Mhz with MYSBootloader proMYSBL8.upload.tool=avrdude proMYSBL8.upload.protocol=arduino proMYSBL8.upload.maximum_size=30720 proMYSBL8.upload.maximum_data_size=2048 proMYSBL8.upload.speed=57600 proMYSBL8.bootloader.tool=avrdude proMYSBL8.bootloader.low_fuses=0xE2 proMYSBL8.bootloader.high_fuses=0xDA proMYSBL8.bootloader.extended_fuses=0x06 proMYSBL8.bootloader.unlock_bits=0x3F proMYSBL8.bootloader.lock_bits=0xFF proMYSBL8.bootloader.file=MySensors/MYSBootloader_8Mhz.hex proMYSBL8.build.mcu=atmega328p proMYSBL8.build.f_cpu=8000000L proMYSBL8.build.board=AVR_UNO proMYSBL8.build.core=arduino proMYSBL8.build.variant=standard
Tried to flash the mysbootloader but get the following error
C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -cstk500v1 -PCOM7 -b19200 -e -Ulock:w:0x3F:m -Uefuse:w:0x06:m -Uhfuse:w:0xDA:m -Ulfuse:w:0xE2:m avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/ Copyright (c) 2007-2014 Joerg Wunsch System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf" Using Port : COM7 Using Programmer : stk500v1 Overriding Baud Rate : 19200 AVR Part : ATmega328P Chip Erase delay : 9000 us PAGEL : PD7 BS2 : PC2 RESET disposition : dedicated RETRY pulse : SCK serial program mode : yes parallel program mode : yes Timeout : 200 StabDelay : 100 CmdexeDelay : 25 SyncLoops : 32 ByteDelay : 0 PollIndex : 3 PollValue : 0x53 Memory Detail : Block Poll Page Polled Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xff flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00 hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00 efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00 lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00 calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00 signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00 Programmer Type : STK500 Description : Atmel STK500 Version 1.x firmware Hardware Version: 2 Firmware Version: 1.18 Topcard : Unknown Vtarget : 0.0 V Varef : 0.0 V Oscillator : Off SCK period : 0.1 us avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.03s avrdude: Device signature = 0x1e950f (probably m328p) avrdude: erasing chip avrdude: reading input file "0x3F" avrdude: writing lock (1 bytes): Writing | ################################################## | 100% 0.01s avrdude: 1 bytes of lock written avrdude: verifying lock memory against 0x3F: avrdude: load data lock data from input file 0x3F: avrdude: input file 0x3F contains 1 bytes avrdude: reading on-chip lock data: Reading | ################################################## | 100% 0.01s avrdude: verifying ... avrdude: 1 bytes of lock verified avrdude: reading input file "0x06" avrdude: writing efuse (1 bytes): Writing | ***failed; ################################################## | 100% 0.07s avrdude: 1 bytes of efuse written avrdude: verifying efuse memory against 0x06: avrdude: load data efuse data from input file 0x06: avrdude: input file 0x06 contains 1 bytes avrdude: reading on-chip efuse data: Reading | ################################################## | 100% 0.01s avrdude: verifying ... avrdude: WARNING: invalid value for unused bits in fuse "efuse", should be set to 1 according to datasheet This behaviour is deprecated and will result in an error in future version You probably want to use 0xfe instead of 0x06 (double check with your datasheet first). avrdude: 1 bytes of efuse verified avrdude: reading input file "0xDA" avrdude: writing hfuse (1 bytes): Writing | ################################################## | 100% 0.01s avrdude: 1 bytes of hfuse written avrdude: verifying hfuse memory against 0xDA: avrdude: load data hfuse data from input file 0xDA: avrdude: input file 0xDA contains 1 bytes avrdude: reading on-chip hfuse data: C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -cstk500v1 -PCOM7 -b19200 -Uflash:w:C:\Program Files (x86)\Arduino\hardware\arduino\avr/bootloaders/MySensors/MYSBootloader_8Mhz.hex:i -Ulock:w:0xFF:m avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53 Reading | ################################################## | 100% 0.01s Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/ Copyright (c) 2007-2014 Joerg Wunsch avrdude: verifying ... avrdude: 1 bytes of hfuse verified System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf" avrdude: reading input file "0xE2" avrdude: writing lfuse (1 bytes): Writing | ################################################## | 100% 0.01s avrdude: 1 bytes of lfuse written avrdude: verifying lfuse memory against 0xE2: avrdude: load data lfuse data from input file 0xE2: avrdude: input file 0xE2 contains 1 bytes avrdude: reading on-chip lfuse data: Reading | ################################################## | 100% 0.01s avrdude: verifying ... avrdude: 1 bytes of lfuse verified avrdude done. Thank you. Using Port : COM7 Using Programmer : stk500v1 Overriding Baud Rate : 19200 AVR Part : ATmega328P Chip Erase delay : 9000 us PAGEL : PD7 BS2 : PC2 RESET disposition : dedicated RETRY pulse : SCK serial program mode : yes parallel program mode : yes Timeout : 200 StabDelay : 100 CmdexeDelay : 25 SyncLoops : 32 ByteDelay : 0 PollIndex : 3 PollValue : 0x53 Memory Detail : Block Poll Page Polled Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xff flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00 hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00 efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00 lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00 calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00 signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00 Programmer Type : STK500 Description : Atmel STK500 Version 1.x firmware Hardware Version: 2 Firmware Version: 1.18 Topcard : Unknown Vtarget : 0.0 V Varef : 0.0 V Oscillator : Off SCK period : 0.1 us avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.02s avrdude: Device signature = 0x1e950f (probably m328p) avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed To disable this feature, specify the -D option. avrdude: erasing chip avrdude: reading input file "C:\Program Files (x86)\Arduino\hardware\arduino\avr/bootloaders/MySensors/MYSBootloader_8Mhz.hex" avrdude: writing flash (32754 bytes): Writing | ################################################## | 100% 0.00s avrdude: 32754 bytes of flash written avrdude: verifying flash memory against C:\Program Files (x86)\Arduino\hardware\arduino\avr/bootloaders/MySensors/MYSBootloader_8Mhz.hex: avrdude: load data flash data from input file C:\Program Files (x86)\Arduino\hardware\arduino\avr/bootloaders/MySensors/MYSBootloader_8Mhz.hex: avrdude: input file C:\Program Files (x86)\Arduino\hardware\arduino\avr/bootloaders/MySensors/MYSBootloader_8Mhz.hex contains 32754 bytes avrdude: reading on-chip flash data: Reading | ################################################## | 100% 0.00s avrdude: verifying ... avrdude: verification error, first mismatch at byte 0x7800 0x00 != 0x11 avrdude: verification error; content mismatch avrdude done. Thank you. Error while burning bootloader.
-
@moskovskiy82 My boards.txt specify bootloader.low_fuses=0xF7 as the Arduino being programmed has a crystal on board.
One other thing: I built my own programming board, to support programming ATMega 328p chips and Pro boards in 3.3v@8MHz and 5v@16Mhz... I used a switch and a level converter board to connect the Uno ICSP port to the pins of the Pro.
Uno pins are 5V output, they would burn the input pins of the 3.3v Pro chip, did you account for that ?
-
You can use 5v to program a 3.3v pro mini as the chip is the same, one is only clocked down to 8Mhz in order to be stable at 3.3v
-
@gohan I beg to differ. On Page 299 of Atmel's ATMega 328p datasheet you can verify that the Absolute Maximum Ratings table states : "Voltage on any Pin except RESET with respect to Ground . . . . . . . . . .-0.5V to VCC+0.5V" which adds to 3.8V for a 3.3V Pro.
And also: *NOTICE: Stresses beyond those listed under “Absolute Maximum Ratings” may cause permanent damage to the device.
Perhaps you have mistaken the Pro for the NRF24L01+ radio which is supplied by 3.3v but has 5Volt tolerant inputs ?
Otherwise there would be no need for those USB to FTDI boards with 3v3/5V selection jumpers ...
-
I programmed the pro mini with 5v and it worked. Maybe I was lucky. The 3v ftdi adapter is mandatory for esp8266 for example.
-
@tekka for OSX, the sequencing of flags matters. So, line 45 can be:
$(PROJECT).o: $(PROJECT).c "$(BINPATH)avr-gcc" $(CFLAGS) -I$(INCLUDES) $< -o $@
can be improved to
$(PROJECT).o: $(PROJECT).c "$(BINPATH)avr-gcc" -I$(INCLUDES) $(CFLAGS) $< -o $@
and it all works.
Also, if anyone is getting error for "avr-gcc" not found, then just add the path to avr-gcc in your path.
-
@Bhavin-Doshi Thanks for reporting - could you prepare a PR?
https://github.com/mysensors/MySensorsBootloaderRF24
-
-
@Bhavin-Doshi PR merged. Thank you!
-
@tekka, I am planning to move from MySensors v2.0.0 to v2.1.1, do I need to use the updated MYSBootloader? Currently I am using MYSBootloader 1.3 pre-relase (https://forum.mysensors.org/topic/3453/mysbootloader-1-3-pre-release-myscontroller-1-0-0beta).
Can you please also help me understand the differences in the low_fuses and high_fuses values in the older version of bootloader and the latest version?
-
@nagurao.basude no, you don't need to but the new version has some stability improvements. The fuse differences are to better match HW (osc type) & clearing eeprom.
AVR fuse calculator: http://www.engbedded.com/fusecalc/
-
Hello, has someone used the 1MHz precompiled bootloader ? If yes what baud rate did you use to communicate via serial ?
I flashed it on a node but I can't upload any script ("not in sync" error). If I believe HW.h it should be 9600 bauds but I have tried hat and nearly every baudrate with no luck.
I had no problem using the 8MHz version.The only way I could use the 1MHz bootloader at the moment is to flash the hex file containing both bootloader and script.
Sorry to ask this stupid question, I wanted to compile the bootloader but Internet connection is nearly down and I can't even download Atmel Studio