Skip to content

Muse 2016 (original) fails to connect via native BLE - BOARD_NOT_READY_ERROR #845

Closed as not planned

Description

@Abhi-K-P

Description:
The MUSE 2016 headband does not connect via brainflow but I am able to connect via LSL streaming.

Code:
import argparse
import time

from brainflow.board_shim import BoardShim, BrainFlowInputParams, BoardIds

def main():
BoardShim.enable_dev_board_logger()
params = BrainFlowInputParams()
params.timeout = 30
board = BoardShim(BoardIds.MUSE_2016_BOARD, params)
board.prepare_session()
board.add_streamer("file://data.csv:w")
board.start_stream()
time.sleep(30)
# data = board.get_current_board_data (256) # get latest 256 packages or less, doesnt remove them from internal buffer
data = board.get_board_data() # get all data and remove it from internal buffer
board.stop_stream()
board.release_session()

print(data)

if name == "main":
main()

Error log:
C:\Users\abhis.venvs\dl-py311\Lib\site-packages\brainflow\board_shim.py:185: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
import pkg_resources
[2026-07-31 12:02:53.370] [board_logger] [info] incoming json: {
"file": "",
"file_anc": "",
"file_aux": "",
"ip_address": "",
"ip_address_anc": "",
"ip_address_aux": "",
"ip_port": 0,
"ip_port_anc": 0,
"ip_port_aux": 0,
"ip_protocol": 0,
"mac_address": "",
"master_board": -100,
"other_info": "",
"serial_number": "",
"serial_port": "",
"timeout": 30
}
[2026-07-31 12:02:53.371] [board_logger] [trace] Board object created 41
[2026-07-31 12:02:53.371] [board_logger] [info] Use Muse preset p21
[2026-07-31 12:02:53.371] [board_logger] [info] Use timeout for discovery: 30
[2026-07-31 12:02:53.371] [board_logger] [debug] use dyn lib: C:\Users\abhis.venvs\dl-py311\Lib\site-packages\brainflow\lib\simpleble-c.dll
[2026-07-31 12:02:53.434] [board_logger] [info] found 1 BLE adapter(s)
[2026-07-31 12:02:53.618] [board_logger] [trace] address 54:ab:41:a1:d4:8d
[2026-07-31 12:02:53.618] [board_logger] [trace] identifier
[2026-07-31 12:02:54.089] [board_logger] [trace] address 4d:11:31:52:cc:05
[2026-07-31 12:02:54.090] [board_logger] [trace] identifier
[2026-07-31 12:02:54.430] [board_logger] [trace] address 5f:6b:1a:f4:17:45
[2026-07-31 12:02:54.431] [board_logger] [trace] identifier
[2026-07-31 12:02:54.551] [board_logger] [trace] address 77:c0:0d:66:38:3e
[2026-07-31 12:02:54.551] [board_logger] [trace] identifier
[2026-07-31 12:02:55.270] [board_logger] [trace] address 4c:62:a0:7c:f8:74
[2026-07-31 12:02:55.271] [board_logger] [trace] identifier
[2026-07-31 12:02:55.498] [board_logger] [trace] address 08:3e:a7:05:5d:ec
[2026-07-31 12:02:55.498] [board_logger] [trace] identifier
[2026-07-31 12:02:55.874] [board_logger] [trace] address 5b:2e:d7:2c:9b:2e
[2026-07-31 12:02:55.874] [board_logger] [trace] identifier
[2026-07-31 12:02:56.224] [board_logger] [trace] address 36:7d:c6:46:7c:05
[2026-07-31 12:02:56.224] [board_logger] [trace] identifier
[2026-07-31 12:02:56.569] [board_logger] [trace] address 57:42:f8:85:a1:51
[2026-07-31 12:02:56.569] [board_logger] [trace] identifier
[2026-07-31 12:02:57.504] [board_logger] [trace] address 56:92:aa:80:c3:15
[2026-07-31 12:02:57.504] [board_logger] [trace] identifier
[2026-07-31 12:02:57.752] [board_logger] [trace] address 4f:64:91:19:c3:83
[2026-07-31 12:02:57.752] [board_logger] [trace] identifier
[2026-07-31 12:02:58.588] [board_logger] [trace] address e3:d3:c4:c0:2c:6c
[2026-07-31 12:02:58.588] [board_logger] [trace] identifier
[2026-07-31 12:03:01.411] [board_logger] [trace] address 00:55:da:b0:e5:9e
[2026-07-31 12:03:01.411] [board_logger] [trace] identifier Muse-E59E
[2026-07-31 12:03:01.412] [board_logger] [info] Found Muse device
[2026-07-31 12:03:08.545] [board_logger] [warning] Failed to connect to Muse Device: 0/3
[2026-07-31 12:03:19.154] [board_logger] [warning] Failed to connect to Muse Device: 1/3
[2026-07-31 12:03:27.163] [board_logger] [warning] Failed to connect to Muse Device: 2/3
Traceback (most recent call last):
File "c:\Users\abhis\OneDrive\Desktop\muse_eeg_project\connection_test.py", line 25, in
main()
File "c:\Users\abhis\OneDrive\Desktop\muse_eeg_project\connection_test.py", line 12, in main
board.prepare_session()
File "C:\Users\abhis.venvs\dl-py311\Lib\site-packages\brainflow\board_shim.py", line 1261, in prepare_session
raise BrainFlowError('unable to prepare streaming session', res)
brainflow.exit_codes.BrainFlowError: BOARD_NOT_READY_ERROR:7 unable to prepare streaming session

Info (please complete the following information):

  • Board Id - MUSE_2016_BOARD
  • Windows 11
  • Python 3.11.9
  • x64
  • Pip list - (dl-py311) PS C:\Users\abhis\OneDrive\Desktop\EEG_Deep_Learning> pip list
    Package Version

absl-py 2.4.0
agentops 0.4.21
aiofiles 24.1.0
aiohappyeyeballs 2.6.1
aiohttp 3.13.2
aiosignal 1.4.0
aiosqlite 0.21.0
annotated-doc 0.0.4
annotated-types 0.7.0
anthropic 0.103.0
anyio 4.12.0
appdirs 1.4.4
array-api-compat 1.15.0
array-api-extra 0.11.0
asgiref 3.11.1
asttokens 3.0.1
astunparse 1.6.3
attrs 25.4.0
backoff 2.2.1
bcrypt 5.0.0
beautifulsoup4 4.13.5
bokeh 3.8.1
bracex 2.6
brainflow 5.22.2
build 1.5.0
certifi 2026.4.22
cffi 2.0.0
charset-normalizer 2.1.1
chromadb 1.1.1
click 8.4.1
colorama 0.4.6
comm 0.2.3
contourpy 1.3.3
crewai 1.14.5
crewai-cli 1.14.5
crewai-core 1.14.5
crewai-tools 1.14.5
cryptography 48.0.0
cycler 0.12.1
darkdetect 0.8.0
dataclasses-json 0.6.7
datasets 4.4.2
debugpy 1.8.19
decorator 5.2.1
defusedxml 0.7.1
deprecation 2.1.0
dill 0.4.0
distro 1.9.0
Django 5.2.14
django_db 0.0.7
dm-tree 0.1.10
dockerfile-parse 2.0.1
docstring_parser 0.18.0
durationpy 0.10
e2b 2.21.1
e2b-code-interpreter 2.6.2
ecdsa 0.19.2
einops 0.8.2
entsoe-py 0.8.0
et_xmlfile 2.0.0
etils 1.14.0
executing 2.2.1
fastapi 0.136.1
filelock 3.20.0
fire 0.7.1
flatbuffers 25.12.19
fonttools 4.61.1
frozenlist 1.8.0
fsspec 2025.10.0
gast 0.7.0
google-pasta 0.2.0
googleapis-common-protos 1.75.0
greenlet 3.5.0
grpcio 1.80.0
h11 0.16.0
h2 4.3.0
h5py 3.14.0
hf-xet 1.5.0
hpack 4.1.0
httpcore 1.0.9
httptools 0.7.1
httpx 0.28.1
httpx-sse 0.4.3
huggingface_hub 1.16.4
hyperframe 6.1.0
idna 3.4
immutabledict 4.3.1
importlib_metadata 8.7.1
importlib_resources 7.1.0
instructor 1.15.1
ipykernel 7.1.0
ipython 9.8.0
ipython_pygments_lexers 1.1.1
jedi 0.19.2
Jinja2 3.1.6
jiter 0.13.0
joblib 1.5.3
json_repair 0.25.3
json5 0.10.0
jsonpatch 1.33
jsonpointer 3.1.1
jsonref 1.1.0
jsonschema 4.26.0
jsonschema-specifications 2025.9.1
jupyter_client 8.7.0
jupyter_core 5.9.1
keras 3.14.1
kiwisolver 1.4.9
kubernetes 35.0.0
lance-namespace 0.7.6
lance-namespace-urllib3-client 0.7.6
lancedb 0.30.0
langchain-anthropic 1.4.3
langchain-classic 1.0.7
langchain-community 0.4.1
langchain-core 1.4.0
langchain-openai 1.2.1
langchain-protocol 0.0.15
langchain-text-splitters 1.1.2
langgraph 1.2.0
langgraph-checkpoint 4.1.0
langgraph-prebuilt 1.1.0
langgraph-sdk 0.3.14
langsmith 0.8.5
lazy-loader 0.5
libclang 18.1.1
linkify-it-py 2.1.0
livelossplot 0.5.6
llama_models 0.3.0
llama_stack 0.2.12
llama_stack_client 0.2.12
lxml 6.1.1
markdown-it-py 4.2.0
MarkupSafe 2.1.5
marshmallow 3.26.2
matplotlib 3.10.8
matplotlib-inline 0.2.1
mcp 1.26.0
mdit-py-plugins 0.6.1
mdurl 0.1.2
meegkit 0.1.9
ml_dtypes 0.5.4
mmh3 5.2.1
mne 1.12.1
mne-qt-browser 0.7.5
mpmath 1.3.0
multidict 6.7.0
multiprocess 0.70.18
mypy_extensions 1.1.0
namex 0.1.0
narwhals 2.14.0
nest-asyncio 1.6.0
networkx 3.6.1
numpy 1.26.4
oauthlib 3.3.1
onnxruntime 1.26.0
openai 2.37.0
opencv-python 4.13.0.92
openpyxl 3.1.5
opentelemetry-api 1.34.1
opentelemetry-exporter-otlp-proto-common 1.34.1
opentelemetry-exporter-otlp-proto-grpc 1.34.1
opentelemetry-exporter-otlp-proto-http 1.34.1
opentelemetry-instrumentation 0.55b1
opentelemetry-proto 1.34.1
opentelemetry-sdk 1.34.1
opentelemetry-semantic-conventions 0.55b1
opt_einsum 3.4.0
optree 0.19.1
ordered-set 4.1.0
orjson 3.11.9
ormsgpack 1.12.2
overrides 7.7.0
packaging 24.2
pandas 2.3.3
parso 0.8.5
patsy 1.0.2
pdfminer.six 20251230
pdfplumber 0.11.9
pillow 12.0.0
pip 26.1.2
platformdirs 4.5.1
pooch 1.9.0
portalocker 2.7.0
posthog 5.4.0
promise 2.3
prompt_toolkit 3.0.52
propcache 0.4.1
protobuf 7.35.0
psutil 7.0.0
psycopg2-binary 2.9.12
pure_eval 0.2.3
pyads 3.5.2
pyaml 26.2.1
pyarrow 22.0.0
pyasn1 0.6.3
pybase64 1.4.3
pycparser 3.0
pydantic 2.12.5
pydantic_core 2.41.5
pydantic-settings 2.10.1
pygame 2.6.1
Pygments 2.19.2
PyJWT 2.12.1
pylsl 1.18.2
PyMuPDF 1.26.7
PyMySQL 1.1.3
pyparsing 3.3.1
pypdfium2 5.8.0
PyPika 0.51.1
pyproject_hooks 1.2.0
PyQt6 6.11.0
PyQt6-Qt6 6.11.1
PyQt6_sip 13.11.1
pyqtgraph 0.14.0
pyriemann 0.12
python-dateutil 2.9.0.post0
python-docx 1.2.0
python-dotenv 1.2.2
python-jose 3.5.0
python-multipart 0.0.29
pytube 15.0.0
pytz 2025.2
PyWavelets 1.9.0
pywin32 311
PyYAML 6.0.3
pyzmq 27.1.0
QDarkStyle 3.2.3
QtPy 2.4.3
referencing 0.37.0
regex 2026.1.15
requests 2.34.2
requests-oauthlib 2.0.0
requests-toolbelt 1.0.0
rich 14.3.4
rpds-py 0.30.0
rsa 4.9.1
scikit-learn 1.8.0
scipy 1.16.3
scooby 0.11.2
setuptools 80.9.0
shellingham 1.5.4
simple-parsing 0.1.8
six 1.17.0
slack_bolt 1.28.0
slack_sdk 3.42.0
sniffio 1.3.1
soupsieve 2.8.3
SQLAlchemy 2.0.49
sqlparse 0.5.5
sse-starlette 3.4.4
stack-data 0.6.3
starlette 1.0.0
statsmodels 0.14.6
sympy 1.14.0
tenacity 9.1.4
tensorflow 2.21.0
tensorflow-datasets 4.9.10
tensorflow-metadata 1.21.0
termcolor 2.4.0
textual 8.2.7
threadpoolctl 3.6.0
tiktoken 0.12.0
tokenizers 0.23.1
toml 0.10.2
tomli 2.0.2
tomli_w 1.1.0
torch 2.1.2+cpu
torchaudio 2.1.2+cpu
torchvision 0.16.2+cpu
tornado 6.5.4
tqdm 4.67.1
traitlets 5.14.3
typer 0.23.1
typer-slim 0.21.0
typing_extensions 4.15.0
typing-inspect 0.9.0
typing-inspection 0.4.2
tzdata 2025.3
uc-micro-py 2.0.0
urllib3 1.26.13
uuid_utils 0.16.0
uv 0.11.15
uvicorn 0.47.0
watchfiles 1.2.0
wcmatch 10.1
wcwidth 0.2.14
websocket-client 1.9.0
websockets 16.0
wheel 0.45.1
wrapt 1.17.3
xxhash 3.6.0
xyzservices 2025.11.0
yarl 1.22.0
youtube-transcript-api 1.2.4
zipp 4.1.0
zstandard 0.25.0

The headband does not connect even when i try to pair it in the bluetooth settings. The only way I am able to get data or connect to the headband is via LSL and BlueMuse app but since I am trying to eliminate the usage of BlueMuse i am trying this approach.

Activity

  1. github-actions commented on Jul 31, 2026

    @github-actions

    Welcome to BrainFlow project and thanks for your contribution! We will try to fix your issue ASAP. Make sure that you have read about issue format in the docs.

  2. Andrey1994 commented on Aug 7, 2026

    @Andrey1994
    Member

    Thanks for the detailed log. BrainFlow finds the correct device (Muse-E59E), but all three native SimpleBLE connection attempts fail before GATT service discovery or any Muse commands are executed.

    Could you please try the following:

    1. Completely exit BlueMuse and any other Muse/LSL application, including background/tray processes.
    2. Power the Muse off for 20–30 seconds, reboot Windows or toggle Bluetooth, and run BrainFlow before opening BlueMuse.
    3. If Muse is listed in Windows paired devices, remove it. Manual pairing is not required.
    4. Add params.serial_number = "Muse-E59E" and retry with only prepare_session() / release_session().

    Please let us know whether BlueMuse was running when this log was captured and attach the new full development log. If it still fails after a cold restart, we can add diagnostics around the SimpleBLE/WinRT connect call and try reacquiring a fresh peripheral handle between retries.

  3. Abhi-K-P commented on Aug 7, 2026

    @Abhi-K-P
    Author

    I uninstalled BlueMuse and then rebooted Windows and ran BrainFlow. It again failed, I have attached the full development log.

    C:\Users\abhis.venvs\dl-py311\Lib\site-packages\brainflow\board_shim.py:185: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
    import pkg_resources
    Attempting to prepare session...
    [2026-08-07 08:23:18.247] [board_logger] [info] incoming json: {
    "file": "",
    "file_anc": "",
    "file_aux": "",
    "ip_address": "",
    "ip_address_anc": "",
    "ip_address_aux": "",
    "ip_port": 0,
    "ip_port_anc": 0,
    "ip_port_aux": 0,
    "ip_protocol": 0,
    "mac_address": "",
    "master_board": -100,
    "other_info": "",
    "serial_number": "Muse-E59E",
    "serial_port": "",
    "timeout": 30
    }
    [2026-08-07 08:23:18.248] [board_logger] [trace] Board object created 41
    [2026-08-07 08:23:18.249] [board_logger] [info] Use Muse preset p21
    [2026-08-07 08:23:18.249] [board_logger] [info] Use timeout for discovery: 30
    [2026-08-07 08:23:18.249] [board_logger] [debug] use dyn lib: C:\Users\abhis.venvs\dl-py311\Lib\site-packages\brainflow\lib\simpleble-c.dll
    [2026-08-07 08:23:18.362] [board_logger] [info] found 1 BLE adapter(s)
    [2026-08-07 08:23:18.659] [board_logger] [trace] address be:0f:f3:97:3e:0f
    [2026-08-07 08:23:18.660] [board_logger] [trace] identifier
    [2026-08-07 08:23:18.765] [board_logger] [trace] address 00:55:da:b0:e5:9e
    [2026-08-07 08:23:18.765] [board_logger] [trace] identifier Muse-E59E
    [2026-08-07 08:23:18.765] [board_logger] [info] Found Muse device
    [2026-08-07 08:23:26.139] [board_logger] [warning] Failed to connect to Muse Device: 0/3
    [2026-08-07 08:23:34.136] [board_logger] [warning] Failed to connect to Muse Device: 1/3
    [2026-08-07 08:23:44.131] [board_logger] [warning] Failed to connect to Muse Device: 2/3
    Traceback (most recent call last):
    File "c:\Users\abhis\OneDrive\Desktop\muse_eeg_project\connection_test.py", line 30, in
    main()
    File "c:\Users\abhis\OneDrive\Desktop\muse_eeg_project\connection_test.py", line 18, in main
    board.prepare_session()
    File "C:\Users\abhis.venvs\dl-py311\Lib\site-packages\brainflow\board_shim.py", line 1261, in prepare_session
    raise BrainFlowError('unable to prepare streaming session', res)
    brainflow.exit_codes.BrainFlowError: BOARD_NOT_READY_ERROR:7 unable to prepare streaming session

  4. Andrey1994 commented on Aug 18, 2026

    @Andrey1994
    Member

    Thanks for retesting after removing BlueMuse and rebooting. That rules out the most likely competing-client and device-selection cases.

    There is now a likely explanation that should be checked. BrainFlow 5.22.2 vendors SimpleBLE 0.12.1. On Windows, simpleble_peripheral_connect() also performs GATT service/characteristic discovery internally, while the SimpleCBLE wrapper converts WinRT exceptions into a generic SIMPLEBLE_FAILURE. Therefore, the current log does not distinguish a radio connection failure from GATT discovery aborting on a restricted Windows service.

    SimpleBLE 1.1.0 added two directly relevant Windows fixes:

    Could you please test the Muse directly with SimplePyBLE 1.1.0 in a clean virtual environment, with BlueMuse closed?

    python -m pip install --upgrade simplepyble==1.1.0
    import logging
    import simplepyble
    
    logging.basicConfig(level=logging.DEBUG)
    
    adapter = simplepyble.Adapter.get_adapters()[0]
    adapter.scan_for(5000)
    
    muse = next(
        p for p in adapter.scan_get_results()
        if p.identifier() == "Muse-E59E"
    )
    
    print(muse.identifier(), muse.address())
    muse.connect()
    
    for service in muse.services():
        print(service.uuid())
    
    muse.disconnect()

    Please attach the complete output, including any SimpleBLE/WinRT debug messages, and also provide:

    • the exact Windows 11 build;
    • the Bluetooth adapter model;
    • the Bluetooth driver version.

    If this succeeds with SimplePyBLE 1.1.0, it would strongly indicate that BrainFlow needs the two Windows fixes above backported (or its bundled SimpleBLE upgraded). If it still fails, the exact exception/HRESULT from this direct test should identify the next layer to investigate.

  5. Abhi-K-P commented on Aug 25, 2026

    @Abhi-K-P
    Author

    Hello,
    The output for the code was :
    (dl-py311) PS C:\Users\abhis\OneDrive\Desktop\EEG_Deep_Learning> python -u "c:\Users\abhis\OneDrive\Desktop\eeg_deep_learning\Bluetooth_test.py"
    Using adapter: ABHISHEK [dc:56:7b:4a:54:ea]
    Scanning for Muse headband...
    Found: Muse-E59E [00:55:da:b0:e5:9e]
    Connecting...
    Traceback (most recent call last):
    File "c:\Users\abhis\OneDrive\Desktop\eeg_deep_learning\Bluetooth_test.py", line 37, in
    muse.connect()
    RuntimeError: Operation Failed: Failed to connect to device.

    The Windows version : Version 25H2 , OS Build: 26200.9168
    Bluetooth Adapter Model : MediaTek Bluetooth Adapter
    Bluetooth Driver version : 25.20.5.20

  6. Andrey1994 commented on Sep 7, 2026

    @Andrey1994
    Member

    will copypaste it from codex, but I dont have old muse boards to check any of that -

    I checked the full discussion and current code. The latest reply points to a SimpleBLE/Windows connection problem, but the exact cause remains unconfirmed. The reporter removed BlueMuse, rebooted, and still reproduced the failure in standalone SimplePyBLE on Windows 11 with a MediaTek adapter. Their output does not confirm which SimplePyBLE version actually ran. Latest reply

    The earlier proposal to backport the two Windows AccessDenied fixes needs qualification: SimpleBLE 1.1.0 already contains them, so if that version was tested, those fixes alone are insufficient. Upstream implementation

    I propose the following:

    Preserve the actual connection failure — first priority.
    In PeripheralWindows::_attempt_connect(), service, characteristic, and descriptor discovery failures return false without recording their status. The C wrapper then discards exceptions behind SIMPLEBLE_FAILURE.

    Log the failed operation, GattCommunicationStatus, optional ProtocolError, HRESULT for exceptions, relevant UUIDs, attempt number, and elapsed time. Forward SimpleBLE logs into BrainFlow’s logger using the existing C logging API. This would distinguish Unreachable, AccessDenied, and protocol failures immediately. Backend, C wrapper

    Fix a confirmed connection-success bug.
    connect() retries discovery three times, but subsequently checks only is_connected(). It can therefore report success after every discovery attempt failed, leaving a partial GATT map.

    Require both successful discovery and a connected state; discard partial discovery results on failure. This is independently worth fixing, although it does not explain the reporter’s failed connection by itself. Connection logic

    Test discovery restricted to the Muse service.
    There is a meaningful difference from the application that previously worked: BlueMuse requests only service 0000fe8d-0000-1000-8000-00805f9b34fb, whereas SimpleBLE enumerates all services and their characteristics/descriptors.

    An optional service filter could avoid failures in unrelated services. Keep it configurable in SimpleBLE and enable it for Muse only after verification. This is a plausible fix, not yet a demonstrated one. BlueMuse implementation

    Improve connection lifetime and retry handling if diagnostics show transient failures.
    Trial a retained GattSession with MaintainConnection(true), bounded waiting for an active session, and delayed retries for Unreachable, following Bleak’s implementation. Clean up native GATT/device state after failure. Simply releasing a peripheral wrapper and rescanning on the same adapter can reuse the cached backend object. Bleak implementation, SimpleBLE cache

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions