bittysoftware / microbit_blue_device_code

1 stars 1 forks source link

Can't get button service #1

Closed pl-wiltschek closed 4 years ago

pl-wiltschek commented 4 years ago

Dear developer,

I'm trying to get "antefact's microBit.js" to work. Accelerometer and temperature work fine, however, buttons and magnetometer bearing services don't respond.

This is the log output I'm getting:

microBit.js:240 Requesting Bluetooth Device...

microBit.js:241 with {"acceptAllDevices":true,"optionalServices":["e95d0753-251d-470a-a062-fa1922dfa9a8","e95df2d8-251d-470a-a062-fa1922dfa9a8","e95d9882-251d-470a-a062-fa1922dfa9a8","e95d127b-251d-470a-a062-fa1922dfa9a8","e95dd91d-251d-470a-a062-fa1922dfa9a8","e95d6100-251d-470a-a062-fa1922dfa9a8"]}

microBit.js:246 > Name:             BBC micro:bit [vitat]

microBit.js:247 > Id:               SXVpl2Vh5ANwbELjNV+FEg==

sketch.js:22 connected

microBit.js:259 Getting Services...

microBit.js:263 Getting Characteristics...

microBit.js:267 > Service: e95dd91d-251d-470a-a062-fa1922dfa9a8

microBit.js:269 >> Characteristic: e95d0d2d-251d-470a-a062-fa1922dfa9a8 [READ, WRITE]

microBit.js:269 >> Characteristic: e95d7b77-251d-470a-a062-fa1922dfa9a8 [READ, WRITE]

microBit.js:269 >> Characteristic: e95d93ee-251d-470a-a062-fa1922dfa9a8 [WRITE]

microBit.js:267 > Service: e95d0753-251d-470a-a062-fa1922dfa9a8

microBit.js:269 >> Characteristic: e95dca4b-251d-470a-a062-fa1922dfa9a8 [NOTIFY, READ]

microBit.js:269 >> Characteristic: e95dfb24-251d-470a-a062-fa1922dfa9a8 [READ, WRITE]

microBit.js:267 > Service: e95d6100-251d-470a-a062-fa1922dfa9a8

microBit.js:269 >> Characteristic: e95d1b25-251d-470a-a062-fa1922dfa9a8 [READ, WRITE]

microBit.js:269 >> Characteristic: e95d9250-251d-470a-a062-fa1922dfa9a8 [NOTIFY, READ]

My best guess is that the ids for the button and magnetometer services are wrong (how can I find out?) or that there's an issue with the device code.

Can you maybe point me in the right direction?

bittysoftware commented 4 years ago

The UUIDs for services listed in the log identify the accelerometer service, the temperature service and the LED service and so it would seem that your micro:bit is not running code which instantiates the button service or the magnetometer service.

Install the nRF Connect application on a smartphone to double check this.

If you are sure your device has these services on it then clear any pairing between browser/computer and reinstall your micro:bit code. It may be that the browser is cacheing the GATT services from a previous hex file on that micro:bit.

UUIDs are documented here: https://lancaster-university.github.io/microbit-docs/resources/bluetooth/bluetooth_profile.html

Hope this helps

pl-wiltschek commented 4 years ago

I used "microbit-blue-general-np.hex" (which strangely enough is now rejected by the microbit, saying the checksum failed). I just now looked at the source code and realized it indeed does not run those services. Are there hex files that have all services enabled that I can just use via Bluetooth? I have no idea how to create a hex file from scratch.

bittysoftware commented 4 years ago

You won't fit all the Bluetooth services into the available memory of your micro:bit.

See https://makecode.microbit.org/# for the easiest programming tool for micro:bit.

For assistance using MakeCode, please consult the microbit foundation or Microsoft.

If the checksum failed on the hex, then it sounds like the file has been corrupted. I just cloned the repo and was able to install that hex file without problem.

pl-wiltschek commented 4 years ago

Thanks for your help. I found the reason it wouldn't accept it. A saved the hex file via the browser (save target as) and apparently that's not the same as cloning.