@yveaux do you know what development ide i have to use to compile the bootloader? i cant find anything with google on this. I allready found where to change the RF channel in the source but i have no idea how to compile it into a hex file. Tried vs code but i probably have to install another extention
jimmy loyens
@jimmy loyens
Best posts made by jimmy loyens
-
RE: Arduino pro mini dead after flashing MYSbootloader.
-
Batt/temp/hum/light/6*dig pcb for grabs
Can i interrest anyone in a pcb design + code for a battery powered (2*AA) sensornode for arduino pro mini 3v3? Can measure temperature/humidity by DHT22, light intensety by TSL2561 with jumpered interupt trace and 6 digital inputs (with interrupt configurable pull-up/down). Allso has voltagedevider for battery measurement. You can pin on any onewire sensor (3v3) instead of DHT22 (with same pinout) or any I2C sensor (5v) instead of TSL2561 (with same pinout), but code is written for these sensors. You're welcome to rewrite the code or write your own (just share a copy with me). Nodes are running in my home for >1 year now and work great. I'm writing this on my phone so don't have the files at hand, but if anyone is interested just reply to this post and i will post the files. Sharing is power!
Today i allso ordered the prototype pcb's for dual motion sensor/repeater with 230VAC onboard powersupply. If it checkes out i will be sharing this to.
-
RE: Cant set static node ID above 254
@mfalkvidd hi, i'm building a home automation system with mysensors, openhab, milight, .... . Like most people who use mysensors i guess. Most of my node id's aren't populated yet. But when i started out i devised a table with node id ranges. One range for every room. To be shure i went ahaid and reserved 20 id's per range. Just so i wouldn't run out of id's in the future, since this looks to be a never ending project. I reserved the higher ranges for zones outside and since up untill now i had no sensors outside i didn't notice my ranges where to high. Now i rewrote my range table so i have 17 id's per zone (should be more then enough) and rooms like toilet only 4 id's (right, like i was going to put 20 sensors in my toilet ). So everything should be fine. I spend today recoding openhab and flashing nodes. Everything is running like it should again and even found some typos.
-
RE: Arduino pro mini dead after flashing MYSbootloader.
@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.
-
RE: [SOLVED] A2 interrupt doesn't wake node from sleep
I just found this post on the forum: https://forum.mysensors.org/topic/6352/pin-change-interrupt-on-any-pin/11
It adds "_wokeUpByInterrupt = 0xFE; // Dirty hack to get out of MySensors sleep loop" at the end of every ISR
and
"// Unset value from dirty hack to get out of sleep loop (set in interrupt)
_wokeUpByInterrupt = INVALID_INTERRUPT_NUM;" at the beginning of loop.I tried it, not knowing at all what i'm doing by adding these lines. But i do know it works!!! Even if it is a dirty hack, IT WORKS!!!!
Now i can rewrite my code to do the processing/messaging in loop outside of the ISR. If anyone can explane what these lines do exactly please let me know.
It would be even nicer if somewhere in the future there could be a sleep function in the MySensors library that supports these pinchange interrupt vectors, but this hack makes it work for now.
Thanks for all the help!
Latest posts made by jimmy loyens
-
RE: Getting MySensors MQTT Gateway working on OpenHAB 2.2 (Stable)
@rene-mullie if im not mistaken that file is to configure mqtt v1 and your using mqtt v2
-
RE: Getting MySensors MQTT Gateway working on OpenHAB 2.2 (Stable)
Hi @rene-mullie,
Seems like the mysensors binding mqtt gw doesnt play nice with the mosquitto broker. You can try running the embedded broker of openhab (paperUi->addons->misc->embedded broker i beleive). Dont forget to configure it under services->misc (not shure since im on my phone right now). And connect your mqtt gateway to this broker. I was not succesful in this because i need the embedded broker on port 1884 since i allready have mosquitto on port 1883 for other stuff. And i <think> mysensors mqtt gateway doesnt want to connect to 1884 but 1883. But you can give it a try. If you have ethernet gateway going and dont have plans to use different controllers (for example to do FOTA updates) i would stick to the ethernet gw for now. Greets
-
RE: OpenHAB Mysensors binding 2.4: cant get mqtt gateway online
@waspie I think the embedded broker connects to 1884 since i can see the messages from my nodes. But you might be right that mysensors is connecting to the wrong broker/port. Allso noticed the embedded broker is really slowing down my RPI3. Just uninstalled it and everything speeds up again Guess i have to wait till everything can connect to mosquitto
-
RE: OpenHAB Mysensors binding 2.4: cant get mqtt gateway online
@timo Hi Tomo.
Both the embedded broker thing and the mqtt gateway are online, i can see the mqtt messages in the logvieuwer but i cant discover nodes. I should say i have mosquitto running on port 1883 (for my milight hub) and embedded broker on port 1884. Do you think this is a problem? can i have both brokers on 1883? btw thanks for the link
-
RE: OpenHAB Mysensors binding 2.4: cant get mqtt gateway online
@timo I connected to the embedded broker over port 1884
. But i cant seem to discover my nodes. This is my broker thing:mqtt:broker:embedded-mqtt-broker[host="192.168.1.2", port="1884", qos=1, clientID="gateway1", reconnectTime=20000, keepAlive=60000, secure=false, username="xxx", password="yyy"]
This is my mqtt-bridge thing:
Bridge mysensors:bridge-mqtt:mygateway [brokerName="embedded-mqtt-broker", port="1884", topicPublish="mygateway1-in", topicSubscribe="mygateway1-out", startupCheckEnabled=false]{ }
Its weird because i can see the messages from the nodes coming in in the log vieuwer (mysensors binding is in TRACE).
2019-02-06 16:47:14.968 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/109/255/3/0/0' : 87 2019-02-06 16:47:14.971 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/109/255/3/0/0' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:47:14.990 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/109/1/1/0/1' : 37.2 2019-02-06 16:47:14.993 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/109/1/1/0/1' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:47:15.024 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/109/255/3/0/32' : 500 2019-02-06 16:47:15.028 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/109/255/3/0/32' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:47:26.746 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/109/255/3/0/32' : 500 2019-02-06 16:47:26.748 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/109/255/3/0/32' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:47:34.072 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/1/255/4/0/0' : 0200010068057A890103 2019-02-06 16:47:34.075 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/1/255/4/0/0' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:47:37.114 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/1/255/4/0/0' : 0200010068057A890103 2019-02-06 16:47:37.116 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/1/255/4/0/0' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:47:38.438 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/109/1/1/0/1' : 37.3 2019-02-06 16:47:38.441 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/109/1/1/0/1' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:47:38.459 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/109/255/3/0/32' : 500 2019-02-06 16:47:38.462 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/109/255/3/0/32' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:47:40.157 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/1/255/4/0/0' : 0200010068057A890103 2019-02-06 16:47:40.160 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/1/255/4/0/0' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:47:43.224 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/1/255/4/0/0' : 0200010068057A890103 2019-02-06 16:47:43.226 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/1/255/4/0/0' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:47:50.169 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/109/255/3/0/32' : 500 2019-02-06 16:47:50.172 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/109/255/3/0/32' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:47:56.542 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/1/255/4/0/0' : 0200010068057A890103 2019-02-06 16:47:56.545 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/1/255/4/0/0' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:47:59.582 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/1/255/4/0/0' : 0200010068057A890103 2019-02-06 16:47:59.585 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/1/255/4/0/0' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:01.876 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/109/255/3/0/32' : 500 2019-02-06 16:48:01.879 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/109/255/3/0/32' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:02.648 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/1/255/4/0/0' : 0200010068057A890103 2019-02-06 16:48:02.653 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/1/255/4/0/0' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:05.680 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/1/255/4/0/0' : 0200010068057A890103 2019-02-06 16:48:05.682 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/1/255/4/0/0' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:13.580 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/109/255/3/0/32' : 500 2019-02-06 16:48:13.583 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/109/255/3/0/32' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:25.308 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/109/255/3/0/32' : 500 2019-02-06 16:48:25.312 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/109/255/3/0/32' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:25.454 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/1/255/4/0/0' : 0200010068057A890103 2019-02-06 16:48:25.458 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/1/255/4/0/0' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:28.486 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/1/255/4/0/0' : 0200010068057A890103 2019-02-06 16:48:28.489 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/1/255/4/0/0' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:31.551 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/1/255/4/0/0' : 0200010068057A890103 2019-02-06 16:48:31.553 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/1/255/4/0/0' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:34.585 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/1/255/4/0/0' : 0200010068057A890103 2019-02-06 16:48:34.588 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/1/255/4/0/0' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:37.006 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/109/1/1/0/1' : 37.2 2019-02-06 16:48:37.008 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/109/1/1/0/1' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:37.039 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/109/255/3/0/32' : 500 2019-02-06 16:48:37.042 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/109/255/3/0/32' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:44.873 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/1/255/4/0/0' : 0200010068057A890103 2019-02-06 16:48:44.875 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/1/255/4/0/0' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:47.916 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/1/255/4/0/0' : 0200010068057A890103 2019-02-06 16:48:47.919 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/1/255/4/0/0' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:48.720 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/109/3/1/0/23' : 31 2019-02-06 16:48:48.722 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/109/3/1/0/23' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:48.744 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/109/2/1/0/0' : 22.7 2019-02-06 16:48:48.746 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/109/2/1/0/0' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:48.762 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/109/1/1/0/1' : 37.3 2019-02-06 16:48:48.764 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/109/1/1/0/1' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:48.786 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/109/255/3/0/32' : 500 2019-02-06 16:48:48.788 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/109/255/3/0/32' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:50.971 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/1/255/4/0/0' : 0200010068057A890103 2019-02-06 16:48:50.973 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/1/255/4/0/0' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]* 2019-02-06 16:48:54.038 [TRACE] [ansport.mqtt.internal.ClientCallback] - Received message on topic 'mygateway1-out/1/255/4/0/0' : 0200010068057A890103 2019-02-06 16:48:54.044 [TRACE] [ansport.mqtt.internal.ClientCallback] - Topic match for 'mygateway1-out/1/255/4/0/0' using regex mygateway1-out/[^/]*/[^/]*/[^/]*/[^/]*/[^/]*
And can you point me to the docs on how to setup the binding ? I found them before but cant seem to find them anymore.
Thanks
-
RE: OpenHAB Mysensors binding 2.4: cant get mqtt gateway online
@timo thanks for the update. I will try it as soon as i get the chance. Thanks
-
RE: OpenHAB Mysensors binding 2.4: cant get mqtt gateway online
@masmat Hi, I think @TimO is looking into it. Ethernet and serial gateway work as expected with mysensors binding. My guess it has something to do with new MQTT-binding.
-
OTA update mechanism with MYSbootloader
Hello,
Can someone pls explane to me how the mechanics of OTA updates works with MYSbootloader.
What happens when node with MYSbootloader first starts after reset? Does bootloader make contact with gateway? ....I constantly see this message go from gateway to node:
107;255;4;0;2 0100002006b05FFFFF....F
And from node to gateway:
107;255;4;1;3 0100002007005B2C70103
Is this the process of OTA updating?
According to serial protocol doc Cmd=4 means stream so it has to do with OTA. There is nothing more documented in the serial protocol docs about Cmd=4 or about what happenes when a node with MYSbootloader starts up. Maybe one of the developers can shine a light on this? Or perhaps someone competent enough to read and understand the bootloader code (not me ).
Today i had 3 nodes running that where successfully programmed OTA (MYSbootloader). When resetting one node, it didn't manage to restart (stuck in bootloader?). When resetting node nr 2, same thing. I then programmed node 1 with ftdi (is this even possible with MYSbootloader?), At this moment node 2 came online. I've been looking all over the forum but i can find very little about MYSensors OTA mechanics. Like what are the different types in the stream messages? For instance: nodeID/255/4/0/32. I suspect 255 means broadcast in this message and pretty shure type=32 means pre or post sleep, but how does it all fit together?
Is there a clear discription of the steps a OTA update goes thru in order to get the sketch into the node?
I found this on the git page of MYSfirmware "https://github.com/mysensors/MySensorsBootloaderRF24/blob/development/README.md".
I assume this happenes at startup of the node. Still would like some info on message types for stream messages (cmd=4)
Ok, finally found some info on message types here https://github.com/mysensors/MySensorsBootloaderRF24/blob/development/MyMessage.h
-
RE: Arduino pro mini dead after flashing MYSbootloader.
@jimmy-loyens stuff in itallics i'm not absolutely shure about or are remaining problems. Anyone feel free to add or correct anything
While writing this tutorial my node went offline
So it might be i have to add some more to the tutorial lateron
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.
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.
-
RE: Arduino pro mini dead after flashing MYSbootloader.
@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.