πŸ’¬ FOTA (Wireless Programming)


  • 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

  • 9
  • 3
  • 1
  • 5
  • 7
  • 21

1
Online

11.4k
Users

11.1k
Topics

112.7k
Posts