Page 1 of 4

[nRF5x] How to connect using WebBluetooth REPL?

Posted: Tue Oct 09, 2018 6:31 pm
by WhiteHare
I built the Bluetooth REPL for nRF52832, and uploaded it to my nRF52832-DK. Attached is the firmware.

Then, as described here: https://github.com/micropython/micropyt ... /ports/nrf
I tried connecting to it with nRF UART. However, the Bluetooth REPL doesn't seem to be broadcasting anything that I can connect with.

What to do?

Re: How to connect with Bluetooth REPL using nRF UART app?

Posted: Tue Oct 09, 2018 7:40 pm
by WhiteHare
As near as I can tell, the Bluetooth REPL is not discoverable, and so there is no way to connect to it.

How is it done?

Re: How to connect with Bluetooth REPL using nRF UART app?

Posted: Tue Oct 09, 2018 8:11 pm
by WhiteHare
OK, attached is corrected Bluetooth REPL firmware, but it's still not discoverable.

Re: How to connect with Bluetooth REPL using nRF UART app?

Posted: Tue Oct 09, 2018 8:37 pm
by WhiteHare
Attached are the bluetooth configuration settings that I used as part of the firmware compile.

Re: How to connect with Bluetooth REPL using nRF UART app?

Posted: Thu Oct 11, 2018 8:48 pm
by c45713
I cannot see any error in your bluetooth_conf.h.

The device name advertised should be "mpus". Can you see this when scanning for BLE device using a PC or other scanner app?
Also, make sure that you also flash the SoftDevice before "make flash", by issuing "make sd", else the app will not run at all. After first flash of SD, there is only needed to update the micropython firmware using "flash".

Also, to add in, there is several other ways to also connect to the BLE REPL using a PC,
1. chromium with "Experimental Web Platform features" enabled (chrome://flags). Then using this webbluetooth page to get the BLE connection and REPL in the browser: https://aykevl.nl/apps/nus/
2. https://github.com/aykevl/pynus
3. https://github.com/tralamazza/nus_console

Re: How to connect with Bluetooth REPL using nRF UART app?

Posted: Fri Oct 12, 2018 7:20 am
by kak
Here's what I did to get Bluetooth REPL running on a pca10059 dongle (beginning with a fresh git clone):

git clone https://github.com/micropython/micropython.git
cd micropython
git submodule update --init
make -C mpy-cross
cd boards/nrf
./drivers/bluetooth/download_ble_stack.sh
modify bluetooth_conf.h

Code: Select all

#elif (BLUETOOTH_SD == 140)

#define MICROPY_PY_BLE                  (1)
#define MICROPY_PY_BLE_NUS 	      (1)
make BOARD=pca10056 SD=s140

Open nRF Connect, connect to the dongle running in DFU mode, add both
micropython/ports/nrf/build-pca10056-s140/firmware.hex and
micropython/ports/nrf/drivers/bluetooth/s140_nrf52_6.0.0/s140_nrf52_6.0.0_softdevice.hex
and flash the to the dongle.

The dongle now comes up and advertises as "mpus".

I connected to it using Google Chrome running on an Android phone, via the website https://aykevl.nl/apps/nus/.

Thanks again for your help, c45713

Re: How to connect with Bluetooth REPL using nRF UART app?

Posted: Fri Oct 12, 2018 5:04 pm
by WhiteHare
Thank you Kak and c45713 for both your posts. The extra details are very welcome. :D

I suspect my error may have been using Nordic's drag-and-drop approach to .hex flashing, which may not be sufficient in this case. I'm short on time over the next few days, but I will try again, but this time using Kak's step-by-step instructions on a fresh non-vm x86 Debian system (with Bluetooth!) next week. I'll report back afterward.

Re: How to connect with Bluetooth REPL using nRF UART app?

Posted: Sat Oct 13, 2018 2:27 am
by WhiteHare
I'm stuck on

Code: Select all

make flash
It fails, saying it can't find jlinkarm.dll, but I've been unsuccessful on finding it either.

Re: How to connect with Bluetooth REPL using nRF UART app?

Posted: Sat Oct 13, 2018 12:43 pm
by kak
Did you install the JLINK software for Linux from Segger?
https://www.segger.com/downloads/jlink/ ... tationPack

If not, use nRF Connect to flash.

Re: How to connect with Bluetooth REPL using nRF UART app?

Posted: Sat Oct 13, 2018 4:17 pm
by WhiteHare
kak wrote:
Sat Oct 13, 2018 12:43 pm
Did you install the JLINK software for Linux from Segger?
https://www.segger.com/downloads/jlink/ ... tationPack

If not, use nRF Connect to flash.
Thanks! I used J-Link Software and Documentation pack for Linux, DEB installer, 64-bit, and it worked.

I made it through the entire bluetooth build. Unlike before, I can now find mpus and connect with it over bluetooth using nRF UART 2.0 on my Galaxy 8 phone. However, whatever I send it is not replied to, and after awhile it just disconnects on me. :(

Same result using both the nRF52-DK and the nRF52840-DK.

Am I supposed to flash something onto it *after* doing the bluetooth flash? I tried doing that too, but it seemed to erase the bluetooth flash, rendering bluetooth no longer operative again.

Well, definitely getting closer at least. :)