Arduino pro mini dead after flashing MYSbootloader.
-
And BOOM it works!!!! :grin: :yum:
I just did my first FOTA update:+1: :+1: :+1: :+1: :+1: :+1:
Thanks to everyone who helped
@jimmy-loyens Great!
I have to say that the work done with the bootloader and mysensors is really good.
It is very nice when FOTA starts working.
-
@jimmy-loyens Great!
I have to say that the work done with the bootloader and mysensors is really good.
It is very nice when FOTA starts working.
@guillermo-schimmel Yes indeed, no more running around with laptop and cables :ok_hand: :+1:
Thanks again for the help and the bootloaders
-
@guillermo-schimmel Yes indeed, no more running around with laptop and cables :ok_hand: :+1:
Thanks again for the help and the bootloaders
Great work @jimmy-loyens
Since you now have a working system, would you mind writing down what was needed? I think you are in a good position to describe things so a newbie (like myself, at least when it comes to ota) can understand? Maybe something that can make https://www.mysensors.org/about/fota easier.
-
Great work @jimmy-loyens
Since you now have a working system, would you mind writing down what was needed? I think you are in a good position to describe things so a newbie (like myself, at least when it comes to ota) can understand? Maybe something that can make https://www.mysensors.org/about/fota easier.
@mfalkvidd said in Arduino pro mini dead after flashing MYSbootloader.:
Great work @jimmy-loyens
Since you now have a working system, would you mind writing down what was needed? I think you are in a good position to describe things so a newbie (like myself, at least when it comes to ota) can understand? Maybe something that can make https://www.mysensors.org/about/fota easier.
I will send you some little things to improve it:
- MYSBootloader uses channel 76 by default. To change the channel, a new bootloader must be compiled.
Feel free to post my github project "https://github.com/guillebot/MYSensors-Bootloaders"
I will keep updated the different channel versions and probably will upload my script and some info about compiling them.
-
Arduino IDE 1.6.x installed
Mysensors lib > 1.5.x installedYou should probably update that to 1.8.8 and 2.3.1. It is not allways related to FOTA but it is allways better to stay updated.
-
- I would recommend to burn the bootloader with AVRDUDESS, not only the fuses. I had better luck with avrdudess than with arduino ide.
At least show that you can do that (use Arduino ide OR AVRDUDESS)
-
Great work @jimmy-loyens
Since you now have a working system, would you mind writing down what was needed? I think you are in a good position to describe things so a newbie (like myself, at least when it comes to ota) can understand? Maybe something that can make https://www.mysensors.org/about/fota easier.
@mfalkvidd I will rty to write some stuff down but some details i'm not sure off myself so it would be nice if other people can revieuw the text for errors or inaccuracies. Do I just put it down here on the forum or in a file?
@Guillermo-Schimmel can i refer to your github page with bootloader flavors?
-
From Mysensors FOTA site:
1)Keep this file opened and close Arduino ide (otherwise your changes will be erased).
2)In preferences.txt, at the end, add this
build.path=C:\Arduino-Output
or another preferred path. That will be the output folder for your .hex compiled sketch files. Close the dialog box.I noticed that file gets reset to default (meaning added line disappears from file) on opening arduinoIDE!!!!:white_frowning_face: :confounded: :flushed:
Has anyone else noticed this? Does anyone know how to remedy this?
-
@mfalkvidd I will rty to write some stuff down but some details i'm not sure off myself so it would be nice if other people can revieuw the text for errors or inaccuracies. Do I just put it down here on the forum or in a file?
@Guillermo-Schimmel can i refer to your github page with bootloader flavors?
This post is deleted! -
Great work @jimmy-loyens
Since you now have a working system, would you mind writing down what was needed? I think you are in a good position to describe things so a newbie (like myself, at least when it comes to ota) can understand? Maybe something that can make https://www.mysensors.org/about/fota easier.
@mfalkvidd
Only for MYSbootloaderFirst off know that the bootloader needs to be compiled for the right clock-mode (internal osc/RC-osc/Xtal) and for the RF channel the node is going to be used in. You can build your own bootloader from the source at https://github.com/mysensors/MySensorsBootloaderRF24 or use a precompiled bootloader from https://github.com/guillebot/MYSensors-Bootloaders with thanks to @Guillermo-Schimmel .
Next make sure you have the right driver for the USBASP installed. Like the video on https://www.mysensors.org/about/fota suggests use Zadig (https://zadig.akeo.ie/) for this. The driver may be dependent on your operating system (I'm using Win10 and libusbK (v3.0.7.0) works for me). If u use the wrong driver it may be possible to read and write the fuses but burning the bootloader will fail!
Make sure you are using the right fuses for your board. If not you may even potentially brick your board (i.e. if you dont have a Xtal on your board and use the internal oscillator but do burn the fuses to use a Xtal you will have to solder a Xtal to your board to reflash the right fuses because otherwise the µC wont have a clocksource)[not sure if this is 100% correct] If you don't know how to set the fuses correctly for your board use a fuse calculator like this http://www.engbedded.com/fusecalc/. If you dont know the meaning of some of the fuses you can look them up in the datasheet of ATmega328P.
Now you can open AVRDUDESS to first check the connection of yourUSBASP and then burn the fuses. First connect your board to USBASP and click on detect. AVRDUDESS should indicate the MCU is a ATmega328p (even if its a arduino clone). You can either burn your fuses seperately by filling them in in the "fuses and lockbits" frame and clicking write (leave the lockbits alone or you might brick your MCU) or burn them together with your bootloader (if you use AVRDUDESS for bootloader) by filling in the bits and ticking the set fuses box. When burning the bootloader the fuses will be burnt first.
For burning the bootloader you have 2 options. You can either burn the bootloader using the arduinoIDE like explained in the video but i prefer using AVRDUDESS (less hassle with editing the boards.txt file and adding the bootloaders to the right arduino directory). To burn the bootloader with AVRDUDESS just drag and drop the right bootloader into the "flash" textbox of AVRDUDESS, make shure the radio button for write is active and hit go. Tadaa!!! the bootloader is burnt.
Now you can program your board (the good oldfashioned way) with a MySensors sketch using the same RF-channel as the bootloader. Make shure your gateway is allso programmed with the same RF-channel as the first thing the node (bootloader) does after booting is connecting to the gateway. This means your gateway needs to be online before the node can execute its sketch [pretty shure about this but not completely It will take the MYSbootloader a little longer to run then the stock bootloader so don't panic when you don't see anything in serial monitor at first, it should be coming.
==> With mys bootloader burnt its no longer possible to program node in "the old fashioned way" (using arduino IDE and serial connection). All updates must be made OTA!When you get output in serial monitor its time to install MYController (not the same as MYSController!). You can start the service by running "mycontroller/bin/start.bat" on windows or entering "./start.sh" on linux. Here is a (outdated) doc on MYController https://www.mycontroller.org/#/documents/user/1.4.0.Final.html. Now open a browser and go to deviceIP:8443 and log in to MYController with username:admin, password:admin. Under resources=>gateway enter the gateway setup you use for MySensors, and be shure to select MySensors under network type. Now you can enable your gateway in the table, select it and go to actions in the top right. There select discover. Now your nodes should be discovered automaticly. You can check this by looking under resources=>nodes. If not you can look under status=>resource logs to debug what's going on.
To be able to do FOTA updates you need a .hex file of your sketch. You can do this by adding "build.path=C:\Arduino-Output" to the bottem of your arduino "preferences.txt" file (see https://www.mysensors.org/about/fota)[but this file seems to be deleted every time arduino starts!], load the desired sketch in the arduinoIDE, make shure the right board is connected and click verify. Now the .hex file should be in your C:\Arduino-Output\ folder.
Now the part we've all been waiting for, the FOTA update! Under utilities=>firmware on the top right select "types" and add a type of node, then select version and add a version. After this you can select firmware and choose a hex file you compiled earlier. Go back to resources=>nodes, select your node you want to update, click actions=>edit. Here you can appoint a firmware, type and version to your node. hit save! Back in the nodes window select the same node go to actions=>upload firmware. Your first FOTA update should be underway.
-
@mfalkvidd
Only for MYSbootloaderFirst off know that the bootloader needs to be compiled for the right clock-mode (internal osc/RC-osc/Xtal) and for the RF channel the node is going to be used in. You can build your own bootloader from the source at https://github.com/mysensors/MySensorsBootloaderRF24 or use a precompiled bootloader from https://github.com/guillebot/MYSensors-Bootloaders with thanks to @Guillermo-Schimmel .
Next make sure you have the right driver for the USBASP installed. Like the video on https://www.mysensors.org/about/fota suggests use Zadig (https://zadig.akeo.ie/) for this. The driver may be dependent on your operating system (I'm using Win10 and libusbK (v3.0.7.0) works for me). If u use the wrong driver it may be possible to read and write the fuses but burning the bootloader will fail!
Make sure you are using the right fuses for your board. If not you may even potentially brick your board (i.e. if you dont have a Xtal on your board and use the internal oscillator but do burn the fuses to use a Xtal you will have to solder a Xtal to your board to reflash the right fuses because otherwise the µC wont have a clocksource)[not sure if this is 100% correct] If you don't know how to set the fuses correctly for your board use a fuse calculator like this http://www.engbedded.com/fusecalc/. If you dont know the meaning of some of the fuses you can look them up in the datasheet of ATmega328P.
Now you can open AVRDUDESS to first check the connection of yourUSBASP and then burn the fuses. First connect your board to USBASP and click on detect. AVRDUDESS should indicate the MCU is a ATmega328p (even if its a arduino clone). You can either burn your fuses seperately by filling them in in the "fuses and lockbits" frame and clicking write (leave the lockbits alone or you might brick your MCU) or burn them together with your bootloader (if you use AVRDUDESS for bootloader) by filling in the bits and ticking the set fuses box. When burning the bootloader the fuses will be burnt first.
For burning the bootloader you have 2 options. You can either burn the bootloader using the arduinoIDE like explained in the video but i prefer using AVRDUDESS (less hassle with editing the boards.txt file and adding the bootloaders to the right arduino directory). To burn the bootloader with AVRDUDESS just drag and drop the right bootloader into the "flash" textbox of AVRDUDESS, make shure the radio button for write is active and hit go. Tadaa!!! the bootloader is burnt.
Now you can program your board (the good oldfashioned way) with a MySensors sketch using the same RF-channel as the bootloader. Make shure your gateway is allso programmed with the same RF-channel as the first thing the node (bootloader) does after booting is connecting to the gateway. This means your gateway needs to be online before the node can execute its sketch [pretty shure about this but not completely It will take the MYSbootloader a little longer to run then the stock bootloader so don't panic when you don't see anything in serial monitor at first, it should be coming.
==> With mys bootloader burnt its no longer possible to program node in "the old fashioned way" (using arduino IDE and serial connection). All updates must be made OTA!When you get output in serial monitor its time to install MYController (not the same as MYSController!). You can start the service by running "mycontroller/bin/start.bat" on windows or entering "./start.sh" on linux. Here is a (outdated) doc on MYController https://www.mycontroller.org/#/documents/user/1.4.0.Final.html. Now open a browser and go to deviceIP:8443 and log in to MYController with username:admin, password:admin. Under resources=>gateway enter the gateway setup you use for MySensors, and be shure to select MySensors under network type. Now you can enable your gateway in the table, select it and go to actions in the top right. There select discover. Now your nodes should be discovered automaticly. You can check this by looking under resources=>nodes. If not you can look under status=>resource logs to debug what's going on.
To be able to do FOTA updates you need a .hex file of your sketch. You can do this by adding "build.path=C:\Arduino-Output" to the bottem of your arduino "preferences.txt" file (see https://www.mysensors.org/about/fota)[but this file seems to be deleted every time arduino starts!], load the desired sketch in the arduinoIDE, make shure the right board is connected and click verify. Now the .hex file should be in your C:\Arduino-Output\ folder.
Now the part we've all been waiting for, the FOTA update! Under utilities=>firmware on the top right select "types" and add a type of node, then select version and add a version. After this you can select firmware and choose a hex file you compiled earlier. Go back to resources=>nodes, select your node you want to update, click actions=>edit. Here you can appoint a firmware, type and version to your node. hit save! Back in the nodes window select the same node go to actions=>upload firmware. Your first FOTA update should be underway.
@jimmy-loyens stuff in itallics i'm not absolutely shure about or are remaining problems. Anyone feel free to add or correct anything:grin:
While writing this tutorial my node went offline :unamused: :confused:
So it might be i have to add some more to the tutorial lateron :laughing: :smirk:
Seems to be a problem with MYController because i can still see node trying to communicate over mqtt.I see its my sh***ty router acting up again, even my internet went down just now.:tired_face: :sob:
It seems that somehow the firmware on my node got corrupted, when connecting it to a serial monitor it didn't output anything. When looked on MQTT.fx at the messages node and GW where continiously exchanging "stream messages. Then i flashed the node the oldfashioned way and now its all up again. Still trying to find out what happened exactly.