Report
1 year, 6 months ago.

MicroBit Bluetooth pairing not working with code from online mbed compiler. Help needed.

I'm trying to connect my MicroBit to my phone via Bluetooth. All works smoothly and as expected on a brand new microbit (or one that has the original hex code re-installed), but any other hex I try to load from the mbed compiler (or other online tool) fails at the pairing stage. It won't do the passkey generation stage, so the phone won't pair. Any ideas? It seems like the standard microbit platform on the mbed compiler is missing something to allow pairing to work.

Question relating to:

The BBC micro:bit is a pocket-sized, codable computer that allows anyone to get creative with technology. Made possible through a major partnership with 31 organisations, a micro:bit has been given ...

I am having this problem also. I haven't got another MicroBit to test on, but have used code from one of the BBC provided compliers and can get pairing to work then.

posted by Simon Needham 11 Jun 2017
Comment on this question

1 Answer

4 months, 3 weeks ago.

Hello Stephen,

I know this question is over a year old, but may be you're still interessted. If you use the online compiler you need to create a config file named "mbed_config.json" in your projekt. The contents should be:

mbed_config.json

{
    "macros": [ "MICROBIT_BLE_ENABLED=1", 
                "MICROBIT_BLE_PAIRING_MODE=1",
                "MICROBIT_BLE_OPEN=1",
                "MICROBIT_BLE_EVENT_SERVICE=1",
                "MICROBIT_SD_GATT_TABLE_SIZE=0x600"]
}

If you compile offline with yotta you need a file called config.json.

config.json

{
    "microbit-dal": {
        "bluetooth": {
            "enabled": 1,
            "pairing_mode": 0,
            "open": 1,
            "event_service": 1
        },
        "gatt_table_size": "0x600"
    }
}

Best, Alex

Dunno if you know: But why is this required for the Micro:Bit and not the other NRF targets?

posted by Erik Olieman 28 Jan 2018

It's probably a bug. According to the runtime documentation paring should be turned on by default. https://lancaster-university.github.io/microbit-docs/advanced/#compile-time-configuration-options

P.S. "pairing_mode" should be set to 1 in the config.json I posted.

posted by Alexander Dölz 29 Jan 2018

To post an answer, please log in.