Uncaught InternalError: BLE task completed that wasn't scheduled (3/4) #4140
Replies: 1 comment
-
Posted at 2019-11-28 by @gfwilliams Can you try one of the latest builds from: http://www.espruino.com/binaries/travis/master/
I'm not sure why it appears to have gone through the promises while the firmware still thinks it's searching for services. Still, it'd be worth trying with the new firmware. If your Bangle.js had the Nodeconf firmware I think that was before this got added. edit: just for the curious, BLE task numbers are listed here: https://github.com/espruino/Espruino/blob/master/libs/bluetooth/jswrap_bluetooth.h#L22 Posted at 2019-11-28 by ConorONeill Thanks Gordon. Just tried latest Pixl.js build. The BLE error ended up being user error. If I don't use the full UUID for the characteristic then it should be 0x2A37 not "0x2A37". So errors now gone but still no change notifications. Note that a non-changing value can be read fine e.g. Body Sensor Position gives 1 (Chest) correctly with this:
Just looking at NRF Connect logs, it does gatt.setCharacteristicNotification(). Is that done under the hood in c.on('characteristicvaluechanged' ?
I found some info that says HRMs specifically need to be told to send updates, so I added:
But still no joy. Posted at 2019-11-28 by ConorONeill That last code Iposted can't work. NRF Connect is writing to descriptors not characteristics. Posted at 2019-12-04 by @gfwilliams
I thought that might be the issue so I looked at the code, and the string should have worked (https://github.com/espruino/Espruino/blob/master/libs/bluetooth/bluetooth_utils.c#L140)
Yes, that's what Are you still getting randomly disconnected? It's possible it is because Espruino and the device can't agree on a connection interval. You could try setting minInterval to 7.5 and maxInterval to 4000 to give it the max leeway in negotiating speed? Not sure what else to suggest without having one here to play with I'm afraid. If you're feeling like diving in then I have an nRF52DK then Nordic have some tools to let you use it with Wireshark to snoop on Bluetooth LE traffic though Posted at 2019-12-04 by ConorONeill Thanks Gordon. I'll do more poking around. There is something odd tho in UUID handling at the moment. The latest stable Pixl.js firmware running same code gives an error for full UUIDs saying they must only contain hex characters and dashes, when I'm using things like "8d96b002-0002-64c2-0001-9acc4838521c". Only stops giving error if I use short 0xNNNN UUIDs with no quotes. Bangle.js not giving that error for the same code. Posted at 2023-02-13 by Riccardokhm Hi! I'm facing a similar issue on my Bangle Js 2, have you solved the issue? Posted at 2023-02-13 by @fanoush well, "similar" issue may also be something completely different, why not to describe the exact issue you have? Posted at 2023-02-13 by Riccardokhm The same error is returned when trying to get the primary service of my laptop from bangle js. I implemented a Gattserver solution on my laptop advertsing a costant value (as explained in UWP sample on Microsoft website): the bangle successuflly connects to my laptop but on finding primary services the code run into the same error. I suppose it's not able to find the service even if on scanning BLE devices nearby with relative services it seems to be visible. Here my JS code:
After printing "Connected" the error appears! Posted at 2023-02-13 by @fanoush And the error is "Uncaught InternalError: BLE task completed that wasn't scheduled (3/4)" ? I see you are calling it from And you really want for it to work in a way that anytime something connects to bangle the bangle will immediately try to connect to something else? That's a bit odd. Posted at 2023-02-14 by Riccardokhm Yes the error is that, but in debugging it return that service is null actually. The C# console application successfully creates a service and the associated characteristic, which is connetable and discoverable, but the bangle seems not able to find the primary service. I even tried to get all the primary services after connecting to the laptop but null object is returned. As for the connect event handler, basically what I want to achieve is that whenever something connects to the bangle a message is display on the bangle screen, as it is already doing. Posted at 2023-02-14 by Riccardokhm This is the part of code running after connection.
and this is what it is returned by the console: [ Posted at 2023-02-14 by @fanoush
Yes, but why are you calling Posted at 2023-02-14 by Riccardokhm Yeah sorry, the first connect within the .on('Connect') was removed, actually the only one is the last on the bottom. Here is my final code:
The thing is that when I send something from my laptop, bangle does not seem to receive it. Posted at 2023-02-14 by @fanoush
not exactly. Bluetooth is instance of Serial that works as console. So yes if you send something to Nordic UART RX characteristics it will be received and data event is called just like when Serial or USB serial port receiving some characters. If you have your own BLE writable characteristics it is not related to Bluetooth serial object or 'data' event. Posted at 2023-02-14 by Riccardokhm Clear, actually my laptop console application is connected to the Nordic UART service, so it should work. Unfortunately, by now, the bangle receives only the first data buffer: when I tried to send it again, no event is triggered.
Posted at 2023-02-14 by @fanoush so this is second place where you are trying to solve the same problem and it is unrelated to the 3 years old topic. also we can hardly help you with your c# code here, so maybe lets continue in your old topic and focus on your javascript code. Gordon suggested to test your JS code by using something verified like nrfconnect android app where you can connect to Bangle and send data to characteristics and verify your JS code works as expected. If it works there then it is in your c# code. Also if you are into c# you can also test with bleconsole https://github.com/fanoush/BLEConsole it can also read/write to characteristics. subscribing to nordic tx and writing to nordic rx example is here https://gist.github.com/fanoush/c17263e57e5ea204de7b2bb01d2a258f#file-bleconsole-log-L24 Posted at 2023-02-15 by Riccardokhm Sorry for the spam, I didn't mean to change topic. I will go through Gordon's suggestions: I already test the BLE console and I am now working on a custom solution adapted to my needs. Anyway, thank you for your time! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-11-28 by ConorONeill
I'm trying to read pulse data from a cheap Aldi/Lidl Bluetooth chest HRM strap (brand Medisana).
NRF Connect can see the data fine and shows continuous value updates when connected. But I'm having no joy using some of the sample code floating around the forums and API reference on either a Pixl.js (latest 2v04 stable) or Bangle.js. The code I'm using is as follows:
It connects fine and gets through the primary service and characteristic but it never shows any update notifications.
It also gives the
error after a few seconds.
The Service info is:
and the Characteristic info is:
Any suggestions for things to try?
Beta Was this translation helpful? Give feedback.
All reactions