firmware update on rpi problem



  • Hi,

    I have a rpi3 running openhabian (OH 2.1), mysgw with mqtt and mosquitto as a broker. And of course mycontroller, just for the firmware updates of my MySensors nodes. I had no problems with firmware update until now, suddenly the OTA fails during upload, after half a day of research i came to conclusion that for some reason mycontroller SOMETIMES respond to firmware requests from my nodes with couple of seconds delay. MySensors nodes wait 500ms for a response, if no response in that time they retry up to 5 times, after that the OTA is stopped. So couple of seconds delay in mycontroler couses the OTA to fail. So I ran mycontroller on my pc (pc -> mqtt -> rpi with openhabian -> mysgw -> node) and everything works like a charm, so there must be something wrong with my mycontroller setup on rpi - but I have no clue what can ia do about it. This worked before without any problems, and for no reason it stopped. Nothing was changed on the rpi, no updates, no package installs, just openhab configuration.
    Please, does anybody know what can i do next to solve the problem ?


  • ADMIN

    @rozpruwacz I believe it is due to high load on RPI(running openhabian, mysgw with mqtt and mosquitto). Disable MQTT on MyController, if it is enabled.



  • but i'm using mqtt so why this would help me ?
    about the load, i was simultaneously checking the top output while uploading firmware, the only process with high load was the mycontroller process and it never reached 100%, more like 20-40%. And the rpi3 has 4 cores ... I know java is not very fast but c'mon, it's just sending several dozen bytes over tcp socket 🙂


  • MOD

    @rozpruwacz

    Hi, looking at it from a unix point of view...have you verified if the firmware file is ok?

    • Are the permissions changed (is the file readable/accessible for mycontroller?)
    • can the file be corrrupted?
    • was the firmware compiled for the correct arduino board?
    • might it be that the SD card is corrupted? (I has this issue last week, all seems okay, until you run into the strangest issues.....)
    • if you transfered the file using ftp. did you transfer it in binary mode?
    • uploading the hex file using the arduino ide, does that work?

    If you run:

    iotop
    

    are a lot of processes accessing your SD card?

    Another command to try is:

    iostat 5 20
    

    This shows you the average io statistics.

    A lot of questions i know, but this is basically the start, from here work our way up...



  • @tag said in firmware update on rpi problem:

    ere work

    well, I would say that it is not the problem with the firmware file, because i did a test with the modified node firmware where i changed the timeouts and nuber of retries and the OTA update succeeded (delay 1000ms and 10 retries), and the node worked ok on the updated firmware. so issues 1, 2, 3 and 6 are for sure not the problem.
    I'm not using ftp, i just add new firmware trough mycontroller web UI.
    sd card, not corrupted (the test with larger timeouts showed that) but maybe the sd card is close to wear out ? hope not because it is running Openhabian half a year and has 12G free space out of 16G. If nothing else will help I will change sd card to new one and see if that helps.

    So I will try the iotop and iostat. Thanks for ideas 🙂


  • MOD

    @rozpruwacz

    Welcome, it would be great if the SD card just stopped working, however that might not be the case... My 10 months "old" SD card started deteriorating piece by piece, it was a class 10, samsung 16GB. system "hung" suddenly, and did not want to boot anymore. Seems this process had started already some time ago.

    Flashed a multiple new images on the card without any errors (even after verification), still not able to boot... Then i tested the card with the command badblocks. this revealed a huge number of write errors and bad blocks... So only thing left was replace the card, first image I flashed on the new card worked like a charm. So there the research began to limit the writes to the card.

    Goodluck, and make a backup of your card now it is still readable 😉

    a quick test to see if every thing on your card is readable:

    dd if=/dev/sda of=/dev/null bs=512k
    

    (replace /dev/sda with the device file of your sdcard..)



  • This is the reason I moved to a pi3 for MYC. It can boot from USB and that is the way I think best to go, just need to read up on how it all works! 😉


 

Suggested Topics

16
Online

392
Users

365
Topics

2.2k
Posts