Fresh USB power up on WiPy 3 with expansion causes different code to be executed



  • Recently I purchased a new WiPy 3 with an Expansion (v3.0r) board. As usually, I first started with a latest firmware upgrade 1.17.3.b1 (using pycom_firmware_update_1.12.0.b0 tool) and afterwards I uploaded a code base for a project that I am working on. The code that I used was working fine and the firmware version seems to be stable. However, I have a strange behavior with my setup. If I unplug USB cable and plug it back in the expansion board, WiPy does not run my code base and executes something else. First indication of this anomaly was that integrated RGB LEDs was running with different instructions then what I have in my code and ends with an blinking blue heartbeat signal. Once I connected to the serial terminal of the USB I get this:

    Traceback (most recent call last):
      File "<stdin>", line 1
    SyntaxError: invalid syntax
    >>>
    

    Once I press reset button on the WiPy, terminal shows normal load process and execution output of my code.

    Traceback (most recent call last):
      File "<stdin>", line 1
    SyntaxError: invalid syntax
    >>> ets Jun  8 2016 00:22:57
    
    rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
    mode:DIO, clock div:1
    load:0x3fff8028,len:8
    load:0x3fff8030,len:1728
    load:0x4009fa00,len:0
    load:0x4009fa00,len:14584
    entry 0x400a059c
    1-1-1970 0:0:2 > WiFiConnect...
    ... here comes output of my code ...
    

    The faulty boot prompt shows that WiPy is still with my current firmware version:

    Traceback (most recent call last):
      File "<stdin>", line 1
    SyntaxError: invalid syntax
    >>> import os
    >>> os.uname()
    (sysname='WiPy', nodename='WiPy', release='1.17.3.b1', version='v1.8.6-849-83e2f7f on 2018-03-19', machine='WiPy with ESP32')
    >>>
    

    Why does WiPy not load my code at the first boot when freshly powered up? And how can I fix this?

    I also tried erasing the flash which seams to work after rest button press:

    Traceback (most recent call last):
      File "<stdin>", line 1
    SyntaxError: invalid syntax
    >>> import os
    >>> os.mkfs('/flash')
    >>> ets Jun  8 2016 00:22:57
    
    rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
    mode:DIO, clock div:1
    load:0x3fff8028,len:8
    load:0x3fff8030,len:1728
    load:0x4009fa00,len:0
    load:0x4009fa00,len:14584
    entry 0x400a059c
    MicroPython v1.8.6-849-83e2f7f on 2018-03-19; WiPy with ESP32
    Type "help()" for more information.
    >>>
    

    But after USB unplug I see the same:

    Traceback (most recent call last):
      File "<stdin>", line 1
    SyntaxError: invalid syntax
    >>>
    

    After reset press on the WiPy, it loads to the clean REPL:

    Traceback (most recent call last):
      File "<stdin>", line 1
    SyntaxError: invalid syntax
    >>> ets Jun  8 2016 00:22:57
    
    rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
    mode:DIO, clock div:1
    load:0x3fff8028,len:8
    load:0x3fff8030,len:1728
    load:0x4009fa00,len:0
    load:0x4009fa00,len:14584
    entry 0x400a059c
    MicroPython v1.8.6-849-83e2f7f on 2018-03-19; WiPy with ESP32
    Type "help()" for more information.
    >>>
    

    Your help would be really appreciated.



  • Can you tell me what is the behavior of the WiPy when connecting P8 with +3.3v?



  • Wow... that fixes it!

    I connected 3v3 pin with G2 pin on my expansion and it boots up fine now!

    What does it mean exactly?


  • administrators

    Could you try pull-up P8 pin of Wipy3; basically connect it directly with 3V3 (3rd from right-up). P8 is the 5th from left-down.

    0_1524646644890_Screen Shot 2018-04-25 at 11.54.38.png



  • It looks that the problem is with the expansion board, as it boots up fine when I powered it directly without an expansion board. I was able to telnet to the system. Did several power re-cycles and it looks ok.

    I tried removing all the jumpers but still the same issue. Tested the push buttons "S1" and "Safe Boot" just in case they are not faulty (e.g. shortened out), but also that seems ok.

    What else could be there?



  • I don't have other expansion borads, so cannot test it. I was thinking about powering the WiPy 3 with 5v directly to VIN pin and see if it loads my code. But I first need to figure out where to get 5v power source. Will let you know about the outcome.


  • administrators

    hi @kaspars, could we try to isolate the problem to see if this is Wipy3 or Expansion3?
    Do you have any Expansion Board2/Pytrack/Pysense to try it with that Wipy3?
    Or any other Lopy/Wipy2/*py boards to try the same script with the Expansion3?



  • I run minicom -D /dev/ttyACM0 and I got output of my previous code showing, although I did os.mkfs('/flash') before. That was unexpected.

    So I did the os.mkfs('/flash') once more fallowed by machine.reset(). That gave REPL console:

    >>> import os
    >>> os.mkfs('/flash')
    >>> import machine
    >>> machine.reset()
    ets Jun  8 2016 00:22:57
    
    rst:0x7 (TG0WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
    mode:DIO, clock div:1
    load:0x3fff8028,len:8
    load:0x3fff8030,len:1728
    load:0x4009fa00,len:0
    load:0x4009fa00,len:14584
    entry 0x400a059c
    MicroPython v1.8.6-849-83e2f7f on 2018-03-19; WiPy with ESP32
    Type "help()" for more information.
    >>>
    

    But after power re-cycle I get this:

    >>> 
    >>> w�k�й�5�~x~~x~
    Traceback (most recent call last):
      File "<stdin>", line 1
    SyntaxError: invalid syntax
    >>>
    

    Then I did a new power re-cycle and I get:

    >>> �r������~x~
    

    If I now press enter I get:

    >>> �r������~x~
    Traceback (most recent call last):
      File "<stdin>", line 1
    SyntaxError: invalid syntax                                                                                                            
    >>>
    

  • administrators

    What platform do you have?
    Could you use on Mac or Linux minicom (minicom -D /dev/tty.usbmodemPyc4fbc1) or on Windows maybe real-term to show you the exact serial messages from the moment you plugged-in the USB?
    These terminals resume connection when USB is plugged-in.



  • It is irrelevant of the code you have, as I had the same problem when starting my setup with erased flash.

    File "<stdin>", line 1
    SyntaxError: invalid syntax
    >>> import os
    >>> os.mkfs('/flash')
    >>> ets Jun  8 2016 00:22:57
    
    rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
    mode:DIO, clock div:1
    load:0x3fff8028,len:8
    load:0x3fff8030,len:1728
    load:0x4009fa00,len:0
    load:0x4009fa00,len:14584
    entry 0x400a059c
    MicroPython v1.8.6-849-83e2f7f on 2018-03-19; WiPy with ESP32
    Type "help()" for more information.
    >>>
    

    After fresh power up I get the error message again:

    Traceback (most recent call last):
      File "<stdin>", line 1
    SyntaxError: invalid syntax
    >>>
    

    Could it be due to some hardware issue on my WiPy3 device?


  • administrators

    Ok, no battery, I could not reproduce this problem. I've used a simple script, connecting to Wifi, and displaying some messages.
    Could you share an exact (mind the wifi AP password) minimal script that fails in your case?

    import time
    import sys
    import os
    import uos
    import machine
    
    print(os.uname())
    print("Flash encryption: %d" %(machine.flash_encrypt()))
    print("Secure boot: %d" %(machine.secure_boot()))
    print("OTA next slot address: 0x%X" %(pycom.ota_slot()))
    print("Free flash: %d" %(uos.getfree("flash")))
    
    import connect_to_wifi
    connect_to_wifi.catalin_wifi()
    
    print("Done")
    time.sleep(0.5)```


  • Hi @catalin, not. I am powering expansion with USB. There is no other power source.


  • administrators

    hi @kaspars, just to be sure I've understood, you're using a battery connected with the Expansion3?


 

Pycom on Twitter