initializing LoRa with region gives core dump



  • All the examples for LoRa from the pycom-libraries repository seem to be broken with the latest LoPy4 1.20.2.rc11 firmware.

    When the module is initialized without passing a region it generates an "ValueError: no region specified and no default found in config block".

    When a region is passed, it immediately gives a core dump.

    I get the same behavior when I attach the LoPy to a pysense 2.0x or to a pygate.

    I tried also the LoPy4 1.20.2.rc10 firmware. Same results.



  • @ichatz For esptool.py you have to connect P2 to GND and push reset before running esptool.py.
    But besides that it looks like the right board & chip. The only thing strange is the reported revision number. The Pycom firmware makes it's setting of flash & spiram dependent on the revision number reported as > 0 or not. So maybe you could try again with esptool.py.



  • @robert-hh On the LoPy4 + PySense 2.0X + your 1.20.2.rc10 firmware, the gc.mem_free() gives: 2540592.

    Pressing ctrl+B gives:

    Pycom MicroPython 1.20.2.rc11 [v1.20.1.r2-319-g7e06b07] on 2020-10-18; LoPy4 with ESP32
    Type "help()" for more information.
    

    I got the v2.0-beta1 esptool.py from the pycom repository at https://github.com/pycom/esptool. This is what I get:

    python3 esptool.py --port /dev/ttyACM0 chip_id
    esptool.py v2.0-beta1
    esptool.py:2023: DeprecationWarning: inspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec()
      operation_args,_,_,_ = inspect.getargspec(operation_func)
    Connecting...........................................
    
    A fatal error occurred: Failed to connect to Espressif device: Invalid head of packet (b'\x08')
    

    When I use the pycom-fwtool-cli I get the following:

    pycom-fwtool-cli -p /dev/ttyACM0 chip_id
    Running in PIC mode
    ESP32D0WDQ6 (revision (unknown 0xa))
    

    alt text



  • @ichatz can you post a picture of your device? And, with my firmware, the result of:
    import gc
    gc.collect()
    gc.mem_free()

    And what is reported on pushing ctrl-B at the prompt and by

    esptool.py -p xxxxx chip_id



  • @jcaron So I first used erase_all, then I flashed the LoPy4-1.20.2.rc11.tar downloaded from the site, and then I fixed the default region of lpwan to EU868.

    After booting the device, I did an extra os.fsformat('/flash') - although I am not sure if this was needed.

    Now lora gives me a core dump even if I do not set the region.

    On top of that, it seems like for the LoPi4 + Pygate the WLAN is not setting up in station mode. Essentially the module freezes - without a core dump.



  • @ichatz That's fine. The package I've sent was just to confirm, that hardware and set-up is working. There is also a legacy variant of the Pycom firmware, which does not include PyBytes support. The entry page is here: https://docs.pycom.io/advance/downgrade/
    The versions lag a little bit, but at least 1.20.2rc10 is available.

    I still think that the regular firmware should work. Did you try what @jcaron suggested? Erasing flash and then reloading the firmware.



  • @robert-hh I used the firmware you've provided and the problem was solved directly. Now I have the both nanogateway + lopy4 ABP.

    Many thanks!

    On the other hand, with the previous firmware, trying to disable pybytes with your code - this did not work. The question here is if the problem will persist with future firmware updates.



  • @ichatz Have you tried erasing all data when flashing, and of course setting a region while flashing? The updater should do that for you.



  • @ichatz Strange. Peter is from Pycom, and the path is the one on his development system. I am using a home-built version without pybytes. I have uploaded a tarball here: https://github.com/robert-hh/Shared-Stuff
    In order to exclude PyBytes, you can disable it with:

    import pycom
    pycom.pybytes_on_boot(False)



  • @robert-hh In fact I get the same error even when I do not specify the LORAWAN/LORA mode.

    >>> from network import LoRa
    >>> lora = LoRa()
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ValueError: no region specified and no default found in config block
    

    and similarly when I only specify the region, I get the same core dump.

    >>> lora = LoRa(region=LoRa.EU868)
    /home/peter/docs/pycom-esp-idf/components/freertos/event_groups.c:498 (xEventGroupClearBits)- assert failed!
    abort() was called at PC 0x40099314 on core 1
    
    ELF file SHA256: 0000000000000000000000000000000000000000000000000000000000000000
    
    Backtrace: 0x400901a7:0x3ffe2db0 0x40090329:0x3ffe2dd0 0x40099314:0x3ffe2df0 0x40118557:0x3ffe2e10 0x40118a75:0x3ffe2e30 0x40118ae8:0x3ffe2f60 0x4010c8a2:0x3ffe2fd0 0x401044b9:0x3ffe2ff0 0x40111b49:0x3ffe3010 0x401081a4:0x3ffe30b0 0x401044b9:0x3ffe3110 0x401044e6:0x3ffe3130 0x400e1e9d:0x3ffe3150 0x400e2128:0x3ffe31f0 0x400e0a05:0x3ffe3230
    
    ================= CORE DUMP START =================
    ...
    ================= CORE DUMP END =================
    Rebooting...
    ets Jun  8 2016 00:22:57
    
    rst:0xc (SW_CPU_RESET),boot:0x1a (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
    Smart Provisioning started in the background
    


  • @robert-hh I am trying 2 hardware setups:

    • LoPy4 + PySense 2.0x
    • LoPy4 + PyGate

    I use 2 different USB cables powered from my laptop.
    I also use 2 different LoPy4 modules.

    Firmware:

    • The PyGate has been upgraded to the latest firmware found on the website: 12a
    • The PySense 2.0X comes with the latest firmware. No updated done here.
    • For the LoPy4 I tried the 2 latest rc:
      ** sysname='LoPy4', nodename='LoPy4', release='1.20.2.rc11', version='v1.11-d574024 on 2020-08-25', machine='LoPy4 with ESP32', lorawan='1.0.2', sigfox='1.0.1', pybytes='1.5.2', pygate='1.0.1'
      ** sysname='LoPy4', nodename='LoPy4', release='1.20.2.rc10', version='v1.11-b2436d4 on 2020-07-01', machine='LoPy4 with ESP32', lorawan='1.0.2', sigfox='1.0.1', pybytes='1.5.0', pygate='1.0.1'

    The code without using the region parameter that I use is the following:

    >>> from network import LoRa
    >>> lora = LoRa(mode=LoRa.LORAWAN)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ValueError: no region specified and no default found in config block
    

    While when passing the region, as follows:

    >>> lora = LoRa(mode=LoRa.LORAWAN, region=LoRa.EU868)
    /home/peter/docs/pycom-esp-idf/components/freertos/event_groups.c:498 (xEventGroupClearBits)- assert failed!
    abort() was called at PC 0x40099314 on core 1
    
    ELF file SHA256: 0000000000000000000000000000000000000000000000000000000000000000
    
    Backtrace: 0x400901a7:0x3ffe2da0 0x40090329:0x3ffe2dc0 0x40099314:0x3ffe2de0 0x40118557:0x3ffe2e00 0x40118a75:0x3ffe2e20 0x40118ae8:0x3ffe2f50 0x4010c8a2:0x3ffe2fc0 0x401044b9:0x3ffe2fe0 0x40111b49:0x3ffe3000 0x401081a4:0x3ffe30a0 0x401044b9:0x3ffe3110 0x401044e6:0x3ffe3130 0x400e1e9d:0x3ffe3150 0x400e2128:0x3ffe31f0 0x400e0a05:0x3ffe3230
    
    ================= CORE DUMP START =================
    ...
    ================= CORE DUMP END =================
    Rebooting...
    ets Jun  8 2016 00:22:57
    

    I am not sure who's that Peter there, but clearly something did not work out properly.

    I get the exact above behavior with any of the examples found under the https://github.com/pycom/pycom-libraries/tree/master/examples repository. That is,

    • lopy-lopy
    • loraNanoGateway
    • loraabp
    • loramac
    • lorawan-nano-gateway
    • lorawan-regional-examples

    Which firmware do you use? What is your setup?



  • @ichatz Can you list a specific example from the library for cross check, so we have the exactly same set-up?
    And can you publish the output of the core dump, especially the reason for reset.
    I cannot confirm your observation with my configuration here. It is more likely that there is a problem with either your configuration or your board. Possible reasons:

    • weak power supply. That can be caused by the USB cable or the interface board.
    • Corrupted flash. You can do a full flash erase and then reload firmware.
    • Last not least: defective LoPy4 board. If that's the case and it is new, contact the shop and have it replaced.

Log in to reply
 

Pycom on Twitter