pycom / pycom-micropython-sigfox

A fork of MicroPython with the ESP32 port customized to run on Pycom's IoT multi-network modules.
MIT License
199 stars 167 forks source link

machine.sleep with resume_wifi_ble=True crashes #275

Open Changed-Daily opened 5 years ago

Changed-Daily commented 5 years ago

Pycom board: OEM module W01. Firmware: (sysname='WiPy', nodename='WiPy', release='1.20.0.rc7', version='v1.9.4-2833cf5 on 2019-02-08', machine='WiPy with ESP32')

Code to reproduce issue:

from network import Bluetooth
import machine
import time

bt = Bluetooth()
bt.init()

bt.set_advertisement( name="ABC", manufacturer_data="XYZ" )

bt.advertise( True )

print("Starting...")

while ( True ):

    print( "Advertising" )
    time.sleep( 5 )
    print( "Going to sleep..." )
    machine.sleep( 5000, True )

Expected output: Starting... Advertising Going to sleep... Advertising Going to sleep...

Actual output:

Starting... Advertising Going to sleep... Advertising ASSERT_PARAM(512 0), in rwble.c at line 230

I have also tried with probably all combinations of init, deinit of Bluetooth before and after machine.sleep but the result is always the same error message.

It may be that the next release v1.20.0.rc7.1 has a workaround with: bluetooth = Bluetooth(modem_sleep=False)

Are the binaries available for that build anywhere?

chriskoz commented 5 years ago

I have encountered this same issue using a v1.20.0.rc7.2 build and the "Bluetooth(modem_sleep=False)" option. (not sure about v1.20.0.rc7.1)

I was just about to open an issue until I saw this. And there appears to be related comments on this issue: https://github.com/pycom/pycom-micropython-sigfox/issues/259#issuecomment-463416732.