8000 BLE - OSError: connection refused · Issue #15 · pycom/pycom-micropython-sigfox · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

BLE - OSError: connection refused #15

Closed
Bucknalla opened this issue May 31, 2017 · 2 comments
< 8000 svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-issue-closed flex-items-center mr-1"> Closed

BLE - OSError: connection refused #15

Bucknalla opened this issue May 31, 2017 · 2 comments

Comments

@Bucknalla
Copy link
(sysname='LoPy', nodename='LoPy', release='1.6.13.b1', version='v1.8.6-607-g9c8a0e9e on 2017-05-01', machine='LoPy with 
ESP32', lorawan='1.0.0') 

Attempting to connect from one LoPy to another LoPy device:

from network import Bluetooth
import binascii
bluetooth = Bluetooth()

# scan until we can connect to any BLE device around
bluetooth.start_scan(-1)
adv = None
while True:
    adv = bluetooth.get_adv()
    if adv:
        try:
            print(binascii.hexlify(adv.mac))
            bluetooth.connect(adv.mac)
        except:
            # start scanning again
            bluetooth.start_scan(-1)
            continue
        break
print("Connected to device with addr = {}".format(binascii.hexlify(adv.mac)))

Error arises after the connecting LoPy finds the address of the advertising device and attempts to connect.

b'240ac40061fa'
Traceback (most recent call last):                                                                                      
  File "<stdin>", line 50, in <module>                                                                                  
OSError: connection already closed

                                                                         
Thanks!

@grandcat
Copy link
grandcat commented Jun 1, 2017

Maybe try bluetooth.init() after bluetooth = Bluetooth()

@danicampora
Copy link

Solved on the latest release.

iwahdan88 pushed a commit that referenced this issue Feb 8, 2019
iwahdan88 pushed a commit that referenced this issue Feb 8, 2019
commit a3a8dec
Author: iwahdan88 <islam@pycom.io>
Date:   Fri Feb 8 20:37:05 2019 +0100

    esp32/modlte: minor fix

commit 52ece9c
Author: iwahdan88 <islam@pycom.io>
Date:   Fri Feb 8 20:13:19 2019 +0100

    Updated Pybytes scripts + updated pycom version

commit 2b28d49
Author: Islam Wahdan <islam@pycom.io>
Date:   Fri Feb 8 19:19:45 2019 +0100

    esp32/make: Fix Makefile bug where SIPY FIPY and LOPY4 excluded secure boot + fix bug in may-build-check.sh (#18)

commit e078fcc
Author: Catalin Ioana <catalin.ioana@pycom.io>
Date:   Fri Feb 8 20:18:11 2019 +0200

    Pymesh feature added from Pygo to Lopy (#16)

    * Squashed all openthread commits into a single one.

    esp32/mesh: saving settings in NVM; RSSI is computed considering SNR

    lora-mesh: forced Lora MAC as 802.15.4 Extended Address (not random anymore)

    esp32/lora: openthread socket UPD packets are 512B max, and 8 are buffered

    esp32/lora: added lora.mstatus, role, neighbors, routers micropy commands

    esp32/lora: increased mesh task priority (6), delay just 1ms, lora deinit

    esp32/lora: added mesh rx callback, increased mpy isr stack; removed server task

    esp32/mods added machtouch, frozen python scripts for oled, pytrack and msgpack

    esp32: openthread synch'ed with branch openthread_1_Nov from pycom-esp-idf

    sigfox task not started, some micropy wrapper for busy channel

    Lora sleep time decreased

    Lora LBT implemented

    openthread: 14 Dev 2018, fixed NVS usage, RSSI without SNR

    esp32: openthread cli fixed

    esp32: modlora added Border Router

    * Squashed all openthread commits into a single one.

    esp32/mesh: saving settings in NVM; RSSI is computed considering SNR

    lora-mesh: forced Lora MAC as 802.15.4 Extended Address (not random anymore)

    esp32/lora: openthread socket UPD packets are 512B max, and 8 are buffered

    esp32/lora: added lora.mstatus, role, neighbors, routers micropy commands

    esp32/lora: increased mesh task priority (6), delay just 1ms, lora deinit

    esp32/lora: added mesh rx callback, increased mpy isr stack; removed server task

    esp32/mods added machtouch, frozen python scripts for oled, pytrack and msgpack

    esp32: openthread synch'ed with branch openthread_1_Nov from pycom-esp-idf

    sigfox task not started, some micropy wrapper for busy channel

    Lora sleep time decreased

    Lora LBT implemented

    openthread: 14 Dev 2018, fixed NVS usage, RSSI without SNR

    esp32: openthread cli fixed

    esp32: modlora added Border Router

    * esp32/application.mk: added group of lora openthread files, buit only if OPENTHREAD flag is enable (yes by default)

    * esp32: added modmesh.c as micropy wrapper for mesh commands from modlora.c

    * esp32/mods/modmesh: added Mesh.deinit command, removed debug, made functions static

    * esp32/lib: updated idf libraries, from idf_v3.1

    * esp32/modmesh: modmesh task is started dinamically at Lora.Mesh() and erased at Lora.Mesh.deinit()

commit ad55267
Author: Islam Wahdan <islam@pycom.io>
Date:   Fri Feb 8 18:11:37 2019 +0100

    esp32/modlte: Added factory modem reset option , method to check UE coverage and Bug fixes (#17)

commit 98000bb
Author: Martijn Thé <martijnthe@users.noreply.github.com>
Date:   Fri Feb 1 17:15:07 2019 +0100

    build config: make openthread over lora a build-time configuration option (#253)

    Adds a make variable to disable openthread. By default it's still enabled.
    To disable it, add `OPENTHREAD=off` to the `make` invocation.
    This shaves off 160KB of the .bin, making the firmware fit in the old OTA slot of 1536KB.

commit 1eb354a
Author: Géza Husi <husigeza91@gmail.com>
Date:   Thu Jan 31 10:30:12 2019 +0100

    esp32/mods/modusocket.c: adding do_handshake for non-blocking sockets (#13)

commit 733cf7e
Author: Islam Wahdan <islam@pycom.io>
Date:   Thu Jan 31 10:28:33 2019 +0100

    esp32/mphal: Fix issue causing Device crash when safe booting (CTRL-F) while BLE/Wlan enabled (#15)

commit 7ce6f7e
Author: Géza Husi <husigeza91@gmail.com>
Date:   Wed Jan 30 21:27:10 2019 +0100

    esp32/mpthreadport.c: fix an issue in cleaning up user threads during of soft-reset (#14)

    Fixes issue [PYFW-197]

commit a83e360
Author: iwahdan88 <islam@pycom.io>
Date:   Mon Jan 28 19:14:23 2019 +0100

    Esp32/frozen/MQTTlib: Gracefully handle EAGAIN return of Socket.write

commit f2a33ba
Author: iwahdan88 <islam@pycom.io>
Date:   Wed Jan 23 18:41:12 2019 +0100

    Fix linking Issue

commit 622a235
Merge: b886f41 1058d3b
Author: iwahdan88 <islam@pycom.io>
Date:   Wed Jan 23 18:24:58 2019 +0100

    Merge remote-tracking branch 'public/release-candidate'

    # Conflicts:
    #	esp32/pycom_version.h

commit b886f41
Author: iwahdan88 <islam@pycom.io>
Date:   Tue Jan 22 11:17:41 2019 +0100

    IDF v3.1 update

commit a6ebe1e
Author: iwahdan88 <islam@pycom.io>
Date:   Mon Jan 21 10:27:22 2019 +0100

    Merge HEAD of release-candidate 1.20.0

commit 87f2d8b
Author: iwahdan88 <islam@pycom.io>
Date:   Sat Jan 19 15:09:59 2019 +0100

    esp32/ltepp: bug fix for lteppp suspend

commit 0b6307f
Author: iwahdan88 <islam@pycom.io>
Date:   Sat Jan 19 14:25:06 2019 +0100

    Merge of Public repo [release-candidate] Head.

commit c16daf9
Author: iwahdan88 <islam@pycom.io>
Date:   Fri Jan 18 18:40:25 2019 +0100

    esp32: Updated Pypytes scripts

commit a7a2e9e
Author: iwahdan88 <islam@pycom.io>
Date:   Fri Jan 18 17:58:26 2019 +0100

    esp32: help- Removed CRTL-D from PYBYTES build + minor fixes

commit bda5261
Author: iwahdan88 <islam@pycom.io>
Date:   Fri Jan 18 17:04:01 2019 +0100

    esp32: On Boot wifi AP defaults now to DEFAULT wifi ssid and Password

commit ff3b397
Author: iwahdan88 <islam@pycom.io>
Date:   Fri Jan 18 16:54:18 2019 +0100

    esp32: updated version

commit 42f4108
Author: Islam Wahdan <islam@pycom.io>
Date:   Fri Jan 18 16:06:33 2019 +0100

    Update to LTE module (#12)

    * Update modlte.c

    * esp32/modlte: Refactoring

commit 81573b3
Author: iwahdan88 <islam@pycom.io>
Date:   Wed Jan 16 13:30:54 2019 +0100

    esp32/lteppp: updated PPP Suspend mechanism

commit d9085a4
Author: iwahdan88 <islam@pycom.io>
Date:   Tue Jan 15 21:51:40 2019 +0100

    esp32/lteppp: improving lteppp suspend/resume mechanism

commit c887d32
Author: iwahdan88 <islam@pycom.io>
Date:   Mon Jan 14 20:19:19 2019 +0100

    esp32/lteppp: added suspen/resume functinality to lteppp

commit 0650a29
Author: iwahdan88 <islam@pycom.io>
Date:   Thu Jan 17 20:02:19 2019 +0100

    esp32: Minor bug fix for Secure Boot

commit d8769fd
Author: iwahdan88 <islam@pycom.io>
Date:   Wed Jan 16 17:46:45 2019 +0100

    esp32: Removed CRTL-D function in PyBytes Firmware + minor bug fix

    - Removed CRTL-D function in PyBytes Firmware
    - Fixed `mpy-build-check.sh` and 'size_check.sh' scripts to handle PyBytes Build Directory

commit 215fcd2
Author: iwahdan88 <islam@pycom.io>
Date:   Wed Jan 16 14:23:43 2019 +0100

    esp32/sdkconfig.h: synced with IDF v3.1

commit a541954
Author: Christian Ehlers <cehlers@pycom.io>
Date:   Tue Jan 15 12:35:19 2019 +0100

    Update sqnsupgrade (#11)

    From sqnsupgrade master

commit d586893
Merge: 9e091a5 1b5eba3
Author: iwahdan88 <islam@pycom.io>
Date:   Mon Jan 14 22:17:24 2019 +0100

    Merge branch 'attach-legacy'

commit 9e091a5
Author: Christian Ehlers <cehlers@pycom.io>
Date:   Mon Jan 14 21:59:23 2019 +0100

    esp32/modlte: updated

    * Setting APN with corresponding IP Protocol  [IP / IPV6]

    * No more exception when calling `LTE.connect` when already connected

    * Setting Connection ID in Init function

    * Renamed `lte.dettach` to `lte.detach` with backward compatibility

    * Setting Connection ID and IP protocol type in attach method

commit 1b5eba3
Author: iwahdan88 <islam@pycom.io>
Date:   Mon Jan 14 17:22:03 2019 +0100

    esp32/modlte: Added flag for legacy attachment method

commit dd002a2
Author: Géza Husi <husigeza91@gmail.com>
Date:   Sun Jan 13 12:52:25 2019 +0100

    esp32/modnetwork.c: fix a linking issue for WIPY, LOPY, SIPY

commit 12dcbdb
Author: iwahdan88 <islam@pycom.io>
Date:   Fri Jan 11 15:14:05 2019 +0100

    esp32/modnetwork: fixed wrong nic selection in case of AF_INET

commit b3e3a8c
Author: Christian Ehlers <cehlers@pycom.io>
Date:   Mon Jan 7 23:49:57 2019 +0100

    Update modusocket.c

    Small updates & bugfixes

commit 258876e
Author: iwahdan88 <islam@pycom.io>
Date:   Mon Jan 7 20:47:04 2019 +0100

    esp32/modusocket:Added mpy API to get/se/clear DNS Servers Ipv4

commit 6144e6d
Merge: afcb3c4 38428ff
Author: iwahdan88 <islam@pycom.io>
Date:   Mon Jan 7 16:49:52 2019 +0100

    Merge branch 'master' of https://github.com/pycom/Firmware-Development

commit afcb3c4
Merge: 4a859e2 978c9bb
Author: iwahdan88 <islam@pycom.io>
Date:   Mon Jan 7 16:48:56 2019 +0100

    Merged changes from v1.20.0 release-candidate

commit 38428ff
Author: Géza Husi <husigeza91@gmail.com>
Date:   Mon Jan 7 14:44:22 2019 +0100

    mods/machspi.c: Fix the bug in pybspi_transfer() (#9)

    The parameter write=.. in spi.read() was ignored. Instead always 0x55 was sent.

commit 4a859e2
Author: iwahdan88 <islam@pycom.io>
Date:   Mon Jan 7 13:36:04 2019 +0100

    esp32/modlte: Enabled suspention of Mesh task in modem upgrade task

commit 036a6d1
Author: iwahdan88 <islam@pycom.io>
Date:   Mon Jan 7 13:24:55 2019 +0100

    es32/lib: updated IDF libs

commit e3ca985
Author: iwahdan88 <islam@pycom.io>
Date:   Mon Jan 7 13:19:30 2019 +0100

    esp32/frozen: updated MQTTMsgHandler.py

commit adeebf1
Author: Daniel Campora <danielc@pycom.io>
Date:   Thu Jan 3 17:49:40 2019 +0100

    esp32: Fixes in order to get the US915 certification passing.

commit 9df2333
Author: Christian Ehlers <cehlers@pycom.io>
Date:   Mon Dec 17 19:26:10 2018 +0100

    Update pycom_config.h

    Cosmetic fix (pointer name)

commit 0372114
Author: iwahdan88 <islam@pycom.io>
Date:   Fri Dec 14 01:05:16 2018 +0200

    esp32/micropython: correction to keyboard interrupts exposure

Merge of Dev/master
iwahdan88 pushed a commit that referenced this issue Feb 8, 2019
…) while BLE/Wlan enabled (#15)

# Conflicts:
#	esp32/mods/modwlan.c
iwahdan88 pushed a commit that referenced this issue Feb 8, 2019
* esp32/modlte: Added factory modem reset option , method to check UE coverage and Bug fixes (#17)

* Esp32/frozen/MQTTlib: Gracefully handle EAGAIN return of Socket.write

* esp32/mpthreadport.c: fix an issue in cleaning up user threads during of soft-reset (#14)

Fixes issue [PYFW-197]
# Conflicts:
#	esp32/mpthreadport.c

* esp32/mphal: Fix issue causing Device crash when safe booting (CTRL-F) while BLE/Wlan enabled (#15)

# Conflicts:
#	esp32/mods/modwlan.c

* esp32/modlte: minor fix

* esp32/make: Fix makefile bug excluding SIPY FIPY LOPY4 from secure Boot process
X-Ryl669 pushed a commit to X-Ryl669/pycom-micropython-sigfox that referenced this issue May 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
0