MYSBootloader 1.3.0-beta.3



  • @tekka
    NRF24L01+
    #define MY_RADIO_NRF24

    What is the "no signs of MYSBootloader"?


  • Admin

    @Werwolfx As soon as the bootloader takes over, in your case after the reboot request (1), but before the MYS lib 2.1.0 init message (2):

    (1) 14.01.2017 11:38:03 TX  4;0;3;0;13;0
    (2) 14.01.2017 11:38:09 RX  4;255;0;0;17;2.1.0
    

    it will send a I_FIRMWARE_CONFIG_REQUEST message to inform the controller about the currently loaded FW and request a new FW.

    looks like this:

    4;255;4;0;0;BE0001003003D8490102
    

    This is missing in your case, therefore I'm wondering if you have incompatible radio settings. Please post your GW sketch and upload your MYSBootloader.hex file for further troubleshooting.



  • @tekka GW on esp8266 (default sketch) + NRF24L01+
    on GW

    /**
     * The MySensors Arduino library handles the wireless radio link and protocol
     * between your home built sensors/actuators and HA controller of choice.
     * The sensors forms a self healing radio network with optional repeaters. Each
     * repeater and gateway builds a routing tables in EEPROM which keeps track of the
     * network topology allowing messages to be routed to nodes.
     *
     * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
     * Copyright (C) 2013-2015 Sensnology AB
     * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
     *
     * Documentation: http://www.mysensors.org
     * Support Forum: http://forum.mysensors.org
     *
     * This program is free software; you can redistribute it and/or
     * modify it under the terms of the GNU General Public License
     * version 2 as published by the Free Software Foundation.
     *
     *******************************
     *
     * REVISION HISTORY
     * Version 1.0 - Henrik EKblad
     * Contribution by a-lurker and Anticimex,
     * Contribution by Norbert Truchsess <norbert.truchsess@t-online.de>
     * Contribution by Ivo Pullens (ESP8266 support)
     *
     * DESCRIPTION
     * The EthernetGateway sends data received from sensors to the WiFi link.
     * The gateway also accepts input on ethernet interface, which is then sent out to the radio network.
     *
     * VERA CONFIGURATION:
     * Enter "ip-number:port" in the ip-field of the Arduino GW device. This will temporarily override any serial configuration for the Vera plugin.
     * E.g. If you want to use the defualt values in this sketch enter: 192.168.178.66:5003
     *
     * LED purposes:
     * - To use the feature, uncomment any of the MY_DEFAULT_xx_LED_PINs in your sketch, only the LEDs that is defined is used.
     * - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
     * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
     * - ERR (red) - fast blink on error during transmission error or recieve crc error
     *
     * See http://www.mysensors.org/build/esp8266_gateway for wiring instructions.
     * nRF24L01+  ESP8266
     * VCC        VCC
     * CE         GPIO4
     * CSN/CS     GPIO15
     * SCK        GPIO14
     * MISO       GPIO12
     * MOSI       GPIO13
     * GND        GND
     *
     * Not all ESP8266 modules have all pins available on their external interface.
     * This code has been tested on an ESP-12 module.
     * The ESP8266 requires a certain pin configuration to download code, and another one to run code:
     * - Connect REST (reset) via 10K pullup resistor to VCC, and via switch to GND ('reset switch')
     * - Connect GPIO15 via 10K pulldown resistor to GND
     * - Connect CH_PD via 10K resistor to VCC
     * - Connect GPIO2 via 10K resistor to VCC
     * - Connect GPIO0 via 10K resistor to VCC, and via switch to GND ('bootload switch')
     *
      * Inclusion mode button:
     * - Connect GPIO5 via switch to GND ('inclusion switch')
     *
     * Hardware SHA204 signing is currently not supported!
     *
     * Make sure to fill in your ssid and WiFi password below for ssid & pass.
     */
    
    
    // Enable debug prints to serial monitor
    #define MY_DEBUG
    
    // Use a bit lower baudrate for serial prints on ESP8266 than default in MyConfig.h
    #define MY_BAUD_RATE 115200
    
    // Enables and select radio type (if attached)
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    
    #define MY_GATEWAY_ESP8266
    
    #define MY_ESP8266_SSID "WiFI"
    #define MY_ESP8266_PASSWORD "password[0_1484386469111_MYSBootloader.hex](/uploads/files/1484386469171-mysbootloader.hex) "
    
    // Enable UDP communication
    //#define MY_USE_UDP
    
    // Set the hostname for the WiFi Client. This is the hostname
    // it will pass to the DHCP server if not static.
    // #define MY_ESP8266_HOSTNAME "sensor-gateway"
    
    // Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
    //#define MY_IP_ADDRESS 192,168,178,87
    
    // If using static ip you need to define Gateway and Subnet address as well
    //#define MY_IP_GATEWAY_ADDRESS 192,168,178,1
    //#define MY_IP_SUBNET_ADDRESS 255,255,255,0
    
    // The port to keep open on node server mode
    #define MY_PORT 5003
    
    // How many clients should be able to connect to this gateway (default 1)
    #define MY_GATEWAY_MAX_CLIENTS 2
    
    // Controller ip address. Enables client mode (default is "server" mode).
    // Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere.
    //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 68
    
    // Enable inclusion mode
    #define MY_INCLUSION_MODE_FEATURE
    
    // Enable Inclusion mode button on gateway
    // #define MY_INCLUSION_BUTTON_FEATURE
    // Set inclusion mode duration (in seconds)
    #define MY_INCLUSION_MODE_DURATION 60
    // Digital pin used for inclusion mode button
    #define MY_INCLUSION_MODE_BUTTON_PIN  3
    
    
    // Set blinking period
    // #define MY_DEFAULT_LED_BLINK_PERIOD 300
    
    // Flash leds on rx/tx/err
    // Led pins used if blinking feature is enabled above
    #define MY_DEFAULT_ERR_LED_PIN 16  // Error led pin
    #define MY_DEFAULT_RX_LED_PIN  16  // Receive led pin
    #define MY_DEFAULT_TX_LED_PIN  16  // the PCB, on board LED
    
    #if defined(MY_USE_UDP)
      #include <WiFiUdp.h>
    #endif
    
    #include <ESP8266WiFi.h>
    
    #include <MySensors.h>
    
    void setup() {
    }
    
    void presentation() {
      // Present locally attached sensors here
    }
    
    
    void loop() {
      // Send locally attached sensors data here
    }
    

    In MYSController on mudule i click INFO
    FW Update = no
    Bootloader = N/A

    may be problem in the Bootloader.hex?

    0_1484386859986_upload-c59e469e-e015-4099-88d8-607a7408a1da


  • Admin

    @Werwolfx Please also update the bootloader file.



  • @tekka said:

    @Werwolfx Please also update the bootloader file.

    I'll update more than once, but there is no effect.
    avrdude writes that everything is OK
    I do not know what to do = (

    avrdude: AVR device initialized and ready to accept instructions
    
    Reading | ################################################## | 100% 0.00s
    
    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: auto set sck period (because given equals null)
    avrdude: warning: cannot set sck period. please check for usbasp firmware update.
    avrdude: reading input file "/media/werwolfx/SSDData/arduino-1.8.0/hardware/arduino/avr/bootloaders/MySensors/MYSBootloader.hex"
    avrdude: writing flash (32762 bytes):
    
    Writing | ################################################## | 100% 0.00s
    
    avrdude: 32762 bytes of flash written
    avrdude: verifying flash memory against /media/werwolfx/SSDData/arduino-1.8.0/hardware/arduino/avr/bootloaders/MySensors/MYSBootloader.hex:
    avrdude: load data flash data from input file /media/werwolfx/SSDData/arduino-1.8.0/hardware/arduino/avr/bootloaders/MySensors/MYSBootloader.hex:
    avrdude: input file /media/werwolfx/SSDData/arduino-1.8.0/hardware/arduino/avr/bootloaders/MySensors/MYSBootloader.hex contains 32762 bytes
    avrdude: reading on-chip flash data:
    
    Reading | ################################################## | 100% 0.00s
    
    avrdude: verifying ...
    avrdude: 32762 bytes of flash verified
    avrdude: reading input file "0x0F"
    avrdude: writing lock (1 bytes):
    
    Writing | ################################################## | 100% 0.01s
    
    avrdude: 1 bytes of lock written
    avrdude: verifying lock memory against 0x0F:
    avrdude: load data lock data from input file 0x0F:
    avrdude: input file 0x0F contains 1 bytes
    avrdude: reading on-chip lock data:
    
    Reading | ################################################## | 100% 0.00s
    
    avrdude: verifying ...
    avrdude: 1 bytes of lock verified
    
    avrdude done.  Thank you.
    
    

  • Admin

    @Werwolfx sorry, maybe I was not clear - please upload it here to the forum I will try to reproduce your setup.



  • @tekka If i ENABLE #define MY_OTA_FIRMWARE_FEATURE
    i see ST_FIRMWARE_CONFIG_REQUEST in MYSCONTROLLER logs!!!
    if i DISABLE //#define MY_OTA_FIRMWARE_FEATURE msg not in log

    i not have external flash/

    402	14.01.2017 21:29:28	TX	4 - Water Meter	N/A	C_INTERNAL	NO	I_REBOOT	0
    403	14.01.2017 21:29:28	RX	4	1	C_REQ	NO	V_VAR1	
    408	14.01.2017 21:29:34	RX	4	INTERNAL	C_STREAM	NO	ST_FIRMWARE_CONFIG_REQUEST	FFFFFFFF48044E100300
    409	14.01.2017 21:29:34	TX	4	N/A	C_STREAM	NO	ST_FIRMWARE_CONFIG_RESPONSE	0A0001005000D446
    410	14.01.2017 21:29:34	RX	4	INTERNAL	C_PRESENTATION	NO	S_ARDUINO_NODE	2.1.0
    411	14.01.2017 21:29:34	RX	4	INTERNAL	C_INTERNAL	NO	I_CONFIG	0
    412	14.01.2017 21:29:34	TX	4	INTERNAL	C_INTERNAL	NO	I_CONFIG	M
    414	14.01.2017 21:29:34	RX	4 - Water Meter	INTERNAL	C_INTERNAL	NO	I_SKETCH_NAME	Water Meter
    417	14.01.2017 21:29:34	RX	4 - Water Meter	INTERNAL	C_INTERNAL	NO	I_SKETCH_VERSION	1.1
    419	14.01.2017 21:29:34	RX	4 - Water Meter	1 - S_WATER	C_PRESENTATION	NO	S_WATER	
    

    i load this HEX
    load from Arduino IDE 1.8.0
    0_1484418874223_MYSBootloader.hex

    board.txt

    proMYSBL.bootloader.tool=avrdude
    proMYSBL.bootloader.low_fuses=0xFF
    proMYSBL.bootloader.high_fuses=0xDA
    proMYSBL.bootloader.extended_fuses=0xFE
    proMYSBL.bootloader.unlock_bits=0x3F
    proMYSBL.bootloader.lock_bits=0x0F
    proMYSBL.bootloader.file=MySensors/MYSBootloader.hex


  • Admin

    @Werwolfx Ok, seems like you also upload the sketch via USBasp thereby erasing/overwriting the bootloader. Try uploading the sketch via serial or OTA after flashing the bootloader.



  • @tekka am I correct in thinking the HEX found on Github can be used with all Arduino's? I noticed my old folder has one hex for 16, 8 and 1Mhz?

    I'm using this board.txt

    menu.cpu=Processor
    
    ##############################################################
    
    MYSBL13.name=MYS Bootloader - atmega328p
    
    MYSBL13.upload.tool=arduino:avrdude
    MYSBL13.upload.protocol=arduino
    MYSBL13.upload.maximum_size=30720
    MYSBL13.upload.maximum_data_size=2048
    
    MYSBL13.bootloader.tool=arduino:avrdude
    MYSBL13.bootloader.unlock_bits=0x3F
    MYSBL13.bootloader.lock_bits=0x0F
    
    MYSBL13.build.mcu=atmega328p
    MYSBL13.build.board=AVR_PRO
    MYSBL13.build.core=arduino:arduino
    MYSBL13.build.variant=arduino:standard
    
    ## -------------------------------------------------
    
    MYSBL13.menu.cpu.16MHzatmega328=ATmega328 16MHz (XTAL, BOD1V8)
    MYSBL13.menu.cpu.16MHzatmega328.upload.speed=115200
    MYSBL13.menu.cpu.16MHzatmega328.bootloader.low_fuses=0xFF
    MYSBL13.menu.cpu.16MHzatmega328.bootloader.high_fuses=0xDA
    MYSBL13.menu.cpu.16MHzatmega328.bootloader.extended_fuses=0x06
    MYSBL13.menu.cpu.16MHzatmega328.bootloader.file=MYSBootloader/MYSBootloader.hex
    MYSBL13.menu.cpu.16MHzatmega328.build.f_cpu=16000000L
    
    MYSBL13.menu.cpu.8MHzatmega328=ATmega328 8MHz (RC, BOD1V8)
    MYSBL13.menu.cpu.8MHzatmega328.upload.speed=38400
    MYSBL13.menu.cpu.8MHzatmega328.bootloader.low_fuses=0xE2
    MYSBL13.menu.cpu.8MHzatmega328.bootloader.high_fuses=0xDA
    MYSBL13.menu.cpu.8MHzatmega328.bootloader.extended_fuses=0x06
    MYSBL13.menu.cpu.8MHzatmega328.bootloader.file=MYSBootloader/MYSBootloader.hex
    MYSBL13.menu.cpu.8MHzatmega328.build.f_cpu=8000000L
    
    MYSBL13.menu.cpu.1MHzatmega328=ATmega328 1MHz (RC/8, BOD1V8)
    MYSBL13.menu.cpu.1MHzatmega328.upload.speed=9600
    MYSBL13.menu.cpu.1MHzatmega328.bootloader.low_fuses=0x62
    MYSBL13.menu.cpu.1MHzatmega328.bootloader.high_fuses=0xDA
    MYSBL13.menu.cpu.1MHzatmega328.bootloader.extended_fuses=0x06
    MYSBL13.menu.cpu.1MHzatmega328.bootloader.file=MYSBootloader/MYSBootloader.hex
    MYSBL13.menu.cpu.1MHzatmega328.build.f_cpu=1000000L```


  • I guess not... The old hex for 8Mhz works, but the one from this thread does not... 😞

    I'm trying to upload this to my Pro Mini, does anyone have an 8Mhz that works?



  • @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?


  • Admin

    @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?


  • Admin

    @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 1

    When issueing the Make command, can you help, any suggestions?


  • Admin

    @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
    

  • Admin

    @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.

    1. Installed Windows 7
    2. Installed mingw (core and c++ compiler)
    3. Installed Arduino IDE and MySensors library (Installed at the same location as you, at c drive root)
    4. Downloaded bootloader from github
    5. Edited the fuses and clock speed at the top of the makefile to match my boards.txt
    6. Ran makefile from cmd

  • Admin

    @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?


  • Admin

    @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:

    http://www.engbedded.com/fusecalc/



  • 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?



  • @tekka

    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?

    0_1485283480870_Schermata 2017-01-24 alle 19.43.36.png

    Is there anything I'm missing to have these features working?

    Thanks in advance


  • Admin

    @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?


  • Admin

    @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.


  • Mod

    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:

    1. Should the clearing eeprom function in MYSBootloader be working?
    2. 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?

  • Admin

    @andreground said in MYSBootloader 1.3.0-beta.3:

    @tekka thanks, it works.

    2 more questions:

    1. 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)

    1. 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).



  • @tekka

    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!


  • Plugin Developer

    @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.


  • Hardware Contributor

    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


  • Admin

    @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


  • Admin

    @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=0x32

    Thanks 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


  • Admin

    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?


  • Mod

    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.


  • Mod

    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?


  • Mod

    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.


  • Mod

    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


  • Mod

    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


  • Plugin Developer

    @slt1 If you are using wait() to repeat some function. I recommend using http://playground.arduino.cc/Code/SimpleTimer, to avoid complete blocking when executing wait().



  • @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


  • Plugin Developer

    @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.


  • Plugin Developer

    @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?


  • Plugin Developer

    @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.


  • Mod

    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/


  • Mod

    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 !


  • Mod

    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.


  • Mod

    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 😞

  • Mod

    Welcome @jolo !

    All you need should be available at https://www.mysensors.org/about/ota
    If it isn't, feel free to ask away 🙂

    Sounds 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.

  • Mod

    @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.


  • Mod

    @gonzalonal it did not a while ago according to this, but that might have changed. Maybe @tekka can shed a light?


  • Admin

    @mfalkvidd The most recent MYSBootloader supports OTA and serial uploads via STK500, see here: https://github.com/mysensors/MySensorsBootloaderRF24/tree/development


  • Mod

    @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.


  • Mod

    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.

    0_1501268069710_mysboot.jpg
    0_1501268078807_mysboot2.jpg



  • 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?


  • Admin

    @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.


  • Mod

    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?


  • Mod

    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 difeerences

    Nano
    nano.menu.cpu.atmega328.bootloader.low_fuses=0xFF
    nano.menu.cpu.atmega328.bootloader.extended_fuses=0xFD

    Mys
    proMYSBL.bootloader.low_fuses=0xF7
    proMYSBL.bootloader.extended_fuses=0x06

    But 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


  • Mod

    Is the node doing any kind of sleep?



  • No it's powered off mains so no sleep functions added


  • Mod

    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?


  • Mod

    You assign firmware to upload to node and then you send a reboot, if I remember correctly


  • Plugin Developer

    @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 ?


Log in to reply
 

Suggested Topics

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts