You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: bluetooth/index.md
+63-9Lines changed: 63 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ lang: en
11
11
12
12
## Overview
13
13
14
-
The micro:bit processor has an on-board [Bluetooth](http://blog.bluetooth.com/a-developers-guide-to-bluetooth/) transceiver. This is combined with a PCB trace aerial and other minor components alongside a software stack that gives the micro:bit a certified and credible Bluetooth capability.
14
+
The micro:bit processor has an on-board [Bluetooth](https://www.bluetooth.com/specifications/) transceiver. This is combined with a PCB trace aerial and other minor components alongside a software stack that gives the micro:bit a certified and credible Bluetooth capability.
15
15
16
16
## Bluetooth software stack
17
17
@@ -20,9 +20,68 @@ The micro:bit processor has an on-board [Bluetooth](http://blog.bluetooth.com/a-
20
20
21
21
Using Bluetooth, you can connect to other devices and send and receive data from and to the micro:bit.
22
22
23
-
## micro:bit Bluetooth Features
23
+
Bluetooth is [distinct from the micro:bit to micro:bit radio feature](https://support.microbit.org/support/solutions/articles/19000083637-using-the-micro-bit-wirelessly-),which is a [proprietary protocol from Nordic and Lancaster University](https://lancaster-university.github.io/microbit-docs/ubit/radio/).
24
+
25
+
## BBC micro:bit Bluetooth Profile
26
+
27
+
The micro:bit supports Bluetooth via a single, custom-developed, BBC micro:bit profile. This profile allows it to communicate with other BLE capable devices.
28
+
29
+
## CODAL
30
+
31
+
A pre-compiled hex file is available to download for <spanclass="v2">V2</span> that enables all Bluetooth services.
32
+
33
+
[Bluetooth all services CODAL](/docs/bluetooth/assets/BLE_All_Services_CODAL_0-0-24-ABDLIMTU-P.hex){: .btn.sm-btn download}
34
+
35
+
The source for this can be found in the [microbit-v2-samples]https://github.com/lancaster-university/microbit-v2-samples/tree/master/source/samples repository.
36
+
37
+
### DAL
38
+
39
+
The BBC micro:bit <spanclass="v1">V1</span> [Bluetooth profile is defined in the DAL](https://lancaster-university.github.io/microbit-docs/ble/profile/)
40
+
41
+
You can flash one of two pre-compiled Hex files to the micro:bit <spanclass="v1">V1</span> that enable bluetooth services. As Bluetooth is memory intensive, these are supplied as either 'without Magnetometer Service' or 'without DFU Service':
The DAL contains the [C++ source for the BLE service files](https://github.com/lancaster-university/microbit-samples/blob/master/source/examples/bluetooth-services/main.cpp)
48
+
49
+
There are also some example programs in the [microbit-samples](https://github.com/lancaster-university/microbit-samples) repository:
The micro:bit has a <spanclass="v2">V2</span>Bluetooth 5.0/<spanclass="v1">V1</span>Bluetooth 4.1 stack with Bluetooth Low Energy (BLE) and supports the <spanclass="v1">V1</span>[GAP Peripheral Role](https://bluetooth-developer.blogspot.com/2016/07/microbit-and-bluetooth-roles.html) and <spanclass="v2">V2</span> GAP Peripheral and Central device roles.
58
+
59
+
It operates in the ISM (Industrial Scientific Medical) band, as per all Bluetooth devices. This starts at **2.4GHz and ends at 2.41GHz**. BLE divides the frequency band into 50 x 2MHz bands of which 40 are used. These are called **channels** and numbered **0 to 39**. Channels 37, 38 and 39 are used for "advertising".
60
+
61
+
When devices are connected, they use the other channels in a particular sequence controlled by a feature called **adaptive frequency hopping**. This helps reduce the impact of congestion from other radio users.
62
+
63
+
Data transfer rates will only be a few hundred Kilobytes per second at best, and throughput depends on how your application uses the Bluetooth features. Throughput depends on the proportion of system protocol overheads to application data. Lots of small packets containing - for example - temperature data would have a lower data transfer rate than using the UART service.
64
+
65
+
There are some useful [advanced configuration options in the micro:bit runtime code](https://lancaster-university.github.io/microbit-docs/advanced/#compile-time-options-with-yotta)
66
+
67
+
## Challenge
68
+
69
+
It would be possible for anyone with the appropriate knowledge to define and implement other Bluetooth profiles.
70
+
71
+
We are seeking collaborators to help us define the new profile elements that expose some of the <spanclass="v2">V2</span> features.
72
+
73
+
## Further information
74
+
75
+
-[Martin Woolley's Bluetooth Blog](https://bluetooth-developer.blogspot.com/) has a range of information on using Bluetooth with micro:bit
76
+
77
+
-[BittySoftware](https://bittysoftware.blogspot.com) has a range of Bluetooth enabled software for the micro:bit
78
+
79
+
-[Original micro:bit "Out of the Box" experience](https://support.microbit.org/a/solutions/articles/19000021613), including some of the attributes in the Bluetooth Profile
80
+
81
+
-[Full profile with the display unused](https://lancaster-university.github.io/microbit-docs/resources/microbit-1_4_17_pwr0.zip). If you want to write to the display over bluetooth then you should use this file instead of the 'Out of the Box' hex, which uses the display.
82
+
83
+
-[micro:bit radio API documentation](https://lancaster-university.github.io/microbit-docs/ubit/radio/)
24
84
25
-
Bluetooth features available on the micro:bit are defined in a [Bluetooth profile](/bluetooth/profile). The micro:bit supports one, custom-developed profile.
26
85
27
86
## Bluetooth and the micro:bit software
28
87
@@ -35,9 +94,4 @@ The processor also has several non-bluetooth, proprietary modes of operation upo
35
94
-[Android App](https://play.google.com/store/apps/details?id=com.samsung.microbit) facilitates [pairing and flashing programs to the micro:bit](https://support.microbit.org/en/support/solutions/articles/19000051025-pairing-and-flashing-code-via-bluetooth)
36
95
-[iOS App](https://apps.apple.com/gb/app/micro-bit/id1092687276)faciliates [pairing and flashing programs to the micro:bit](https://support.microbit.org/en/support/solutions/articles/19000051025-pairing-and-flashing-code-via-bluetooth)
37
96
-[Swift Playgrounds](https://github.com/microbit-foundation/microbit-swift-playgrounds) contains a Playground Book available in the Swift app and a micro:bit Swift API to develop further resources
-[DAL/C++ Bluetooth Reference Documentation](https://lancaster-university.github.io/microbit-docs/ble/profile/#reference-documentation)
97
+
-[Scratch](https://scratch.mit.edu/microbit) supports using a range of micro:bit Bluetooth services via the Scratch Link software and a custom built pairing .hex
Copy file name to clipboardExpand all lines: software/hex-format.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -64,3 +64,7 @@ MicroPython builds take a firmware.hex image (the MicroPython pre-compiled image
64
64
## Microsoft MakeCode Editor
65
65
66
66
Hex files generated by the [MakeCode Editor](https://makecode.microbit.org) have embedded meta-data inside the .hex file. This is a [JSON encoded blob with various data about the script](https://github.com/Microsoft/pxt/blob/437f53ca6311335c7f3f75a062ec1079b4e7806a/docs/source-embedding.md), and also the source code program. This may be compressed, and it is stored inside the flash memory of the micro:bit (but only if space is available in the flash memory). But it is always inside the .hex file. This embedded source code program ensures that when you drag and drop the .hex file onto the originating editor, it can recover the source program again.
67
+
68
+
## Reading out a hex file
69
+
70
+
If you want to [read out the .hex file](https://www.embeddedlog.com/ubittool/usage.html) currently on your micro:bit, you can do so using [uBitTool](https://www.embeddedlog.com/ubittool).
Copy file name to clipboardExpand all lines: software/index.md
+1-3Lines changed: 1 addition & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -108,9 +108,7 @@ Each of the coding environments generates a special file called a .hex file, whi
108
108
109
109
The micro:bit code is updated by dragging a .hex file onto the MICROBIT drive that appears on your computer, when you plug in the micro:bit. It looks just like a USB memory stick to your computer (the flash drive is actually emulated by the [DAPLink](/software/daplink-interface) software)
110
110
111
-
It is also possible to 'flash' code to your micro:bit by using a mobile app, and using the Bluetooth communications interface from your mobile phone.
112
-
113
-
You can read more about [bluetooth flashing](/bluetooth/profile) or [bluetooth apps](/bluetooth/apps-and-examples) by following these links.
111
+
It is also possible to 'flash' code to your micro:bit by using a mobile app, and using the [Bluetooth](/bluetooth/) communications interface from your mobile phone.
Copy file name to clipboardExpand all lines: software/makecode.md
+18Lines changed: 18 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,24 @@ This target depends on several other repositories:
26
26
-<https://github.com/lancaster-university/microbit> basic wrapper around the DAL
27
27
-<https://github.com/lancaster-university/microbit-dal> the micro:bit DAL
28
28
29
+
## Compiler
30
+
31
+
MakeCode uses a built-in compiler to translate a project into a .hex file when you select **Download**.
32
+
33
+
This has the advantage of not requiring an internet connection in order to code the micro:bit. Once the browser editor at [makecode.microbit.org](https://makecode.microbit.org) loads, it is cached on your computer.
34
+
35
+
The MakeCode editors contain a copy of the micro:bit runtime [the DAL/CODAL](/software/runtime) which the blocks and javascript APIs reference.
36
+
37
+
When you press **Download** the compiler converts the code into a machine readable [hex file format](/software/hex-format).
38
+
39
+
When this .hex file is flashed onto the MICROBIT drive, the KL26/7 interface processor on the micro:bit copies it into the flash memory inside the nRF application processor and the code runs.
40
+
41
+
## Other Features
42
+
43
+
MakeCode supports two-way conversion of code, so you can write code as blocks and see what the generated code looks like in Javascript/MakeCode Python. You can also write Javascript/MakeCode Python code, and if possible, MakeCode will convert this back into blocks automatically.
44
+
45
+
MakeCode also allows you to [write your own block types](https://makecode.com/extensions) and [publish them as Extensions](https://makecode.microbit.org/extensions).
46
+
29
47
## App
30
48
31
49
An app is available for [Windows 10](https://www.microsoft.com/en-gb/p/makecode-for-micro-bit/9pjc7sv48lcx?rtc=1&activetab=pivot:overviewtab)
Copy file name to clipboardExpand all lines: software/python-editor.md
+1-6Lines changed: 1 addition & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,24 +21,19 @@ The Python editor is based upon the [Ace editor](http://ace.c9.io) and includes
21
21
22
22
The upstream source code for the Python Editor can be found at [github.com/bbcmicrobit/PythonEditor](https://github.com/bbcmicrobit/PythonEditor)
23
23
24
-
The micro:bit target depends a closed source versioning repository that facilitates releases at `/v/`, for example the beta editor https://python.microbit.org/v/beta and previous releases.
24
+
The micro:bit target depends a closed source versioning repository that facilitates releases at `/v/`, for example the beta editor [https://python.microbit.org/v/beta](https://python.microbit.org/v/beta) and previous releases.
25
25
26
26
### Offline
27
27
28
28
It is possible to use the Python Editor offline to generate, upload and download .hex or .py files. However, refreshing the browser resets the editor.
29
29
30
-
### Mu
31
-
32
-
[Mu](http://codewith.mu/) is a third party Python editor, that provides a downloadable, offline coding experience for the micro:bit and includes features such as datalogging and code debugging.
33
-
34
30
### Documentation
35
31
36
32
-[MicroPython reference](https://microbit-micropython.readthedocs.io/en/v1.0.1/) provides information and examples on using the blocks
0 commit comments