How to solve the firmware update failures



  • Hello,

    The upgrade problems are caused by a bug in Espressif's IDF that is causing the flash memory of the module to be write protected. Espressif is working to provide a permanent solution for this as soon as possible. In the meantime they have given us a temporal way to solve it. The procedure is the following:

    Download this tool which needs to be executed as:

    python flash_debug.py /dev/ttyUSB0 write 0x0 2

    (/dev/ttyUSB0 will have to be replaced by the actual serial port on your system)

    Running the tool requires a serial connection to the module, Python 2 and Pyserial installed on your computer. The easiest way is via the expansion board. If an expansion board is not available then any USB-to-serial converter will work. The connection must be made on pins P0 (WiPy/LoPy RXD) and P1 (WiPy/LoPy TXD). Before running the tool, connect a cable jumper between GND and P2 (G23 on the expansion board), then reset the module and run the command. The total steps are:

    1. Connect the WiPy/LoPy via the serial port to your computer.
    2. Connect a cable jumper between GND and P2 (G23 on the expansion board).
    3. Reset the board.
    4. Run the command outlined above (python flash_debug.py /dev/ttyUSB0 write 0x0 2) and remember to pass the actual serial port on your system.
    5. Remove the cable jumper.
    6. Power cycle the WiPy/LoPy.
    7. Run the firmware update tool.

    We apologize for this issue but is completely out of our control. This is happening with all ESP32 based boards. I expect a solution from Espressif within a few days. Once that's done we will release a special firmware upgrade that will also install a new bootloader.

    For the firmware release next Tuesday we will integrate this unlock process in the firmware update to avoid any more manual steps.



  • This thread is being closed as the feedback and information contained here are now covered by the firmware upgrade tools. Please check the downloads section of our website to get the last versions of the tools.

    For further support on the tools please feel free to open a new thread.



  • @Xykon Thank you! Finally I was able to update... your post should get pin on top of this post. I connected my Lopy for the first time today and as written in the starting guide I started by the upgrade process. Thought it would be more straight-forward :P Anyway I understand bugs can happen at this early stage.



  • @Xykon Many thanks - I tried to use the standard pycom windows updater/patcher for 0.9.2.b1 which failed using the offical expansion board. It immediately returned with a "fail" every time I tried although REPL via Putty and PyMakr still worked fine. Having read this thread, I wondered if the high baud rate specified in Line 12 of updater.py might be the problem. Tried again using Windows GUI but still no joy. Finally, tried again using a command window and managed to update both my LoPy's first time. I'd spent a couple of weeks unable to update them over wifi and had write protect problems - hopefully all will me smoother now!

    Many thanks to all - especially Xykon - Great work - (another upvote for you!)


  • administrators

    @livius said in How to solve the firmware update failures:

    I have used official expansion board and without your changes - it not work
    Your fix work for me

    OK thanks for testing that.

    I usually have the module plugged into my PSoC5LP development board's breadboard so I can (among other things like testing I2C and SPI) do remote controlled resets in normal, safeboot and bootloader mode without having to connect any wires. Since that dev board has an RS232 converter on it I connected it to P0/P1 and used an FTDI RS232 cable to get access to the LoPy's UART0. I had a chat with abilio about it and tried again using the expansion board and this time it worked at the higher speed.

    Either way I guess the firmware updater should have an optional "high speed upload" switch to choose between 115200 and 921600 bps.



  • I have used official expansion board and without your changes - it not work
    Your fix work for me


  • administrators

    It turns out the problem with using 921600bps for firmware upload not working for me was my own test setup... if you use the official expansion board using just the command line on Windows without making changes to updater.py should work as well.

    If you happen to use RS232 for UART0 then reducing the firmware upload speed to 115200bps seems to be necessary.



  • @Xykon Thank you for the assistance - it worked like a dream :)



  • Xykon not LarryTru



  • @LarryTru
    you are the best :)

    This work for me - but Pymark still can not connect to WiPy2.0 :(
    Before upgrade it work ok.
    I can only conect by: wifi, ftp, telnet
    boot.py looks ok
    I also can see data sended by UART programmatically on com port monitor but Pymark can not :(


  • administrators

    OK I got the Windows updater to work as well (though not the GUI).

    First make the same modifications to "C:\Program Files (x86)\Pycom\Pycom Firmware Update\Upgrader\bin\updater.py"

    Line12: BAUD_RATE = 115200
    Line23:#self.esp.change_baud(baudrate)

    Now open a command prompt and run:

    cd "C:\Program Files (x86)\Pycom\Pycom Firmware Update\Upgrader"
    ..\Python27\python.exe bin\updater.py --port COM4 --file firmware\lopy_0.9.2.b1_868.bin

    Make sure that you choose the correct COM port and firmware file for your module/region.


  • administrators

    So far I did manage to get the Linux updater to work.

    In ./bin/updater I set BAUD_RATE = 115200 and commented #self.esp.change_baud(baudrate)

    I tried the same thing in the Windows version but it still doesn't work.



  • interested that UART work ok
    with com port monitor i retrive data without any problem only PYMAKR can not connect



  • Thank you for the help but it does not change anything
    still pymakr can not connect :(
    I see that update script does erase only some block(3.5MB)
    i ommit that and i clear block

    If someone have mre concept :)


  • administrators

    import os
    from machine import UART
    uart = UART(0, 115200)
    os.dupterm(uart)


  • administrators

    @livius There are some extra steps in the updater to preserve your flash memory (MAC address, files on /flash). Since you skipped these steps it's likely your boot.py was overwritten.

    Upload a new boot.py file with the following code:

    import os
    from machine import UART
    uart = UART(0, 115200)
    os.dupterm(uart)

    P.S. Does anyone know where to find the formatting guide for this forum? I've seen people post source codes with a nice black background and syntax highlighting. How do you do that? Is there a help button somewhere for this?



  • i do manual update by:
    esptool.py --chip esp32 --port COM8 --baud 115200 write_flash 0x210000 wipy_0.9.2.b1.bin -fs 4MB -z
    esptool.py --chip esp32 --port COM8 --baud 115200 write_flash 0x204000 partitions.bin -fs 4MB -z
    esptool.py --chip esp32 --port COM8 --baud 115200 write_flash 0x201000 bootloader.bin -fs 4MB -z

    i can connect by ftp and by telnet

    by tenet i got:

    import os
    os.uname()
    (sysname='WiPy', nodename='WiPy', release='0.9.2.b1', version='333b92c on 2016-10-26', machine='WiPy with ESP32')

    but when i start wipy2.0 with board2.0
    i can not connect by pymark - i do not know why it not "listen" on UART
    but i can do above operations again - and as i understand corectly it is done by UART?



  • Thanks for pointing this out. It must be an issue with the windows build of the updater, since the mac version works. We'll try to figure it out and get back to you guys as soon as we can.



  • The correct 0.9.2.b1 is in the 'firmware' folder. I tried copying into the main 'upgrader' folder, but, the Upgrader still fails. Thought it might be the version of python (I was running 3.5) but, 2.7.12 fails also.



  • Maybe because it is still wipy_0.9.1.b1.bin not wipy_0.9.2.b1.bin
    i look into the folder and there is 1 not 2.


Log in to reply
 

Pycom on Twitter