New WiPy 2.0 and LoPy Firmware released (version: 0.9.1.b1)


  • administrators

    The update is available here: https://www.pycom.io/support/supportdownloads/
    (under Firmware Updates)

    Release notes of version 0.9.1.b1:

    • Add the SPI class to the machine module
    • Add time.time(), time.localtime() and time.mktime() functions.
    • Complete the UART and Pin classes.
    • Implement the Pin alternate functions.
    • Fix rare crash when running the garbage collector.
    • Implement a partial machine.reset_cause() function.
    • Support getting and setting the DNS address with ifconfig().
    • Fix wlan.isconnected().
    • Fix the random generator function.
    • Add extra functions to configure pins in the RTC domain. This fixes the issue of pull up/down resistors not working on some pins.
    • Enable Activation By Personalization on the LoRa class.

    The documents will be updated later today.



  • @oneeyed Hi, I am having the same trouble as oneeyed. The first stage using the flash_debug.py has been completed once I installed the correct version of python (2.7) and removing all jumpers expect tx and rx.

    But whatever I try I am unable to upgrade the firmware. I am firmly stuck on 0.9.0b2. I have lopy and the expansion board v2.1.

    thank you



  • @daniel The flash update fixed my problems. I was immediately able to upgrade my firmware using the python update script. Thanks for getting the fix to us.



  • @daniel The transfer time seems to be due to ArchLinux's default FTP client (from GNU inetutils). Running Debian's default FTP client (from Linux netkit) leads indeed to transfer times between 3.8s and 4.9s.

    However, this still does not help with getting the version on board. Can you confirm that the checksum for the 868MHz version is correct?

    % md5sum /tmp/appimg.bin lopy_0.9.1.b1_868.bin 
    ce48656f828f652b04d608d763d3a08e  /tmp/appimg.bin
    ce48656f828f652b04d608d763d3a08e  lopy_0.9.1.b1_868.bin
    

    (side note: I also tried flashing the 915MHz version and got the same result: no update)


  • administrators

    There's something not going well with the file transfer:

    637568 bytes sent in 13.7 seconds (45.5 kbytes/s)
    

    It should not take more than 4 or 5 seconds to transfer the whole image. Can you try with a different computer? Do you get the same result after doing a safe boot?



  • @daniel It did not help, although everything looked fine:

    1. Confirm that the flash is not totally write-locked by writing a persisted file to it:
    >>> f = open("/flash/persisted-file.txt", "w")
    >>> f.write("This is a persisted file\n")
    25
    >>> f.close()
    >>> import machine
    >>> machine.reset()
    […reboot…]
    >>> import os
    >>> os.listdir("/flash")
    ['main.py', 'sys', 'lib', 'cert', 'boot.py', 'persisted-file.txt']
    >>> open("persisted-file.txt").read()
    'This is a persisted file\n'
    
    1. Reformat the /flash filesystem and check that it gets repopulated from scratch after reset:
    >>> import os
    >>> os.mkfs("/flash")
    >>> os.listdir("/flash")
    []
    >>> import machine
    >>> machine.reset()
    […reboot…]
    >>> import os
    >>> os.listdir("/flash")
    ['main.py', 'sys', 'lib', 'cert', 'boot.py']
    
    1. Upload the file (renamed from lopy_0.9.1.b1_868.bin) to /flash/sys (as expected, the file does not appear afterwards):
    % ftp 192.168.4.1
    Connected to 192.168.4.1.
    220 Micropython FTP Server
    Name (192.168.4.1:sam): micro
    331 
    Password: 
    230 
    Remote system type is UNIX.
    Using binary mode to transfer files.
    ftp> passive
    Passive mode on.
    ftp> cd flash
    250 
    ftp> cd sys
    250 
    ftp> put appimg.bin
    227 (192,168,4,1,7,232)
    150 
    426 
    637568 bytes sent in 13.7 seconds (45.5 kbytes/s)
    ftp> dir
    227 (192,168,4,1,7,232)
    150 
    226 
    
    1. Reset the board and check that it has not been updated properly:
    >>> import os
    >>> os.uname()
    (sysname='LoPy', nodename='LoPy', release='0.9.0.b2', version='f5444c7 on 2016-10-12', machine='LoPy with ESP32')
    

  • administrators

    @oneeyed if you can write files to flash that persist a power cycle then you have a different problem. It seems that for some reason the file transfer doesn't complete properly and therefore the firmware verification fails when the bootloader reboots.

    import os
    os.mkfs(`\flash`)
    

    and then trying all over again?

    Another way to do this manually:

    1. Connect to the lopy-wlan-xxxx network.
    2. Rename the firmware binary file to appimg.bin
    3. From where the appimg.bin file is located do on the command line:
    ftp 192.168.4.1
    ftp> passive
    ftp> cd flash
    ftp> cd sys
    ftp> put appimg.bin
    

    Wait until the transfer completes and reboot.



  • @daniel Thanks for working on this. However, I couldn't make it to work although the various steps look ok (except for the, well, flashing one). Note that the flash is not completely locked for me, as I can update files in /flash and have them persist a reset or a power cycle.

    Concerning the procedure outlined in your post:

    1. Connection done.
    2. Wiring done (as seen by the success of step 4)
    3. Reset done (as seen by the success of step 4)
    % python2 flash_debug_tool/flash_debug.py /dev/ttyUSB0 write 0x0 2
    Connecting...
    value: 0x0
    length: 2
    write 0x60002008 0x00000000 0x00400000
    write 0x60002010 0x00000000 0x00000000
    write 0x60002000 0x08000000 0xffffffff
    write 0x60002008 0x00000000 0x00400000
    write 0x60002010 0x00000000 0x00000000
    write 0x60002000 0x08000000 0xffffffff
    write 0x60002008 0x00000000 0x00400000
    write 0x60002010 0x00000000 0x00000000
    write 0x60002000 0x08000000 0xffffffff
    write 0x60002008 0x00400000 0x00400000
    write 0x60002010 0x00000000 0x0000ffff
    write 0x60002000 0x04000000 0xffffffff
    write 0x60002008 0x00000000 0x00400000
    write 0x60002010 0x00000000 0x00000000
    write 0x60002000 0x08000000 0xffffffff
    get status: 0x0
    ESP DEV DISCONNECT...
    
    1. Power cycle done by unplugging the USB port for 5 seconds (tried the following with both regular or safe mode settings).
    % python2 ./updater.py -f ../firmware/lopy_0.9.1.b1_868.bin --ip 192.168.4.1 --verify -r 0.9.1.b1 -b "LoPy with ESP32"
    Connected via Telnet, trying to login now
    Telnet login succeeded, lets check the git tag
    Board name OK
    FTP connection established
    Login successful
    Entered '/flash/sys' directory
    Firmware image found, initiating transfer...
    File transfer complete
    Connected via Telnet, trying to login now
    Telnet login succeeded
    Reset performed
    Waiting for the WiFi connection to come up again...
    Timeout while connecting via telnet, retrying...
    Connected via Telnet, trying to login now
    Telnet login succeeded, lets check the git tag
    Error: verification failed, the release version doesn't match
    

    Still on 0.9.0.b2.



  • @daniel, now you're having the same problem as the rest of us. I'm about to try the tool @daniel wrote about. Hoping it works.


  • administrators

    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. Power cycle the WiPy/LoPy.
    6. 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.



  • @daniel The problem is not the failure of the verification, it is the failure of the update operation.

    Adding the version number does not help in upgrading the board, but it makes it clearer indeed that it did not work:

    % python2 ./updater.py -f ../firmware/lopy_0.9.1.b1_868.bin --ip 192.168.4.1 --verify -r 0.9.1.b1 -b "LoPy with ESP32"
    Connected via Telnet, trying to login now
    Telnet login succeeded, lets check the git tag
    Board name OK
    FTP connection established
    Login successful
    Entered '/flash/sys' directory
    Firmware image found, initiating transfer...
    File transfer complete
    Connected via Telnet, trying to login now
    Telnet login succeeded
    Reset performed
    Waiting for the WiFi connection to come up again...
    Connected via Telnet, trying to login now
    Telnet login succeeded, lets check the git tag
    Error: verification failed, the release version doesn't match
    

    After this:

    >>> import os
    >>> os.uname().release
    '0.9.0.b2'
    

    I still cannot upgrade the board.



  • Hi,

    We have tried to get this update to work on 5 boards of which two have upgraded OK.

    Using the Windows upgrader it fails every time - with either a bland 'Upgrade failed' or 'wrong board type'. We managed after a great deal of trouble to get the 0.9.0.b2 upload, but this version 0.9.1.b1 seems to be refusing. We have also tried using FTP and copying across lopy_0.9.1.b1_915.bin to appimg.bin.

    Following numerous resets, restarts etc it still comes up as using version '0.9.0.b2' when we use os.uname().release

    Any ideas for a consistent route for upgrading, this seems to be a huge waste of time when we want to get on with development and working out the capabilites of the product.


  • administrators

    As @blinkenjim said, in order to use the updater manually the correct command would be:

    python2 ./updater.py -f ../firmware/lopy_0.9.1.b1_868.bin --ip 192.168.4.1 --verify -r 0.9.1.b1
    

    It's important to pass the release number with -r so that the verification can take place.



  • Having the same problem as @LoneTech and @oneeyed. I've tried using FTP directly to upload the firmware, and I've tried using updater.py. In both cases the upload succeeds, but the firmware version stays at 0.9.0b2. Tried the manual reset, as @Pieter suggests, but that makes no difference.

    @oneeyed: I've seen the problem you report with with the mpversion.h file not being found. That seems to happen if you don't provide a revision (-r flag) to the updater.py script; when you don't provide a revision for the firmware you're uploading, the script tries to determine the version by looking in a local source file, the header file mpversion.h. Try specifying the revision and see if your results change.



  • I managed to upgrade to 0.9.1.b1 by copying lopy_0.9.1.b1_868.bin through FTP to /flash/sys/appimg.bin machine.reset() didn't work but pressing the reset button on the board does the trick.



  • I have the same problem as @LoneTech after installing lopy_0.9.1.b1_868.bin throough FTP as /flash/sys/appimg.bin and resetting. Tried in regular/safe modes, with reset button and machine.reset() (in regular mode). Firmware seems to be stuck on the previous version:

    >>> import os
    >>> os.uname()
    (sysname='LoPy', nodename='LoPy', release='0.9.0.b2', version='f5444c7 on 2016-10-12', machine='LoPy with ESP32')
    

    The semi-automated procedure does not work better:

    % python2 ./updater.py -f ../firmware/lopy_0.9.1.b1_868.bin --ip 192.168.4.1 --verify -b 'LoPy with ESP32'
    Connected via Telnet, trying to login now
    Telnet login succeeded, lets check the git tag
    Board name OK
    FTP connection established
    Login successful
    Entered '/flash/sys' directory
    Firmware image found, initiating transfer...
    File transfer complete
    Connected via Telnet, trying to login now
    Telnet login succeeded
    Reset performed
    Waiting for the WiFi connection to come up again...
    Connected via Telnet, trying to login now
    Telnet login succeeded, lets check the git tag
    Exception: [Errno 2] No such file or directory: '../firmware/lopy_0.9.1.b1_868genhdr/mpversion.h', on line 251
    

    I understand that the last line is expected (the file being absent indeed), but after checking on the board, version 0.9.0.b2 of the firmware is still advertised.

    What is wrong here?



  • Having trouble loading it. The command line updater runs as before, but after reboot I'm still on 0.9.0.b2 on both of my boards. Updater's verify option still fails trying to find a mpversion.h file. Exactly the same result from failsafe mode (0.9.0b). Is there any way to get an indication of what firmwares are installed and if a firmware upload is accepted?


Log in to reply
 

Looks like your connection to Pycom Forum was lost, please wait while we try to reconnect.