tinygo-org / bluetooth

Cross-platform Bluetooth API for Go and TinyGo. Supports Linux, macOS, Windows, and bare metal using Nordic SoftDevice or HCI
https://tinygo.org
Other
722 stars 135 forks source link

Connection not working on nRF52840-DK #67

Open andrewrynhard opened 3 years ago

andrewrynhard commented 3 years ago

I have flashed the heart rate example to a nRF52840-DK) board, and am unable to get anything to connect. It seems that they get the initial advertised services, but the connection eventually times out. Not sure what you need from me, but happy to share whatever.

aykevl commented 3 years ago

Sadly my nrf52840-DK has died so I can't reproduce it locally.

One thing you can check: are you using the correct SoftDevice? Try nrfjprog -f nrf52 --eraseall, then flashing the SoftDevice (S140) and then the heart rate example. Also, what app are you using to connect? I usually nRF Connect from Nordic, which works great for debugging all kinds of BLE issues.

If you are able to connect (you can connect and see the services in nRF Connect) then you're already past like 99% of possible issues. I don't know why it would fail then. Have you looked at the serial console, to see whether it prints anything interesting such as a panic?

andrewrynhard commented 3 years ago

Here are the steps I took:

I can see output on the serial console. I have also tried building with tinygo build -o payload.hex -size=short -target=pca10056-s140v7 . and then flashing with nrfjprog --family nrf52 --sectorerase --program payload.hex --verify. I am using nRF Connect. The discovery happens just fine, but connecting hangs (note that I changed the local name):

Screenshot

aykevl commented 3 years ago

Hmm, strange. So the console output doesn't show anything unexpected, like an error?

andrewrynhard commented 3 years ago

Hmm, strange. So the console output doesn't show anything unexpected, like an error?

It does not. Relatively new to this space, so anywhere you want me to look, just point me in the direction.

eldondev commented 3 years ago

Could this be related to #53 ?

mlsorensen commented 1 year ago

I know this is old, but I experience exactly the same thing. I have two of the circuitplay-bluefruit devices. When I load any examples and try to use any of the scanner apps on my phone to connect, they just hang at "connecting" and then time out.

What is interesting is that the connect handler fires. For example the lights turn on after I attempt to connect with the neopixel example. But scanners never complete a connect or see any services.