OK, I have succeeded in connecting and getting a REPL via bluetooth using: https://aykevl.nl/apps/nus/ on the holyiot board.
But the nus console which is using nodejs noble just sits there waiting forever for a connection, it seems that this may be related to noble incompatibility with osx mojave which I am running.
But I also notice that using the web console, the connection is dropped after exactly 40 seconds irregardless of whether you are typing something or not.
Is this a timeout configuration setting somewhere, either on the NRF device or in the javascript connection ?
[nRF5x] How to connect using WebBluetooth REPL?
Re: [nRF5x] How to connect using WebBluetooth REPL?
FWIW, I also couldn't get that to work either. However, I decided not to dwell on it, since the WebBluetooth repl seems to work fine. So, just take this as a confirmation.
Mine stays connected without timeouts, seemingly forever, which is good. Maybe it's the bluetooth on the other end of your connection? I'm using a Bluetooth 4.0 usb dongle (I posted a link to it above) for that. Even though it's ancient, it seems to do the business.
Re: [nRF5x] How to connect using WebBluetooth REPL?
I am using the bluetooth built into my macbook, exactly 40 seconds after I connect, it disconnects.
Bluetooth HCI version is 4.2:
Bluetooth HCI version is 4.2:
Code: Select all
Apple Bluetooth Software Version: 6.0.8f6
Hardware, Features and Settings:
Address: F4-0F-24-32-A6-33
Bluetooth Low Energy Supported: Yes
Handoff Supported: Yes
Instant Hot Spot Supported: Yes
Manufacturer: Broadcom
Transport: UART
Chipset: 20703A2
Firmware Version: v71 c4274
Bluetooth Power: On
Discoverable: On
Connectable: Yes
Auto Seek Pointing: On
Remote wake: On
Vendor ID: 0x05AC
Product ID: 0x007E
HCI Version: 4.2 (0x8)
HCI Revision: 0x10B2
LMP Version: 4.2 (0x8)
LMP Subversion: 0x2247
Device Type (Major): Computer
Device Type (Complete): Mac Portable
Composite Class Of Device: 0x38010C
Device Class (Major): 0x01
Device Class (Minor): 0x03
Service Class: 0x1C0
Auto Seek Keyboard: On
Re: [nRF5x] How to connect using WebBluetooth REPL?
Do you happen to have a raspberry pi 3 with built-in bluetooth? Maybe try that. It also worked for me.
Re: [nRF5x] How to connect using WebBluetooth REPL?
OK, managed to get nodejs version running on raspberry pi and no disconnects so that is workable.
I am using NVM and running nodejs 8.12 LTS:
I am using NVM and running nodejs 8.12 LTS:
Code: Select all
node index.js
Found device with local name: mpus
advertising the following service uuid's: 6e400001b5a3f393e0a9e50e24dcca9e
>>> help()
Welcome to MicroPython!
For online help please visit http://micropython.org/help/.
Quick overview of commands for the board:
If compiled with SD=<softdevice> the additional commands are
available:
ble.enable() -- enable bluetooth stack
ble.disable() -- disable bluetooth stack
ble.enabled() -- check whether bluetooth stack is enabled
ble.address() -- return device address as text string
Control commands:
CTRL-A -- on a blank line, enter raw REPL mode
CTRL-B -- on a blank line, enter normal REPL mode
CTRL-D -- on a blank line, do a soft reset of the board
CTRL-E -- on a blank line, enter paste mode
For further help on a specific object, type help(obj)
>>>
>>>
>>> help('modules')
__main__ gc random ubluepy
array machine scan ucollections
ble math sys uos
board micropython time ustruct
builtins os time utime
Plus any modules on the filesystem
>>>
Re: [nRF5x] How to connect using WebBluetooth REPL?
I just created a NUS Telnet gateway based on the original nus_gateway design in nodejs using noble.
I can connect locally via localhost or remotely via the network using telnet, screen or rshell, however rshell fails with the same error as when connecting to the serial port.
So this effectively means that I would be able to connect to the NRF via Bluetooth using RSHELL's telnet connection mode which does make the bluetooth REPL very useful (to me).
I have also tried just creating a Linux rfcomm device port which, if it worked would have been much simpler and easier to implement, but I was not able to get it to work.
I can connect locally via localhost or remotely via the network using telnet, screen or rshell, however rshell fails with the same error as when connecting to the serial port.
So this effectively means that I would be able to connect to the NRF via Bluetooth using RSHELL's telnet connection mode which does make the bluetooth REPL very useful (to me).
Code: Select all
telnet 192.168.0.85
Trying 192.168.0.85...
Connected to ubu64dev.
Escape character is '^]'.
>>> help()
help()
Welcome to MicroPython!
For online help please visit http://micropython.org/help/.
Quick overview of commands for the board:
If compiled with SD=<softdevice> the additional commands are
available:
ble.enable() -- enable bluetooth stack
ble.disable() -- disable bluetooth stack
ble.enabled() -- check whether bluetooth stack is enabled
ble.address() -- return device address as text string
Control commands:
CTRL-A -- on a blank line, enter raw REPL mode
CTRL-B -- on a blank line, enter normal REPL mode
CTRL-D -- on a blank line, do a soft reset of the board
CTRL-E -- on a blank line, enter paste mode
For further help on a specific object, type help(obj)
>>>
Code: Select all
rfcomm bind 0 FE:08:48:84:FE:28
screen /dev/rfcomm0 115200
Re: [nRF5x] How to connect using WebBluetooth REPL?
I believe i have found the cause for this. I'm working on making a serial wrapper to get the NUS service as a serial device on Linux. And i figured out that the BLE driver did not handle the BLE_GAP_EVT_DATA_LENGTH_UPDATE_REQUEST which made the Peripheral disconnect.devnull wrote: But I also notice that using the web console, the connection is dropped after exactly 40 seconds irregardless of whether you are typing something or not.
Updated code with this fix, which i hope to get time to PR soon can be seen here:
https://github.com/glennrub/micropython ... d15d3b6a19
A bit of topic, not WebBluetooth REPL, but pynus to get the NUS to a Linux serial device (/dev/pts/X) using socat:
https://github.com/aykevl/pynus/pull/1