-
Notifications
You must be signed in to change notification settings - Fork 864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
noble on Raspberry Pi 3 with Raspbian #480
Comments
Hi, This is an update to my previous post. I just found that first connection after booting is OK as follows: $ sudo node ble-uart-test.js
Found Adafruit Bluefruit LE
Connected to Adafruit Bluefruit LE
Ready However, once I powered off the device to be disconnected and powered on again, I got as follows (i.e. connected, disconnected immediately and connected): Disconnected
Found Adafruit Bluefruit LE
Connected to Adafruit Bluefruit LE
Ready
Disconnected
Found Adafruit Bluefruit LE
Connected to Adafruit Bluefruit LE
Ready After repeating powering off and on several times, I got the issue (i.e. many connections and disconnections in several seconds): Disconnected
Found Adafruit Bluefruit LE
Connected to Adafruit Bluefruit LE
Disconnected
Found Adafruit Bluefruit LE
Connected to Adafruit Bluefruit LE
Disconnected
Found Adafruit Bluefruit LE
Connected to Adafruit Bluefruit LE
(node) warning: possible EventEmitter memory leak detected. 11 servicesDiscover listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
at Peripheral.addListener (events.js:239:17)
at Peripheral.once (events.js:265:8)
at Peripheral.discoverServices (/home/pi/Desktop/node_modules/noble/lib/peripheral.js:72:10)
at /home/pi/Desktop/ble-uart-test.js:35:20
at Peripheral.<anonymous> (/home/pi/Desktop/node_modules/noble/lib/peripheral.js:38:7)
at Peripheral.g (events.js:260:16)
at emitOne (events.js:77:13)
at Peripheral.emit (events.js:169:7)
at Noble.onConnect (/home/pi/Desktop/node_modules/noble/lib/noble.js:148:16)
at emitTwo (events.js:87:13)
at emit (events.js:172:7)
Disconnected
Found Adafruit Bluefruit LE
Connected to Adafruit Bluefruit LE
Disconnected
Found Adafruit Bluefruit LE
Connected to Adafruit Bluefruit LE
Disconnected
Found Adafruit Bluefruit LE
Connected to Adafruit Bluefruit LE
Disconnected
Found Adafruit Bluefruit LE
Connected to Adafruit Bluefruit LE
Disconnected If there's anything that comes to your attention about that please let me know. Thanks, |
@kotobuki can you please provide an HCI dump capture? Also, please try out the instructions in #474 (comment) to see if that patch makes any difference. |
@sandeepmistry Sure, I'd like to share an HCI dump capture. $ sudo hcidump -t -x
HCI sniffer - Bluetooth packet analyzer ver 5.23
device: hci0 snap_len: 1500 filter: 0xffffffff
2016-10-20 12:17:22.317399 < HCI Command: Set Event Mask (0x03|0x0001) plen 8
Mask: 0xfffffbff07f8bf3d
2016-10-20 12:17:22.317927 > HCI Event: Command Complete (0x0e) plen 4
Set Event Mask (0x03|0x0001) ncmd 1
status 0x00
2016-10-20 12:17:22.318499 < HCI Command: LE Set Event Mask (0x08|0x0001) plen 8
mask 0x1f00000000000000 (Reserved)
2016-10-20 12:17:22.318961 > HCI Event: Command Complete (0x0e) plen 4
LE Set Event Mask (0x08|0x0001) ncmd 1
status 0x00
2016-10-20 12:17:22.319125 < HCI Command: Read Local Version Information (0x04|0x0001) plen 0
2016-10-20 12:17:22.319573 > HCI Event: Command Complete (0x0e) plen 12
Read Local Version Information (0x04|0x0001) ncmd 1
status 0x00
HCI Version: 4.1 (0x7) HCI Revision: 0xb6
LMP Version: 4.1 (0x7) LMP Subversion: 0x2209
Manufacturer: Broadcom Corporation (15)
2016-10-20 12:17:22.319782 < HCI Command: Write LE Host Supported (0x03|0x006d) plen 2
01 00
2016-10-20 12:17:22.320154 > HCI Event: Command Complete (0x0e) plen 4
Write LE Host Supported (0x03|0x006d) ncmd 1
00
2016-10-20 12:17:22.320343 < HCI Command: Read LE Host Supported (0x03|0x006c) plen 0
2016-10-20 12:17:22.320717 > HCI Event: Command Complete (0x0e) plen 6
Read LE Host Supported (0x03|0x006c) ncmd 1
00 01 00
2016-10-20 12:17:22.320839 < HCI Command: Read BD ADDR (0x04|0x0009) plen 0
2016-10-20 12:17:22.321279 > HCI Event: Command Complete (0x0e) plen 10
Read BD ADDR (0x04|0x0009) ncmd 1
status 0x00 bdaddr B8:27:EB:20:98:2D
2016-10-20 12:17:24.960786 < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
value 0x00 (scanning disabled)
filter duplicates 0x01 (enabled)
2016-10-20 12:17:24.961186 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Enable (0x08|0x000c) ncmd 1
status 0x0c
Error: Command Disallowed
2016-10-20 12:17:24.961570 < HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7
type 0x01 (active)
interval 10.000ms window 10.000ms
own address: 0x00 (Public) policy: All
2016-10-20 12:17:24.962030 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Parameters (0x08|0x000b) ncmd 1
status 0x00
2016-10-20 12:17:25.164812 < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
value 0x01 (scanning enabled)
filter duplicates 0x01 (enabled)
2016-10-20 12:17:25.165250 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Enable (0x08|0x000c) ncmd 1
status 0x00
2016-10-20 12:17:25.189805 > HCI Event: LE Meta Event (0x3e) plen 36
LE Advertising Report
ADV_IND - Connectable undirected advertising (0)
bdaddr C9:14:14:35:68:D2 (Random)
Flags: 0x06
TX power level: 0
Unknown type 0x06 with 16 bytes data
RSSI: -42
2016-10-20 12:17:25.218308 > HCI Event: LE Meta Event (0x3e) plen 35
LE Advertising Report
SCAN_RSP - Scan Response (4)
bdaddr C9:14:14:35:68:D2 (Random)
Complete local name: 'Adafruit Bluefruit LE'
RSSI: -60
2016-10-20 12:17:25.222625 < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
value 0x00 (scanning disabled)
filter duplicates 0x01 (enabled)
2016-10-20 12:17:25.224233 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Enable (0x08|0x000c) ncmd 1
status 0x00
2016-10-20 12:17:25.225691 < HCI Command: LE Create Connection (0x08|0x000d) plen 25
bdaddr C9:14:14:35:68:D2 type 1
interval 96 window 48 initiator_filter 0
own_bdaddr_type 0 min_interval 6 max_interval 12
latency 0 supervision_to 200 min_ce 4 max_ce 6
2016-10-20 12:17:25.226480 > HCI Event: Command Status (0x0f) plen 4
LE Create Connection (0x08|0x000d) status 0x00 ncmd 1
2016-10-20 12:17:25.245015 > HCI Event: LE Meta Event (0x3e) plen 19
LE Connection Complete
status 0x00 handle 64, role master
bdaddr C9:14:14:35:68:D2 (Random)
2016-10-20 12:17:25.245228 < HCI Command: LE Read Remote Used Features (0x08|0x0016) plen 2
40 00
2016-10-20 12:17:25.249832 > HCI Event: Command Status (0x0f) plen 4
LE Read Remote Used Features (0x08|0x0016) status 0x00 ncmd 1
2016-10-20 12:17:25.310089 > HCI Event: LE Meta Event (0x3e) plen 12
LE Read Remote Used Features Complete
status 0x00 handle 64
Features: 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00
2016-10-20 12:17:25.325023 < ACL data: handle 64 flags 0x00 dlen 7
ATT: MTU req (0x02)
client rx mtu 256
2016-10-20 12:17:25.354919 > ACL data: handle 64 flags 0x02 dlen 7
ATT: MTU resp (0x03)
server rx mtu 23
2016-10-20 12:17:25.356555 < ACL data: handle 64 flags 0x00 dlen 11
ATT: Read By Group req (0x10)
start 0x0001, end 0xffff
type-uuid 0x2800
2016-10-20 12:17:25.370011 > HCI Event: Number of Completed Packets (0x13) plen 5
handle 64 packets 2
2016-10-20 12:17:25.370068 < HCI Command: Disconnect (0x01|0x0006) plen 3
handle 64 reason 0x13
Reason: Remote User Terminated Connection
2016-10-20 12:17:25.370499 > HCI Event: Command Status (0x0f) plen 4
Disconnect (0x01|0x0006) status 0x00 ncmd 1
2016-10-20 12:17:25.400560 > HCI Event: Disconn Complete (0x05) plen 4
status 0x00 handle 64 reason 0x16
Reason: Connection Terminated by Local Host
2016-10-20 12:17:25.474249 < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
value 0x01 (scanning enabled)
filter duplicates 0x01 (enabled)
2016-10-20 12:17:25.474911 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Enable (0x08|0x000c) ncmd 1
status 0x00
2016-10-20 12:17:25.498419 > HCI Event: LE Meta Event (0x3e) plen 23
LE Advertising Report
ADV_IND - Connectable undirected advertising (0)
bdaddr 79:BA:92:13:D1:A4 (Random)
Flags: 0x1a
Unknown type 0xff with 6 bytes data
RSSI: -86
2016-10-20 12:17:25.526912 > HCI Event: LE Meta Event (0x3e) plen 36
LE Advertising Report
ADV_IND - Connectable undirected advertising (0)
bdaddr C9:14:14:35:68:D2 (Random)
Flags: 0x06
TX power level: 0
Unknown type 0x06 with 16 bytes data
RSSI: -42
2016-10-20 12:17:25.613078 > HCI Event: LE Meta Event (0x3e) plen 35
LE Advertising Report
SCAN_RSP - Scan Response (4)
bdaddr C9:14:14:35:68:D2 (Random)
Complete local name: 'Adafruit Bluefruit LE'
RSSI: -59
2016-10-20 12:17:25.614849 < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
value 0x00 (scanning disabled)
filter duplicates 0x01 (enabled)
2016-10-20 12:17:25.616727 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Enable (0x08|0x000c) ncmd 1
status 0x00
2016-10-20 12:17:25.616771 < HCI Command: LE Create Connection (0x08|0x000d) plen 25
bdaddr C9:14:14:35:68:D2 type 1
interval 96 window 48 initiator_filter 0
own_bdaddr_type 0 min_interval 6 max_interval 12
latency 0 supervision_to 200 min_ce 4 max_ce 6
2016-10-20 12:17:25.617557 > HCI Event: Command Status (0x0f) plen 4
LE Create Connection (0x08|0x000d) status 0x00 ncmd 1
2016-10-20 12:17:25.641915 > HCI Event: LE Meta Event (0x3e) plen 19
LE Connection Complete
status 0x00 handle 64, role master
bdaddr C9:14:14:35:68:D2 (Random)
2016-10-20 12:17:25.642107 < HCI Command: LE Read Remote Used Features (0x08|0x0016) plen 2
40 00
2016-10-20 12:17:25.644117 > HCI Event: Command Status (0x0f) plen 4
LE Read Remote Used Features (0x08|0x0016) status 0x00 ncmd 1
2016-10-20 12:17:25.713825 > HCI Event: LE Meta Event (0x3e) plen 12
LE Read Remote Used Features Complete
status 0x00 handle 64
Features: 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00
2016-10-20 12:17:25.719147 < ACL data: handle 64 flags 0x00 dlen 7
ATT: MTU req (0x02)
client rx mtu 256
2016-10-20 12:17:25.743668 > ACL data: handle 64 flags 0x02 dlen 7
ATT: MTU resp (0x03)
server rx mtu 23
2016-10-20 12:17:25.744535 < ACL data: handle 64 flags 0x00 dlen 11
ATT: Read By Group req (0x10)
start 0x0001, end 0xffff
type-uuid 0x2800
2016-10-20 12:17:25.758740 > HCI Event: Number of Completed Packets (0x13) plen 5
handle 64 packets 2
2016-10-20 12:17:25.758798 < HCI Command: Disconnect (0x01|0x0006) plen 3
handle 64 reason 0x13
Reason: Remote User Terminated Connection
2016-10-20 12:17:25.759226 > HCI Event: Command Status (0x0f) plen 4
Disconnect (0x01|0x0006) status 0x00 ncmd 1
2016-10-20 12:17:25.774295 > HCI Event: Disconn Complete (0x05) plen 4
status 0x00 handle 64 reason 0x16
Reason: Connection Terminated by Local Host
2016-10-20 12:17:25.864175 < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
value 0x01 (scanning enabled)
filter duplicates 0x01 (enabled)
2016-10-20 12:17:25.865179 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Enable (0x08|0x000c) ncmd 1
status 0x00
2016-10-20 12:17:25.874975 > HCI Event: LE Meta Event (0x3e) plen 36
LE Advertising Report
ADV_IND - Connectable undirected advertising (0)
bdaddr C9:14:14:35:68:D2 (Random)
Flags: 0x06
TX power level: 0
Unknown type 0x06 with 16 bytes data
RSSI: -47
2016-10-20 12:17:26.003945 > HCI Event: LE Meta Event (0x3e) plen 35
LE Advertising Report
SCAN_RSP - Scan Response (4)
bdaddr C9:14:14:35:68:D2 (Random)
Complete local name: 'Adafruit Bluefruit LE'
RSSI: -59
2016-10-20 12:17:26.005035 < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
value 0x00 (scanning disabled)
filter duplicates 0x01 (enabled)
2016-10-20 12:17:26.006733 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Enable (0x08|0x000c) ncmd 1
status 0x00
2016-10-20 12:17:26.006785 < HCI Command: LE Create Connection (0x08|0x000d) plen 25
bdaddr C9:14:14:35:68:D2 type 1
interval 96 window 48 initiator_filter 0
own_bdaddr_type 0 min_interval 6 max_interval 12
latency 0 supervision_to 200 min_ce 4 max_ce 6
2016-10-20 12:17:26.007570 > HCI Event: Command Status (0x0f) plen 4
LE Create Connection (0x08|0x000d) status 0x00 ncmd 1
2016-10-20 12:17:26.030667 > HCI Event: LE Meta Event (0x3e) plen 19
LE Connection Complete
status 0x00 handle 64, role master
bdaddr C9:14:14:35:68:D2 (Random)
2016-10-20 12:17:26.030858 < HCI Command: LE Read Remote Used Features (0x08|0x0016) plen 2
40 00
2016-10-20 12:17:26.031855 > HCI Event: Command Status (0x0f) plen 4
LE Read Remote Used Features (0x08|0x0016) status 0x00 ncmd 1
2016-10-20 12:17:26.101321 > HCI Event: LE Meta Event (0x3e) plen 12
LE Read Remote Used Features Complete
status 0x00 handle 64
Features: 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00
2016-10-20 12:17:26.104856 < ACL data: handle 64 flags 0x00 dlen 7
ATT: MTU req (0x02)
client rx mtu 256
2016-10-20 12:17:26.131170 > ACL data: handle 64 flags 0x02 dlen 7
ATT: MTU resp (0x03)
server rx mtu 23
2016-10-20 12:17:26.131976 < ACL data: handle 64 flags 0x00 dlen 11
ATT: Read By Group req (0x10)
start 0x0001, end 0xffff
type-uuid 0x2800
2016-10-20 12:17:26.146242 > HCI Event: Number of Completed Packets (0x13) plen 5
handle 64 packets 2
2016-10-20 12:17:26.146300 < HCI Command: Disconnect (0x01|0x0006) plen 3
handle 64 reason 0x13
Reason: Remote User Terminated Connection
2016-10-20 12:17:26.146733 > HCI Event: Command Status (0x0f) plen 4
Disconnect (0x01|0x0006) status 0x00 ncmd 1
2016-10-20 12:17:26.161792 > HCI Event: Disconn Complete (0x05) plen 4
status 0x00 handle 64 reason 0x16
Reason: Connection Terminated by Local Host (snip) 2016-10-20 12:17:40.054237 < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
value 0x01 (scanning enabled)
filter duplicates 0x01 (enabled)
2016-10-20 12:17:40.055193 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Enable (0x08|0x000c) ncmd 1
status 0x00
2016-10-20 12:17:40.081131 > HCI Event: LE Meta Event (0x3e) plen 36
LE Advertising Report
ADV_IND - Connectable undirected advertising (0)
bdaddr C9:14:14:35:68:D2 (Random)
Flags: 0x06
TX power level: 0
Unknown type 0x06 with 16 bytes data
RSSI: -43
2016-10-20 12:17:40.131024 > HCI Event: LE Meta Event (0x3e) plen 35
LE Advertising Report
SCAN_RSP - Scan Response (4)
bdaddr C9:14:14:35:68:D2 (Random)
Complete local name: 'Adafruit Bluefruit LE'
RSSI: -59
2016-10-20 12:17:40.132104 < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
value 0x00 (scanning disabled)
filter duplicates 0x01 (enabled)
2016-10-20 12:17:40.134274 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Enable (0x08|0x000c) ncmd 1
status 0x00
2016-10-20 12:17:40.134324 < HCI Command: LE Create Connection (0x08|0x000d) plen 25
bdaddr C9:14:14:35:68:D2 type 1
interval 96 window 48 initiator_filter 0
own_bdaddr_type 0 min_interval 6 max_interval 12
latency 0 supervision_to 200 min_ce 4 max_ce 6
2016-10-20 12:17:40.135155 > HCI Event: Command Status (0x0f) plen 4
LE Create Connection (0x08|0x000d) status 0x00 ncmd 1
2016-10-20 12:17:40.159490 > HCI Event: LE Meta Event (0x3e) plen 19
LE Connection Complete
status 0x00 handle 64, role master
bdaddr C9:14:14:35:68:D2 (Random)
2016-10-20 12:17:40.159707 < HCI Command: LE Read Remote Used Features (0x08|0x0016) plen 2
40 00
2016-10-20 12:17:40.161634 > HCI Event: Command Status (0x0f) plen 4
LE Read Remote Used Features (0x08|0x0016) status 0x00 ncmd 1
2016-10-20 12:17:40.227614 > HCI Event: LE Meta Event (0x3e) plen 12
LE Read Remote Used Features Complete
status 0x00 handle 64
Features: 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00
2016-10-20 12:17:40.229922 < ACL data: handle 64 flags 0x00 dlen 7
ATT: MTU req (0x02)
client rx mtu 256
2016-10-20 12:17:40.260308 > ACL data: handle 64 flags 0x02 dlen 7
ATT: MTU resp (0x03)
server rx mtu 23
2016-10-20 12:17:40.260829 < ACL data: handle 64 flags 0x00 dlen 11
ATT: Read By Group req (0x10)
start 0x0001, end 0xffff
type-uuid 0x2800
2016-10-20 12:17:40.272548 > HCI Event: Number of Completed Packets (0x13) plen 5
handle 64 packets 2
2016-10-20 12:17:40.272621 < HCI Command: Disconnect (0x01|0x0006) plen 3
handle 64 reason 0x13
Reason: Remote User Terminated Connection
2016-10-20 12:17:40.273180 > HCI Event: Command Status (0x0f) plen 4
Disconnect (0x01|0x0006) status 0x00 ncmd 1
2016-10-20 12:17:40.288094 > HCI Event: Disconn Complete (0x05) plen 4
status 0x00 handle 64 reason 0x16
Reason: Connection Terminated by Local Host
2016-10-20 12:17:40.364165 < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
value 0x01 (scanning enabled)
filter duplicates 0x01 (enabled)
2016-10-20 12:17:40.364929 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Enable (0x08|0x000c) ncmd 1
status 0x00
2016-10-20 12:17:40.364963 < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
value 0x00 (scanning disabled)
filter duplicates 0x01 (enabled)
2016-10-20 12:17:40.366127 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Enable (0x08|0x000c) ncmd 1
status 0x00 I'll try the instruction in #474 and report later on. |
I installed the patch as follows: $ npm install sandeepmistry/node-bluetooth-hci-socket#rework-kernel-workarounds
/
> usb@1.2.0 install /home/pi/Desktop/node_modules/noble/node_modules/bluetooth-hci-socket/node_modules/usb
> node-pre-gyp install --fallback-to-build
node-pre-gyp ERR! Tried to download: https://github.com/tessel/node-usb/releases/download/1.2.0/usb_bindings-v1.2.0-node-v46-linux-arm.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for usb@1.2.0 and node@4.6.0 (node-v46 ABI) (falling back to source compile with node-gyp)
make: Entering directory '/home/pi/Desktop/node_modules/noble/node_modules/bluetooth-hci-socket/node_modules/usb/build'
CC(target) Release/obj.target/libusb/libusb/libusb/core.o
CC(target) Release/obj.target/libusb/libusb/libusb/descriptor.o
CC(target) Release/obj.target/libusb/libusb/libusb/hotplug.o
CC(target) Release/obj.target/libusb/libusb/libusb/io.o
CC(target) Release/obj.target/libusb/libusb/libusb/strerror.o
CC(target) Release/obj.target/libusb/libusb/libusb/sync.o
CC(target) Release/obj.target/libusb/libusb/libusb/os/poll_posix.o
CC(target) Release/obj.target/libusb/libusb/libusb/os/threads_posix.o
CC(target) Release/obj.target/libusb/libusb/libusb/os/linux_usbfs.o
CC(target) Release/obj.target/libusb/libusb/libusb/os/linux_udev.o
AR(target) Release/obj.target/usb.a
COPY Release/usb.a
CXX(target) Release/obj.target/usb_bindings/src/node_usb.o
CXX(target) Release/obj.target/usb_bindings/src/device.o
CXX(target) Release/obj.target/usb_bindings/src/transfer.o
SOLINK_MODULE(target) Release/obj.target/usb_bindings.node
COPY Release/usb_bindings.node
COPY /home/pi/Desktop/node_modules/noble/node_modules/bluetooth-hci-socket/node_modules/usb/src/binding/usb_bindings.node
TOUCH Release/obj.target/action_after_build.stamp
make: Leaving directory '/home/pi/Desktop/node_modules/noble/node_modules/bluetooth-hci-socket/node_modules/usb/build'
> bluetooth-hci-socket@0.5.1 install /home/pi/Desktop/node_modules/noble/node_modules/bluetooth-hci-socket
> node-gyp rebuild
make: Entering directory '/home/pi/Desktop/node_modules/noble/node_modules/bluetooth-hci-socket/build'
CXX(target) Release/obj.target/binding/src/BluetoothHciSocket.o
SOLINK_MODULE(target) Release/obj.target/binding.node
COPY Release/binding.node
make: Leaving directory '/home/pi/Desktop/node_modules/noble/node_modules/bluetooth-hci-socket/build'
bluetooth-hci-socket@0.5.1 bluetooth-hci-socket
├── nan@2.4.0
└── usb@1.2.0 Then tried with the test code again. The RasPi 3 connected to the BLE device and disconnected immediately. I couldn't see no repeated connections and disconnections. The dump was as follows. $ sudo hcidump -t -x
HCI sniffer - Bluetooth packet analyzer ver 5.23
device: hci0 snap_len: 1500 filter: 0xffffffff
2016-10-20 16:17:25.327049 < HCI Command: Set Event Mask (0x03|0x0001) plen 8
Mask: 0xfffffbff07f8bf3d
2016-10-20 16:17:25.327633 > HCI Event: Command Complete (0x0e) plen 4
Set Event Mask (0x03|0x0001) ncmd 1
status 0x00
2016-10-20 16:17:25.327669 < HCI Command: LE Set Event Mask (0x08|0x0001) plen 8
mask 0x1f00000000000000 (Reserved)
2016-10-20 16:17:25.328124 > HCI Event: Command Complete (0x0e) plen 4
LE Set Event Mask (0x08|0x0001) ncmd 1
status 0x00
2016-10-20 16:17:25.328151 < HCI Command: Read Local Version Information (0x04|0x0001) plen 0
2016-10-20 16:17:25.328638 > HCI Event: Command Complete (0x0e) plen 12
Read Local Version Information (0x04|0x0001) ncmd 1
status 0x00
HCI Version: 4.1 (0x7) HCI Revision: 0xb6
LMP Version: 4.1 (0x7) LMP Subversion: 0x2209
Manufacturer: Broadcom Corporation (15)
2016-10-20 16:17:25.328663 < HCI Command: Write LE Host Supported (0x03|0x006d) plen 2
01 00
2016-10-20 16:17:25.329396 > HCI Event: Command Complete (0x0e) plen 4
Write LE Host Supported (0x03|0x006d) ncmd 1
00
2016-10-20 16:17:25.329425 < HCI Command: Read LE Host Supported (0x03|0x006c) plen 0
2016-10-20 16:17:25.330015 > HCI Event: Command Complete (0x0e) plen 6
Read LE Host Supported (0x03|0x006c) ncmd 1
00 01 00
2016-10-20 16:17:25.330040 < HCI Command: Read BD ADDR (0x04|0x0009) plen 0
2016-10-20 16:17:25.330596 > HCI Event: Command Complete (0x0e) plen 10
Read BD ADDR (0x04|0x0009) ncmd 1
status 0x00 bdaddr B8:27:EB:20:98:2D
2016-10-20 16:17:25.338538 < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
value 0x00 (scanning disabled)
filter duplicates 0x01 (enabled)
2016-10-20 16:17:25.338972 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Enable (0x08|0x000c) ncmd 1
status 0x0c
Error: Command Disallowed
2016-10-20 16:17:25.339009 < HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7
type 0x01 (active)
interval 10.000ms window 10.000ms
own address: 0x00 (Public) policy: All
2016-10-20 16:17:25.340224 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Parameters (0x08|0x000b) ncmd 1
status 0x00
2016-10-20 16:17:25.343900 < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
value 0x01 (scanning enabled)
filter duplicates 0x01 (enabled)
2016-10-20 16:17:25.344349 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Enable (0x08|0x000c) ncmd 1
status 0x00
2016-10-20 16:17:25.362179 > HCI Event: LE Meta Event (0x3e) plen 36
LE Advertising Report
ADV_IND - Connectable undirected advertising (0)
bdaddr C9:14:14:35:68:D2 (Random)
Flags: 0x06
TX power level: 0
Unknown type 0x06 with 16 bytes data
RSSI: -43
2016-10-20 16:17:25.407654 > HCI Event: LE Meta Event (0x3e) plen 35
LE Advertising Report
SCAN_RSP - Scan Response (4)
bdaddr C9:14:14:35:68:D2 (Random)
Complete local name: 'Adafruit Bluefruit LE'
RSSI: -70
2016-10-20 16:17:25.427922 < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
value 0x00 (scanning disabled)
filter duplicates 0x01 (enabled)
2016-10-20 16:17:25.429745 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Enable (0x08|0x000c) ncmd 1
status 0x00
2016-10-20 16:17:25.446560 < HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7
type 0x00 (passive)
interval 60.000ms window 30.000ms
own address: 0x00 (Public) policy: white list only
2016-10-20 16:17:25.447056 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Parameters (0x08|0x000b) ncmd 1
status 0x00
2016-10-20 16:17:25.447078 < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
value 0x01 (scanning enabled)
filter duplicates 0x01 (enabled)
2016-10-20 16:17:25.447503 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Enable (0x08|0x000c) ncmd 1
status 0x00
2016-10-20 16:17:25.477888 > HCI Event: LE Meta Event (0x3e) plen 36
LE Advertising Report
ADV_IND - Connectable undirected advertising (0)
bdaddr C9:14:14:35:68:D2 (Random)
Flags: 0x06
TX power level: 0
Unknown type 0x06 with 16 bytes data
RSSI: -69
2016-10-20 16:17:25.477916 < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
value 0x00 (scanning disabled)
filter duplicates 0x00 (disabled)
2016-10-20 16:17:25.479727 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Enable (0x08|0x000c) ncmd 1
status 0x00
2016-10-20 16:17:25.479748 < HCI Command: LE Create Connection (0x08|0x000d) plen 25
bdaddr C9:14:14:35:68:D2 type 1
interval 96 window 96 initiator_filter 0
own_bdaddr_type 0 min_interval 6 max_interval 12
latency 0 supervision_to 200 min_ce 0 max_ce 0
2016-10-20 16:17:25.480534 > HCI Event: Command Status (0x0f) plen 4
LE Create Connection (0x08|0x000d) status 0x00 ncmd 1
2016-10-20 16:17:25.504299 > HCI Event: LE Meta Event (0x3e) plen 19
LE Connection Complete
status 0x00 handle 64, role master
bdaddr C9:14:14:35:68:D2 (Random)
2016-10-20 16:17:25.504478 < HCI Command: LE Read Remote Used Features (0x08|0x0016) plen 2
40 00
2016-10-20 16:17:25.504927 > HCI Event: Command Status (0x0f) plen 4
LE Read Remote Used Features (0x08|0x0016) status 0x00 ncmd 1
2016-10-20 16:17:25.574356 > HCI Event: LE Meta Event (0x3e) plen 12
LE Read Remote Used Features Complete
status 0x00 handle 64
Features: 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00
2016-10-20 16:17:25.595367 < ACL data: handle 64 flags 0x00 dlen 7
ATT: MTU req (0x02)
client rx mtu 256
2016-10-20 16:17:25.619180 > ACL data: handle 64 flags 0x02 dlen 7
ATT: MTU resp (0x03)
server rx mtu 23
2016-10-20 16:17:25.620756 < ACL data: handle 64 flags 0x00 dlen 11
ATT: Read By Group req (0x10)
start 0x0001, end 0xffff
type-uuid 0x2800
2016-10-20 16:17:25.634251 > HCI Event: Number of Completed Packets (0x13) plen 5
handle 64 packets 2
2016-10-20 16:17:25.634312 < HCI Command: Disconnect (0x01|0x0006) plen 3
handle 64 reason 0x13
Reason: Remote User Terminated Connection
2016-10-20 16:17:25.634744 > HCI Event: Command Status (0x0f) plen 4
Disconnect (0x01|0x0006) status 0x00 ncmd 1
2016-10-20 16:17:25.649805 > HCI Event: Disconn Complete (0x05) plen 4
status 0x00 handle 64 reason 0x16
Reason: Connection Terminated by Local Host
2016-10-20 16:17:25.734250 < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
value 0x01 (scanning enabled)
filter duplicates 0x01 (enabled)
2016-10-20 16:17:25.734742 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Enable (0x08|0x000c) ncmd 1
status 0x00
2016-10-20 16:17:25.749839 > HCI Event: LE Meta Event (0x3e) plen 36
LE Advertising Report
ADV_IND - Connectable undirected advertising (0)
bdaddr C9:14:14:35:68:D2 (Random)
Flags: 0x06
TX power level: 0
Unknown type 0x06 with 16 bytes data
RSSI: -53 Could you please let me know if I can do more regarding this issue? Thanks, |
You're test code looks very similar to mine and is showing the same repeated connect/disconnect. Open issue #474 RPI3 Disconnect Event causes hang. |
@kotobuki maybe try rebooting the Raspberry Pi and trying again? Could you also try See: https://github.com/sandeepmistry/noble/blob/master/lib/hci-socket/hci.js#L314-L319 |
Sorry for the delay in reply. As you pointed, I forgot to reboot after replacing. I tied again after rebooting, and I don't see repeated connect/disconnect anymore! However, I can't connect to the device since disconnected immediately. $ sudo hcidump -t -x
HCI sniffer - Bluetooth packet analyzer ver 5.23
device: hci0 snap_len: 1500 filter: 0xffffffff
2016-10-28 11:26:59.499129 < HCI Command: Set Event Mask (0x03|0x0001) plen 8
Mask: 0xfffffbff07f8bf3d
2016-10-28 11:26:59.499642 > HCI Event: Command Complete (0x0e) plen 4
Set Event Mask (0x03|0x0001) ncmd 1
status 0x00
2016-10-28 11:26:59.499686 < HCI Command: LE Set Event Mask (0x08|0x0001) plen 8
mask 0x1f00000000000000 (Reserved)
2016-10-28 11:26:59.500189 > HCI Event: Command Complete (0x0e) plen 4
LE Set Event Mask (0x08|0x0001) ncmd 1
status 0x00
2016-10-28 11:26:59.500215 < HCI Command: Read Local Version Information (0x04|0x0001) plen 0
2016-10-28 11:26:59.500657 > HCI Event: Command Complete (0x0e) plen 12
Read Local Version Information (0x04|0x0001) ncmd 1
status 0x00
HCI Version: 4.1 (0x7) HCI Revision: 0xb6
LMP Version: 4.1 (0x7) LMP Subversion: 0x2209
Manufacturer: Broadcom Corporation (15)
2016-10-28 11:26:59.500680 < HCI Command: Write LE Host Supported (0x03|0x006d) plen 2
01 00
2016-10-28 11:26:59.501054 > HCI Event: Command Complete (0x0e) plen 4
Write LE Host Supported (0x03|0x006d) ncmd 1
00
2016-10-28 11:26:59.501077 < HCI Command: Read LE Host Supported (0x03|0x006c) plen 0
2016-10-28 11:26:59.501495 > HCI Event: Command Complete (0x0e) plen 6
Read LE Host Supported (0x03|0x006c) ncmd 1
00 01 00
2016-10-28 11:26:59.501512 < HCI Command: Read BD ADDR (0x04|0x0009) plen 0
2016-10-28 11:26:59.501926 > HCI Event: Command Complete (0x0e) plen 10
Read BD ADDR (0x04|0x0009) ncmd 1
status 0x00 bdaddr B8:27:EB:20:98:2D
2016-10-28 11:27:02.135829 < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
value 0x00 (scanning disabled)
filter duplicates 0x01 (enabled)
2016-10-28 11:27:02.136255 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Enable (0x08|0x000c) ncmd 1
status 0x0c
Error: Command Disallowed
2016-10-28 11:27:02.136509 < HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7
type 0x01 (active)
interval 10.000ms window 10.000ms
own address: 0x00 (Public) policy: All
2016-10-28 11:27:02.136966 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Parameters (0x08|0x000b) ncmd 1
status 0x00
2016-10-28 11:27:02.206240 < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
value 0x01 (scanning enabled)
filter duplicates 0x01 (enabled)
2016-10-28 11:27:02.206682 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Enable (0x08|0x000c) ncmd 1
status 0x00
2016-10-28 11:27:02.445819 > HCI Event: LE Meta Event (0x3e) plen 36
LE Advertising Report
ADV_IND - Connectable undirected advertising (0)
bdaddr C9:14:14:35:68:D2 (Random)
Flags: 0x06
TX power level: 0
Unknown type 0x06 with 16 bytes data
RSSI: -67
2016-10-28 11:27:02.446611 > HCI Event: LE Meta Event (0x3e) plen 35
LE Advertising Report
SCAN_RSP - Scan Response (4)
bdaddr C9:14:14:35:68:D2 (Random)
Complete local name: 'Adafruit Bluefruit LE'
RSSI: -67
2016-10-28 11:27:02.455233 < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
value 0x00 (scanning disabled)
filter duplicates 0x01 (enabled)
2016-10-28 11:27:02.456776 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Enable (0x08|0x000c) ncmd 1
status 0x00
2016-10-28 11:27:02.502611 < HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7
type 0x00 (passive)
interval 60.000ms window 30.000ms
own address: 0x00 (Public) policy: white list only
2016-10-28 11:27:02.503078 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Parameters (0x08|0x000b) ncmd 1
status 0x00
2016-10-28 11:27:02.503104 < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
value 0x01 (scanning enabled)
filter duplicates 0x01 (enabled)
2016-10-28 11:27:02.503518 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Enable (0x08|0x000c) ncmd 1
status 0x00
2016-10-28 11:27:05.395908 > HCI Event: LE Meta Event (0x3e) plen 36
LE Advertising Report
ADV_IND - Connectable undirected advertising (0)
bdaddr C9:14:14:35:68:D2 (Random)
Flags: 0x06
TX power level: 0
Unknown type 0x06 with 16 bytes data
RSSI: -51
2016-10-28 11:27:05.395979 < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
value 0x00 (scanning disabled)
filter duplicates 0x00 (disabled)
2016-10-28 11:27:05.397750 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Enable (0x08|0x000c) ncmd 1
status 0x00
2016-10-28 11:27:05.397808 < HCI Command: LE Create Connection (0x08|0x000d) plen 25
bdaddr C9:14:14:35:68:D2 type 1
interval 96 window 96 initiator_filter 0
own_bdaddr_type 0 min_interval 40 max_interval 56
latency 0 supervision_to 42 min_ce 0 max_ce 0
2016-10-28 11:27:05.398601 > HCI Event: Command Status (0x0f) plen 4
LE Create Connection (0x08|0x000d) status 0x00 ncmd 1
2016-10-28 11:27:05.822299 > HCI Event: LE Meta Event (0x3e) plen 19
LE Connection Complete
status 0x00 handle 64, role master
bdaddr C9:14:14:35:68:D2 (Random)
2016-10-28 11:27:05.822607 < HCI Command: LE Read Remote Used Features (0x08|0x0016) plen 2
40 00
2016-10-28 11:27:05.823352 > HCI Event: Command Status (0x0f) plen 4
LE Read Remote Used Features (0x08|0x0016) status 0x00 ncmd 1
2016-10-28 11:27:06.278615 > HCI Event: LE Meta Event (0x3e) plen 12
LE Read Remote Used Features Complete
status 0x00 handle 64
Features: 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00
2016-10-28 11:27:06.308670 < ACL data: handle 64 flags 0x00 dlen 7
ATT: MTU req (0x02)
client rx mtu 256
2016-10-28 11:27:06.480950 > ACL data: handle 64 flags 0x02 dlen 7
ATT: MTU resp (0x03)
server rx mtu 23
2016-10-28 11:27:06.483678 < ACL data: handle 64 flags 0x00 dlen 11
ATT: Read By Group req (0x10)
start 0x0001, end 0xffff
type-uuid 0x2800
2016-10-28 11:27:06.548553 > HCI Event: Number of Completed Packets (0x13) plen 5
handle 64 packets 2
2016-10-28 11:27:06.548666 < HCI Command: Disconnect (0x01|0x0006) plen 3
handle 64 reason 0x13
Reason: Remote User Terminated Connection
2016-10-28 11:27:06.549121 > HCI Event: Command Status (0x0f) plen 4
Disconnect (0x01|0x0006) status 0x00 ncmd 1
2016-10-28 11:27:06.954066 > HCI Event: Disconn Complete (0x05) plen 4
status 0x00 handle 64 reason 0x22
Reason: LMP Response Timeout
2016-10-28 11:27:07.026857 < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
value 0x01 (scanning enabled)
filter duplicates 0x01 (enabled)
2016-10-28 11:27:07.028499 > HCI Event: Command Complete (0x0e) plen 4
LE Set Scan Enable (0x08|0x000c) ncmd 1
status 0x00
2016-10-28 11:27:07.040452 > HCI Event: LE Meta Event (0x3e) plen 36
LE Advertising Report
ADV_IND - Connectable undirected advertising (0)
bdaddr C9:14:14:35:68:D2 (Random)
Flags: 0x06
TX power level: 0
Unknown type 0x06 with 16 bytes data
RSSI: -53 I also tried to connect with gatttool to check stability. First, I checked the device's MAC address. $ sudo node advertisement-discovery.js
peripheral discovered (c914143568d2 with address <c9:14:14:35:68:d2, random>, connectable true, RSSI -66:
hello my local name is:
Adafruit Bluefruit LE
can I interest you in any of the following advertised services:
["6e400001b5a3f393e0a9e50e24dcca9e"]
my TX power level is:
0 Then I tried to connect manually. However, I got an error after typing 'connect'... $ sudo gatttool -b c9:14:14:35:68:d2 -I
[c9:14:14:35:68:d2][LE]> connect
Attempting to connect to c9:14:14:35:68:d2
Error: connect error: Connection refused (111) Could you please let me know if you find any errors regarding the usage of gatttool? Thanks, |
Hi, I have a small update regarding this issue. I simplified the test code and added debug outputs for var noble = require('noble');
// The proprietary UART profile by Nordic Semiconductor
var uartServiceUuid = '6e400001b5a3f393e0a9e50e24dcca9e';
noble.on('stateChange', function(state) {
if (state === 'poweredOn') {
noble.startScanning([uartServiceUuid], false);
} else {
noble.stopScanning();
}
});
noble.on('scanStart', function() {
console.warn('Scan started');
});
noble.on('scanStop', function() {
console.warn('Scan stopped');
});
noble.on('discover', function(peripheral) {
if (peripheral.advertisement.localName !== "BLE_ROV") {
return;
}
noble.stopScanning();
peripheral.connect(function(err) {
if (err) {
console.error('Error connecting: ' + err);
return;
}
console.log('Connected to ' + peripheral.advertisement.localName);
peripheral.once('disconnect', function(err) {
console.log('Disconnected');
noble.startScanning([uartServiceUuid], false);
});
});
}); On macOS (El Capitan 10.11.6), the test code worked as expected: Scan started
Scan stopped
Connected to BLE_ROV However, on Raspbian (September 2016) another scan started just after the first scan stopped: Scan started
Scan stopped
Scan started
Connected to BLE_ROV Thanks, |
I think you need to specify a random address type ... try:
Another thing to try is disabling WiFi and using Ethernet instead ... |
@sandeepmistry $ sudo gatttool -b c9:14:135:68:d2 -t random -I
[c9:14:14:35:68:d2][LE]> connect
Attempting to connect to c9:14:14:35:68:d2
Connection successful
[c9:14:14:35:68:d2][LE]> I could make a connection successfully. Then I waited several minutes and the connection was not disconnected until disconnecting manually by typing |
@sandeepmistry First, I turned on the Bluefruit LE module and started running the test script as follows. $ sudo node test.js
Scan started
Scan stopped
Connected to Adafruit Bluefruit LE Next, I powered off the Bluefruit LE module Disconnected
Scan started Then, I power on the module again and got a log as follows. Scan stopped
Connected to Adafruit Bluefruit LE
Disconnected
Scan started
Scan stopped
Connected to Adafruit Bluefruit LE The connection seemed to be stable, since there were no repeated connect/disconnect many times in several seconds. However, there were a pair of connect and disconnect. Anyway, the modified connection interval looks good. Do you have a plan to merge to be distributed? |
Hi,
I have been trying to use noble (v1.7.0) on a Raspberry Pi 3 with Raspbian (September 2016). First, I installed noble with npm as follows:
Then I tried with the following code (ble-uart-test.js):
There were many connections and disconnections within several seconds as follows:
On macOS (10.11.6), there were no unexpected disconnections after a connection:
I confirmed with both Feather 32u4 Bluefruit LE and Arduino/Genuino 101 with an BLE UART sketch uploaded.
This might be a false alarm, but I'd like to report just to make sure. If there's anything that comes to your attention about that please let me know.
Shigeru
The text was updated successfully, but these errors were encountered: