πŸ’¬ FOTA (Wireless Programming)


  • Mod

    @hiddenuser https://www.mysensors.org/about/ota
    Then I suggest you configure the gateway as an ethernet gateway and use myscontroller to assign the firmware to the nodes



  • It's not quite clear for my how to use MYSBootloader for OTA. I'm running Domoticz as a controller (on RPI) and my gateway also is running on RPI (NRF on GPIO). Should have I one more arduino gateway connected to Windows machine running MYSController? As far I know there could be only one gateway in mysensors network.


  • Mod

    You just connect myscontroller to the gateway running on the RPI if it is configured as ethernet



  • I installed mycontroller.org for this purpose (OTA updates).

    I have a MQTT gateway running on a NodeMCU, which connects to my MQTT server (mosquitto running on a ubuntu server) via wifi. This setup works very well, and I don't have to keep anything running on my desktop machine (which is a windows 10 box) while the OTA updates are being pushed out (which takes ages, since they are running on battery and only wake up once every few hours).



  • @maghac said in πŸ’¬ Wireless Programming:

    updates a

    lately I was also tinkering with the OTA updates. I'm using RPI as a gateway and controller at the same time. I'm using MQTT gateway and the controller software is OpenHAB. As I studied the documentation about OTA I learned that it is not working with MQTT gateway. Can You explain how to setup OTA with MQTT gateway ? For now I have to kill the MQTT gateway process and launch serial gateway with virtual serial port which in turn has to be shared through the network with the ser2net to be able to use it with mycontroller running on my desktop.





  • Not sure what I am doing wrong here,... I followed the instructions for bootloader MYSController using an 'Arduino as ISP',... now when trying eg. the Blink sketch, I see that it takes about 10 seconds before it starts and after some 'blinks' it seems to miss some 'blinks',... any suggestions what might be wrong? The normal optiboot seems to work fine...



  • I just enabled OTA on a non-sleeping node - it doesn't call smartSleep() and the loop function is mostly empty (except for sending one initial message). I do have a receive() function since I need to respond to incoming messages.

    How can I properly enable OTA in this kind of node? Sending the "New firmware" command in MyController sends the message which gets caught by receive() and just gives me an error message since it's not one of the message types I expect. Telling the node to reboot sends it into some sort of endless loop which I cannot break unless I kill power to the board.


  • Mod



  • @gohan Thanks. I seem to have the same issue and I'm also using a 5V pro mini, although I actually am using the MYSBootloader.



  • I am having problems flashing a new bootloader on a 5V 16Mhz Pro Mini board. Or rather. the flashing is fine, it's just that I cannot upload a new sketch via FTDI afterwards.

    Here are my custom entries from boards.txt:

    ## Arduino Pro or Pro Mini (3V3 & 5V, 16 MHz) w/ ATmega328 MYSBootloader
    ## -------------------------------------------------
    
    
    proMYSBL.name=ATmega328 16Mhz MYSBootloader 1.3 beta 
    
    proMYSBL.upload.tool=avrdude
    proMYSBL.upload.protocol=arduino
    proMYSBL.upload.maximum_size=30720
    proMYSBL.upload.maximum_data_size=2048
    proMYSBL.upload.speed=115200
    
    proMYSBL.bootloader.tool=avrdude
    proMYSBL.bootloader.low_fuses=0xF7
    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
    
    proMYSBL.build.mcu=atmega328p
    proMYSBL.build.f_cpu=16000000L
    proMYSBL.build.board=AVR_UNO
    proMYSBL.build.core=arduino
    proMYSBL.build.variant=standard
    
    ## Arduino Pro or Pro Mini (3V3 & 5V, 16 MHz) w/ ATmega328 MYSBootloader
    ## -------------------------------------------------
    
    
    proMYSBL16.name=ATmega328 16Mhz MYSBootloader 1.3 beta DEV
    
    proMYSBL16.upload.tool=avrdude
    proMYSBL16.upload.protocol=arduino
    proMYSBL16.upload.maximum_size=30720
    proMYSBL16.upload.maximum_data_size=2048
    proMYSBL16.upload.speed=57600
    
    proMYSBL16.bootloader.tool=avrdude
    proMYSBL16.bootloader.low_fuses=0xF7
    proMYSBL16.bootloader.high_fuses=0xDA
    proMYSBL16.bootloader.extended_fuses=0xFD
    proMYSBL16.bootloader.unlock_bits=0x3F
    proMYSBL16.bootloader.lock_bits=0x0F
    proMYSBL16.bootloader.file=MySensors/MYSBootloader_16MHz.hex
    
    proMYSBL16.build.mcu=atmega328p
    proMYSBL16.build.f_cpu=16000000L
    proMYSBL16.build.board=AVR_UNO
    proMYSBL16.build.core=arduino
    proMYSBL16.build.variant=standard
    
    
    ## Arduino Pro or Pro Mini (3V3 & 5V, 8 MHz) w/ ATmega328 MYSBootloader
    ## -------------------------------------------------
    
    
    proMYSBL8.name=ATmega328 8Mhz MYSBootloader 1.3 beta DEV
    
    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=0xD2
    proMYSBL8.bootloader.extended_fuses=0xFE
    proMYSBL8.bootloader.unlock_bits=0x3F
    proMYSBL8.bootloader.lock_bits=0x3F
    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
    
    

    MYSBootloader.hex is from the master branch of MYSBootloader 1.3.0-beta.3, the other two are from the development branch.

    Doesn't matter which one I use, I can never get my 5V 16MHz boards to accept a new sketch via FTDI cable. I have to go back to the standard Pro Mini bootloader.


  • Mod

    @maghac why don't you use the ota feature?



  • @gohan Good question πŸ™‚

    I was afraid it would get stuck in a neverending loop and I would have to cycle power to the board, but actually OTA programming with mycontroller works fine.

    The problem is that OTA uploades takes around 10 mins, which is annoying if I want to test something while I have the node on my desk, before placing it somewhere in my house. So while I anyway have it on the desk, I'd like to use the FTDI cable.

    Anyway, things seem to work fine now πŸ™‚



  • Is it possible to do FOTA from my raspberry pi (serial gateway + domoticz)?

    As it is now I move the gateway from the rpi to a windows pc running MYSController. It would be nice to avoid this step.



  • @arraWX you can create a Ethernet gateway in raspberry pi and connect MYScontroller to you raspberry pi gateway.
    See instructions to create raspberrypi ethernet gateway on https://www.mysensors.org/build/raspberry
    From there you can perform FOTA in MYScontroller.



  • @Viciousman Thank you!

    How do I create a Ethernet gateway?

    Will I have to build this: https://www.mysensors.org/build/ethernet_gateway

    or

    Will I have to do some kind of configuration on the rpi and continue using my serial gateway?



  • @arraWX I find more simple to simply connect nrf24 to raspberry pi as instructed in https://www.mysensors.org/build/raspberry
    But you can also build the Ethernet gateway with W5100.



  • Dear all!

    I have an mysensors ethernet gateway and nodes with nrf24 . I have an openhab2 controller. Could i use the above solution to program my nodes over the air through my current gateway? So i write my sketch on windows arduino and send it through my gateway to the node? Or i have to connect my computer direct to nodes over air?


  • Mod

    You can use myscontroller to connect to the ethernet gateway and assign the firmware to upload for each node



  • Dear @gohan

    Thank you! Superb!



  • @gohan , Thanks for this idea... I am going to try this with a serial gateway instead. Do you perceive a problem? Will this work only with an ethernet gw?


  • Mod

    Myscontroller works only as ethernet. Mycontroller should also work with mqtt gateway but I'm not sure about serial.



  • @gohan Ook! Are you talking about installing MysController on Raspberrypi (I think not)? If you are going to run it on Windows and connect to Raspi Ethernet gateway remotely then using the the same option we can remotely connect to a serially connected gateway on Raspberrypi (using a USB port) from MysController running on Windows.

    Are there steps somewhere to install MysController on Raspi [some Windows pre-installer running on Debian Linux]? I remember reading some Mysensors posts here a couple of years back(!!!), but cant seem to locate it now...


  • Mod

    MyScontroller is a windows application.
    MyController is a controller that you can install anywhere. I personally try to avoid the usb gateways because of the limitations.


  • Hardware Contributor

    @scalz do you have any specific reason why you use avrdudes to burn the fuses and burn bootloader separately, instead of using some board definitions matching the bootloader and using the burn bootloader method for Arduino interface ? I think that method is far more user intuitive for the average MySensors user ?


  • Hardware Contributor

    @Nca78 just old school habit πŸ˜‰ I think in the video both ways are explained. But I'll take a look at the howto to make it simpler, agree.

    thx for reminding me!



  • Using FOTA in myscontroller works only occasionally for me. Sometimes it works fine. But most often I get the following messages and nothing more happens.

    0_1512991929867_Udklip.PNG

    The node is a sensebender micro. Gateway is rpi ethernet.

    Has anyone experienced something similar? Anyone knows how to solve the problem?

    EDIT: Problem solved. Reading this post I now understand that in order to get new fw into the node one has to update the sketch, refresh the repo in MysController and assign it the node.


  • Mod

    Once I managed to burn the sensbender micro bootloader to the pro mini, how do I connect the external flash? Just connect it to pins D10 to D13? Is this the correct way of managing the fota in the sketch before the sleep?



  • @gohan I recently had some problems with fota and the sensebender sketch you refer to. In this thread @tekka suggested me to enable smart sleep. I used

    smartSleep(MEASURE_INTERVAL);
    

    It seems that the smartSleep function has a "built in" MY_SMART_SLEEP_WAIT_DURATION_MS (which defaults to 500 ms). This makes the OTA_WAIT_PERIOD in the sensebender sketch redundant. I deleted it from the sketch.

    FOTA now works successfully with my sensebender boards.


  • Mod

    I am still in the build phase, I still have to understand how to connect the flash and what to do in the code; also I need to find how to test if everything is is correct


  • Plugin Developer

    @gohan, Yes, MyController works with Serial, Ethernet, and MQTT as well.


  • Mod

    @jkandasa I know that but I don't know how to work with the flash chip at the moment



  • Hi guys! I burned mysbootloader but now rs485 doesn't work.. It's normal situation ? A would like to know if is possible to remote upload firmware via rs485 instead of radio. Thanks! Luca


  • Mod

    Mysbootloader doesn't support rs485, you probably need to use the dual optiboot but I haven't heard anyone trying it


  • Mod

    I think I managed to get the flash properly wired and using myscontroller I was able to assign a FW and it started to transfer the new FW as soon as the node was available but at the end I get this failure on the node dedug

    151898 OTA:FRQ:FW REQ,T=0078,V=0001,B=0316
    151918 TSF:MSG:SEND,16-16-0-0,s=255,c=4,t=2,pt=6,l=6,sg=0,ft=0,st=OK:780001001603
    151971 TSF:MSG:READ,0-0-16,s=255,c=4,t=3,pt=6,l=22,sg=0:780001001603909369058091690585FB882780F98F25
    151984 OTA:FWP:RECV B=0316
    151986 OTA:FRQ:FW REQ,T=0078,V=0001,B=0315
    152006 TSF:MSG:SEND,16-16-0-0,s=255,c=4,t=2,pt=6,l=6,sg=0,ft=0,st=OK:780001001503
    152070 TSF:MSG:READ,0-0-16,s=255,c=4,t=3,pt=6,l=22,sg=0:780001001503280586FB882780F99091690580FB95F9
    152082 OTA:FWP:RECV B=0315
    152084 OTA:FRQ:FW REQ,T=0078,V=0001,B=0314
    152104 TSF:MSG:SEND,16-16-0-0,s=255,c=4,t=2,pt=6,l=6,sg=0,ft=0,st=OK:780001001403
    152586 OTA:FRQ:FW REQ,T=0078,V=0001,B=0314
    152606 TSF:MSG:SEND,16-16-0-0,s=255,c=4,t=2,pt=6,l=6,sg=0,ft=0,st=OK:780001001403
    153088 OTA:FRQ:FW REQ,T=0078,V=0001,B=0314
    153110 TSF:MSG:SEND,16-16-0-0,s=255,c=4,t=2,pt=6,l=6,sg=0,ft=0,st=OK:780001001403
    153589 OTA:FRQ:FW REQ,T=0078,V=0001,B=0314
    153612 TSF:MSG:SEND,16-16-0-0,s=255,c=4,t=2,pt=6,l=6,sg=0,ft=0,st=OK:780001001403
    154091 OTA:FRQ:FW REQ,T=0078,V=0001,B=0314
    154345 TSF:MSG:SEND,16-16-0-0,s=255,c=4,t=2,pt=6,l=6,sg=0,ft=0,st=OK:780001001403
    154593 OTA:FRQ:FW REQ,T=0078,V=0001,B=0314
    154613 TSF:MSG:SEND,16-16-0-0,s=255,c=4,t=2,pt=6,l=6,sg=0,ft=0,st=OK:780001001403
    155095 !OTA:FRQ:FW UPD FAIL
    165586 TSF:MSG:READ,0-0-16,s=255,c=4,t=3,pt=6,l=22,sg=0:7800010014032405C550C13408F0C0E4C09364058091
    165597 !OTA:FWP:NO UPDATE
    165849 TSF:MSG:READ,0-0-16,s=255,c=4,t=3,pt=6,l=22,sg=0:7800010014032405C550C13408F0C0E4C09364058091
    165859 !OTA:FWP:NO UPDATE
    165873 TSF:MSG:READ,0-0-16,s=255,c=4,t=3,pt=6,l=22,sg=0:7800010014032405C550C13408F0C0E4C09364058091
    165883 !OTA:FWP:NO UPDATE
    165896 TSF:MSG:READ,0-0-16,s=255,c=4,t=3,pt=6,l=22,sg=0:7800010014032405C550C13408F0C0E4C09364058091
    165906 !OTA:FWP:NO UPDATE
    165918 TSF:MSG:READ,0-0-16,s=255,c=4,t=3,pt=6,l=22,sg=0:7800010014032405C550C13408F0C0E4C09364058091
    165931 !OTA:FWP:NO UPDATE
    165943 TSF:MSG:READ,0-0-16,s=255,c=4,t=3,pt=6,l=22,sg=0:7800010014032405C550C13408F0C0E4C09364058091
    165953 !OTA:FWP:NO UPDATE
    

    After this the node goes silent and I have to reset it to get it back. Log parser isn't helping much. Any idea where I can look ?


  • Mod

    It must have been a problem with myscontroller since after I tried mycontroller the firmware update was successful. Tomorrow I'll do some more tests. The only issue I found is the upload time that it took 7/8 min to upload using rfm69 433mhz


  • Mod

    great, now it is no longer working
    I am getting a series of messages like this

    OTA:FRQ:FW REQ,T=0001,V=0002,B=059A
    !TSF:MSG:SEND,16-16-0-0,s=255,c=4,t=2,pt=6,l=6,sg=0,ft=0,st=NACK:010002009A05
    TSF:MSG:READ,0-0-16,s=255,c=4,t=3,pt=6,l=22,sg=0:010002009B0509F4A140A6958FEF811D811D08950E94
    OTA:FWP:RECV B=059B
    !OTA:FWP:WRONG FWB
    

    and a failed update at the end. I am going to need some help

    I ran the GW debug and I am seeing a buch of NACK even if the node is 2 meters away from the GW

    mysgw: TSF:MSG:SEND,0-0-16-16,s=255,c=4,t=3,pt=6,l=22,sg=0,ft=0,st=OK:010002005805B082F701822F90E2882319F091938150
    mysgw: TSF:MSG:READ,16-16-0,s=255,c=4,t=2,pt=6,l=6,sg=0:010002005705
    mysgw: TSF:MSG:SEND,0-0-16-16,s=255,c=4,t=3,pt=6,l=22,sg=0,ft=0,st=OK:01000200570520F4353321F4A11002C081E3B82EF601
    mysgw: TSF:MSG:READ,16-16-0,s=255,c=4,t=2,pt=6,l=6,sg=0:010002005605
    mysgw: TSF:MSG:SEND,0-0-16-16,s=255,c=4,t=3,pt=6,l=22,sg=0,ft=0,st=OK:010002005605D601BC926C01D5CF6417750741F43633
    mysgw: TSF:MSG:READ,16-16-0,s=255,c=4,t=2,pt=6,l=6,sg=0:010002005505
    mysgw: TSF:MSG:SEND,0-0-16-16,s=255,c=4,t=3,pt=6,l=22,sg=0,ft=0,st=OK:01000200550571093196C60101967C016017710724F0
    mysgw: TSF:MSG:READ,16-16-0,s=255,c=4,t=2,pt=6,l=6,sg=0:010002005405
    mysgw: !TSF:MSG:SEND,0-0-16-16,s=255,c=4,t=3,pt=6,l=22,sg=0,ft=0,st=NACK:010002005405FB1ED7011196BC9002C090E3B92E6150
    mysgw: TSF:MSG:READ,16-16-0,s=255,c=4,t=2,pt=6,l=6,sg=0:010002005305
    mysgw: TSF:MSG:READ,16-16-0,s=255,c=4,t=2,pt=6,l=6,sg=0:010002005305
    mysgw: TSF:MSG:SEND,0-0-16-16,s=255,c=4,t=3,pt=6,l=22,sg=0,ft=0,st=OK:0100020053057F01E40CF51CA1E0B0E0AC0FBD1FEA0E
    mysgw: !TSF:MSG:SEND,0-0-16-16,s=255,c=4,t=3,pt=6,l=22,sg=0,ft=0,st=NACK:0100020053057F01E40CF51CA1E0B0E0AC0FBD1FEA0E
    mysgw: TSF:MSG:READ,16-16-0,s=255,c=4,t=2,pt=6,l=6,sg=0:010002005205
    mysgw: !TSF:MSG:SEND,0-0-16-16,s=255,c=4,t=3,pt=6,l=22,sg=0,ft=0,st=NACK:01000200520501966C014617570784F0661677066CF4
    mysgw: TSF:MSG:READ,16-16-0,s=255,c=4,t=2,pt=6,l=6,sg=0:010002005105
    mysgw: !TSF:MSG:SEND,0-0-16-16,s=255,c=4,t=3,pt=6,l=22,sg=0,ft=0,st=NACK:01000200510511096F3F8FEF780729F4D6019C92C601
    mysgw: TSF:MSG:READ,16-16-0,s=255,c=4,t=2,pt=6,l=6,sg=0:010002005005
    mysgw: !TSF:MSG:SEND,0-0-16-16,s=255,c=4,t=3,pt=6,l=22,sg=0,ft=0,st=NACK:01000200500571082A01461A570A0B2D10E011950195
    mysgw: TSF:MSG:READ,16-16-0,s=255,c=4,t=2,pt=6,l=6,sg=0:010002004F05
    mysgw: TSF:MSG:READ,16-16-0,s=255,c=4,t=2,pt=6,l=6,sg=0:010002004F05
    


  • My FOTA updates take 3-4 minutes at normal speed. I think you are having some different communication issue.



  • Is it possible to use this bootloader with arduino Mega boards (mega 2560)?
    What should be set in boards.txt then?


  • Mod

    @dakipro as a node or as gateway? Anyway I don't think it is supported



  • as a node, I want to build one ambitious notification node with a bunch of functionality, Due to number of interrupts i would like to have (and total sensors as well) it would have to be a mega board.

    It would be physically located in other part of the house, so wireless programming would be awesome if possible πŸ™‚


  • Mod

    May I ask why do you need that many interrupts?



  • DualOptiboot: if you do your own board layout, always keep the CS signal of the external flash at pin D8. You can change the pin number in your sketch, but not for the bootloader It is hard coded in the bootloader!
    In this case the uploaded firmware is written to external flash by the sketch, but the bootloader can not read it and not write it to internal flash. Firmware will never get updated. Took me some time to find out...



  • @gohan never saw your reply sorry.
    I am assuming I need more then two interrupts as I would like to have several buttons and sensors to the node. I am building a "information" node from an old lamp that will have a pir, lcd, temp, rgb led. Also a proximity and few others like microphone from the secret knock example, air quality, buzzer.
    I guess I could get away with checking on sensor/buttons state on each cycle since it is not a battery powered sensor, but I assume I will need more memory anyway for all the libs.

    (I know that perhaps the raspberry is better for this task, but... would like to push arduino and myself a bit more πŸ™‚ )


  • Mod

    Since it's not a battery node, you can use pretty much anything you want. If you want to give it a shot, there is also a 3.3v pro mini with a Mega 2560 chip that should give you plenty of room and power for all the libraries you want.



  • Can I add a +1 for Mega2560 support in the MYSBootloader please?

    I have 3 Mega based nodes (Irrigation and Pool Controllers). 2 of which are in spider infested, confined spaces in the garden. OTA would be a joy.



  • @gohan yes, but can it FOTA? πŸ™‚
    Never saw pro mini with mega chips btw (or didn't know the difference), do you have any links maybe?


  • Mod

    http://robotdyn.com/mega-2560-pro-mini-atmega2560-16au.html

    No idea if it can FOTA, bot I don't think there is a dual optiboot for it



  • Thanks for the info, I've got it working on boards which arn't already soldered to radios, however just cant burn a new bootrom to a board with a RF69 soldered across pins miso mosi and sck. Is this normal ?


  • Mod

    I guess the radio chip is interfering with the communication


  • Hardware Contributor

    @rfm69 does your rfm69 CS signal have a pullup? If not, you should add one, because pin can be floating (so it's bad practice to not have pullup on CS lines) and interfering during AVRSPI reprogramming



  • @scalz Thanks for the suggestion. By CS do you mean the DI00 on rmf69 and pin2 INT0 on mini pro ?

    I get confused by these things, so need to confirm. πŸ™‚

    What type of value pullup would you suggest. Again I'm new to this.

    Thanks


  • Hardware Contributor

    @RFM69
    CS/SS of the SPI bus, for enabling/disabling device spi comm. it's your rfm69 NSS pin if you prefer.
    I usually use 56k pullup resistor



  • @scalz thanks will give it ago.



  • Hi there. For what I'm reading, the MYSBootloader allways uses the default channel 76. Is that correct? It would be a very important addition to this howto.


  • Mod

    @guillermo-schimmel not always, but by default. To change the channel, the bootloader must be recompiled. I have added a note to the howto. Could you check if the information is sufficiently clear?



  • I recompiled MYSBootloader 1.3 with the RF Channel I use and it's now working. I can confirm that FOTA works great over MQTT gateway.



  • @mfalkvidd Thank you as usual.

    I can confirm that is indeed working by recompiling to my channel.

    I have however a couple of questions.

    1. When you say "by default", do that means that there is a way of modify that default? If so, how?

    2. This specific node that I'm testing with, have a fixed node id (I use OpenHAB). But with the recompiled bootloader it "knows" which firmware download. Where does it gets from? Is the bootloader accessing the main sketch? Or is the node id info fixed in eeprom.

    3. If the node id info is in eeprom, could we also have the channel there? It would be so great not having to compile the bootloader.

    Thanks a lot, as allways.


  • Mod

    @guillermo-schimmel

    1. Yes. Isn't that exactly what you did when you did this: "I can confirm that is indeed working by recompiling to my channel" ?
    2. I don't know. But I would also guess eeprom.
    3. The bootloader needs to fit into a very small size, so I am not sure if there is room to read the channel from eeprom.

    Maybe @scalz can comment on 2 and 3.



  • @mfalkvidd said in πŸ’¬ FOTA (Wireless Programming):

    @guillermo-schimmel

    1. Yes. Isn't that exactly what you did when you did this: "I can confirm that is indeed working by recompiling to my channel" ?

    Definitely yes. And it worked. I meant a non-compiling way, like set some eeprom variable.

    1. I don't know. But I would also guess eeprom.
    2. The bootloader needs to fit into a very small size, so I am not sure if there is room to read the channel from eeprom.

    Maybe @scalz can comment on 2 and 3.

    Please @scalz should you have a little room, this would be a very nice feature to have.

    Thank you both guys.

    Regards


  • Mod

    I guess the main hurdle would be that while MySensors stores the node id in eeprom today, the nrf channel is not stored in eeprom. Since bootloader and sketch use the same eeprom, there would have to be some sort of agreement on where to store the channel.



  • Hello, I have my MySensors gateway permanently attached to my openhab server (RPI3), but i want to do FOTA uploads from my desktop. How do I do this since MYSController needs to attatch to a gateway? Can i use an other gateway, both with the same address (ID0)? Thanks



  • @mfalkvidd Hello.
    From what I read it is possible to somehow modify the channel for OTA updates, this is also said here.
    https://www.mysensors.org/about/fota

    But I can not find other info on how to proceed to change the channel .....
    Can you give me some other clarification or link to follow ???



  • @sindrome73 You have to recompile the bootloader.

    It's easier than it seems.

    1. Mirror this repo on some machine with devel tools (I use OpenSUSE)

    https://github.com/mysensors/MySensorsBootloaderRF24

    1. Edit the file MYSBootloader.c, only the line:

    #define RF24_CHANNEL (76) // RF channel for the sensor net, 0-127; default 76

    1. Run Make

    Probably it's going to need all the set of avr devel tools. Install them according to your distribution instructions.

    1. You are going to get a .hex. That is the bootloader with the new channel. Install it according the standard instructions. I use AVRDUDESS.

    I can confirm that I did this and it's working great.



  • @guillermo-schimmel Thanks for the reply.
    Very useful, but can you tell me more accurately what software to use to recompile after making the change ????
    Maybe some links to the software to download ..... thanks again for the availability



  • @sindrome73 You have to use the Make tool, which is going to call the avr-gcc compiler.

    Have you ever compiled something using command line tools?

    If you don't know what I'm talking about, just tell me your channel and I can compile a bootloader for you.



  • Quick question: Should FOTA work with personalized nodes/gateway?

    If the answer should be yes, then I appear to have a problem…

    As soon as I enable signing and signature requesting, the node will no longer respond to any internal or stream commands (e.g. Request Presentation, Reboot, Firmware, etc.) made via @tekka’s MYSController app. I haven’t tried anything else yet.

    The node still happily sends signed sensor data to the gateway and they ping-pong with heartbeats, etc.

    And as soon as I disable signing and signature requesting, the node will respond to all those same commands, quite happily rebooting, updating the firmware, etc.

    So, am I doing something wrong?

    (MYSController Version: 1.0.0beta, b3316. MySensors Library v2.3.1)



  • @sindrome73 Hi Good evening, and I'm sorry for the delay in the reply.
    As you have never done a Bootloader, if you are kind enough to do it, I thank you.
    The channel I'm using is the "Channel 84" for now I'm using only the 16MHZ Bootloade, but if you want, the others are fine too.
    In addition you can give me some starting point to be able to fill in too ??
    Thanks for your availability, greetings



  • @sindrome73 here you have bootloaders for all the channels.

    https://github.com/guillebot/MYSensors-Bootloaders

    They are unchanged from default elsewhere. Only RF CHANNEL.



  • Hello!! And thank you again ......
    A really good job, it's something that was definitely missing ......
    I would suggest to the directors to expand the guide on OTA you better explain the steps to change channels and make a link to your great job !!

    Now if I understand this and the Bootloader that I have to load on my Arduino Pro-Mini, in practice insert in the path of the IDE of Arduino when I make the updates use that channel

    As soon as I can I try them and I'll let you know, in a lot of thanks again ......



  • @acb

    So, I’m answering my own question a little here after digging into the gateway/node logs and code - and so I'm replying to my own post.

    Should FOTA work with personalized nodes/gateway?

    Yes, it should and it does. FOTA (and any other internal commands) works with personalization (signed commands) using the MYSController.

    What doesn’t appear to work is if you’re using smartSleep and asking the MYSController app to trigger sending your internal command upon receiving from the node - in this case, simply a heartbeat from smartSleep.

    Does that make sense?

    So, if I don’t sleep the node, I can issue reboots and other internal commands that are signed, no problem.

    As soon as I switch to using smartSleep(DURATION) instead of wait(DURATION) and ask the MYSController app to trigger sending, for example, an internal reboot command β€œUpon RX”, then the reboot command never makes it to the node before it goes back to sleep. So the gateway tries to send the queued command, but the node has already gone back to sleep, and so it gets ignored.

    I’ve tried varying the smartSleep duration as well as the MY_SMART_SLEEP_WAIT_DURATION_MS define.

    I haven’t tried varying the MY_SLEEP_TRANSPORT_RECONNECT_TIMEOUT_MS define, but it didn’t immediately appear that this was a transport connection issue.

    It looks like the gateway/node do all their NONCE request/response just fine, but it could be something to do with how all that gets queued and ordered.

    Doesn’t look like it has anything to do with ATC at all, since I’ve tried enabling/disabling on both node and gateway.

    Also doesn’t look like it has anything to do with the new driver, since I’ve tried both the old and the new and get the same behaviour.

    The only difference appears to be the way smartSleep interacts with signed messages.

    I’ll keep digging, but if anyone has any ideas what I might be doing wrong here, I’d appreciate any help or advice.

    Thanks!



  • @guillermo-schimmel It was bothering me that I was using a 16MHz compiled bootloader for 8MHz Arduino Pro Mini.

    So I recompiled the bootloader for all the channels and 1MHz, 8MHz and 16MHz.

    I don't know yet if it makes a difference but it seems right.

    https://github.com/guillebot/MYSensors-Bootloaders



  • Hi, Can i burn mysbooloder on arduino mega2560?? its to use as a node. i have a node full functional that manage 24 signals, sensors and actuators. Now i want to make it FOTA node Thanks



  • hi, can i use mysbootloder with arduino mega2560? The mega is used as a node that manage 24 sensors / actuators, i use this by the number of pins needed. thnks



  • @mmanzanelli I don't think you can, the Mega has a different memory structure not supported by the present bootloaders.



  • I have a quick question. so I donΒ΄t screw things up more than necessary, What bootloader should I use on a barebone 328p? ... I was just going to burn the "mini pro" that Β΄@Guillermo Schimmel so kindly uploaded on GitHub. but then I realised ..that might be wrong ..
    Can anyone guide me about what to burn in, I am making a bunch of" 2AA Slim-nodes"

    Also I ahve 3 old ones, I actually donΒ΄t remember but If I understood things correct, the Channel have to be the same on all nodes on the network I assume , and by default it is set to Channel 76, unless manually changed in the "old" code before this FOTA-generation?

    I think I read too much info so my mind is slightly confused now πŸ˜ƒ so I hope it was clear enough



  • @badmannen 76 is the default. I uploaded different versions for all the channel numbers.

    Have in mind that they all have to match (gateway and all the nodes).

    If they don't match they aren't going to see each other.



  • @guillermo-schimmel
    Ok so If I push this one "MYSBootloader.ch76.8000000L.RF24_PA_LOW.hex" into the FLASH on my barebone 328P via AVRDudess
    It should , in theory at least , do the trick ?
    0_1573768411797_ab8606c9-3933-40d4-8b29-024d4aa8da3d-image.png

    And then After I can upload any sketch on top of it, in the Arduino IDE, with just choosing "Programmer-----> USBasp"
    which is what I use to connect to the 328P



  • @badmannen

    1st: In order to upload soft using a cable, you don't need to modify the bootloader. Any bootloader will work.

    if and only if you want to experiment with FOTA (uploading firmware via wireless), then:

    2nd: if you want to use FOTA and you choose MYSBOOTLOADER, then please check the fuses and lock bits, I dont remember them all. But it seems ok, have a try and let us know!



  • @guillermo-schimmel OR Am I making things more complicated than I need? ... maybe it is easier just to copy your hexfile into -->
    "ARDUINO_PATH" > hardware > arduino > avr > bootloaders

    and then burn it in the Arduino IDE ?



  • @badmannen are you sure that your arduino doesn't have a bootloader? why are you trying to modify it?

    If it doesn't have a bootloader, or if you want to play with FOTA, then what you are doing it's ok, that is the way I did it.



  • @guillermo-schimmel
    Ok Perfect! , I will give it a go and see what happens . thanks a lot .. I just needed a little confidence boost to get going πŸ˜ƒ

    Yes I wanted to Try to Use FOTA, just to check it out , at least itΒ΄s enabled if I push this bootloader in from the start



  • @guillermo-schimmel Thanks a lot ! I got it all up and running node a couple of nodes. But now I confused myself . I got an Arduino Nano as a node that also acts as a repeater, what bootloader can I push into that one? I assume anycahnnel and 16MHz should do the trick since it got that crystal attached.

    And also one thing that is not really clear in my head, I set the "Fuses&Lock bits" with the AVRDudess for my 328P barebone. But do I really need that? . If I load the bootloader in ARduini IDE for example I specify all those settings in the "board.txt" file. Or is that just to tell the IDE what settings is on the chip ?

    If I clear these two things up I think I got everything sorted now πŸ˜ƒ



Suggested Topics

  • 14
  • 3
  • 37
  • 27
  • 3
  • 12
  • 3

52
Online

11.4k
Users

11.1k
Topics

112.6k
Posts