Becuase of firmware or not?



  • Hi,

    I am just curious, we had some issues with GPys and it seems like that it is related to firmware of the device.

    In the past we could use

    from machine import
    import ujson, time, pycom, led
    

    but that seems to have been abandoned, and now we have to go like so:

    from machine import
    import ujson, time, pycom
    from lib import led
    

    just wanted to confirm this is an update, not a bug, before we start rewriting the code. Any links to documentation or a change log that confirms this is an actual change would be highly appreciated.



  • Case closed, we found it and it was our own mistake.



  • @robert-hh Thanks for asking, The value of sys.path is:

    ['', '/flash', '/flash/lib']
    


  • @Don-iot what is the value of sys.path?



  • I really cannot think of anything here..
    This is my result, using one of my pysense projects here to show you: (Its on an expansionboard, so we expect the I2C to not work

    >>> ets Jun  8 2016 00:22:57
    
    rst:0x7 (TG0WDT_SYS_RESET),boot:0x12 (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:0x3fff8020,len:8
    load:0x3fff8028,len:2128
    load:0x4009fa00,len:19760
    entry 0x400a05bc
    Pycom MicroPython 1.20.2.r4 [v1.11-ffb0e1c] on 2021-01-12; FiPy with ESP32
    Type "help()" for more information.
    >>> 
    Reading file status
    ", line 3, in <module>
    OSError: [Errno 2] ENOENT
    >Failed to read project status, uploading all files
    Creating dir lib
    ", line 3, in <module>
    OSError: [Errno 17] EEXIST
    >[1/8] Writing file blink.py (5kb) with compression
    [2/8] Writing file lib/LIS2HH12.py (7kb) with compression
    [3/8] Writing file lib/LTR329ALS01.py (3kb)
    [4/8] Writing file lib/MPL3115A2.py (5kb) with compression
    [5/8] Writing file lib/SI7006A20.py (5kb) with compression
    [6/8] Writing file lib/pycoproc.py (14kb) with compression
    [7/8] Writing file lib/pysense.py (1kb)
    [8/8] Writing file main.py (13kb) with compression
    Upload done, resetting board...
    OKets Jun  8 2016 00:22:57
    
    rst:0x7 (TG0WDT_SYS_RESET),boot:0x12 (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:0x3fff8020,len:8
    load:0x3fff8028,len:2128
    load:0x4009fa00,len:19760
    entry 0x400a05bc
    3 main.pycoproc
    i2c_scan
    []
    Couldn't init Pycoproc. Maybe the PIC is still napping. Try to wake it. (Board not detected: I2C bus error)
    Traceback (most recent call last):
      File "main.py", line 282, in <module>
      File "main.py", line 282, in <module>
      File "/flash/lib/pysense.py", line 20, in __init__
      File "/flash/lib/pycoproc.py", line 117, in __init__
      File "/flash/lib/pycoproc.py", line 117, in __init__
    Exception: Board not detected: I2C bus error
    Pycom MicroPython 1.20.2.r4 [v1.11-ffb0e1c] on 2021-01-12; FiPy with ESP32
    Type "help()" for more information.
    >>>  import MPL3115A2
    >>> from lib import MPL3115A2
    

    Both options work fine for me. Let me know what you get!

    Gijs



  • It should be uploaded via VSCode as we have already done successfully in a couple of hundred successfully deployed devices. The question is why it works when we add "from lib" and not just import? Using the latest pybytes firmware, any conflicts that you can think of? Aren´t any changelogs available as far as I know between firmwares so solving these kind of questions gets a bit over complicated.



  • Ah sorry, I was not aware that led was a custom library you wrote and attached in the lib folder. As far as I'm aware, there have been no changes there, and import led should still work fine, iff the file is uploaded to the device correctly (not just pressing the 'play' button in pymakr)

    lmk
    Gijs



  • Thank @Gijs but the code is far more complex. led is defined in led.py where we have a couple of 100 rows of code to define how led should work in different states as a status indicator. There are numerous other functions called the same way, and for some reason there seems to have been a change in the firmware that is blocking the way we used to call the functions, now we are trying to figure out what has changed in latest fw-version so we can correct or downgrade to a previous version.



  • You mention:

    from machine import
    import ujson, time, pycom
    from lib import led
    

    But I cannot get that to work on the latest firmware?
    If you are planning to control the onboard rgb led, you can do with

    import pycom
    
    pycom.heartbeat(False)
    pycom.rgbled(0xRRGGBB)
    

    with 0xRRGGBB replaced with a hexadecimal value with RR = red, GG= green and BB=blue brightness

    Let me know if im mistaken.

    Best,
    Gijs


Log in to reply
 

Pycom on Twitter