1
1
# Setup
2
2
3
- ## Installing CircuitPython submodules
4
-
5
- Before you can build, you will need to run the following commands once, which
6
- will install the submodules that are part of the CircuitPython ecosystem, and
7
- build the ` mpy-cross ` tool:
3
+ Before you can build, you will need to run the following commands once:
8
4
9
5
```
10
6
$ cd circuitpython
11
7
$ git submodule update --init
12
8
$ make -C mpy-cross
13
9
```
14
10
15
- You then need to download the SD and Nordic SDK files via :
11
+ You then need to download the SD and Nordic SDK files:
16
12
17
13
> This script relies on ` wget ` , which must be available from the command line.
18
14
@@ -21,50 +17,47 @@ $ cd ports/nrf
21
17
$ ./drivers/bluetooth/download_ble_stack.sh
22
18
```
23
19
24
- ## Installing ` nrfutil `
25
-
26
- The Adafruit Bluefruit nRF52 Feather ships with a serial and OTA BLE bootloader
27
- that can be used to flash firmware images over a simple serial connection,
28
- using the on-board USB serial converter.
29
-
30
- If you haven't installed this command-line tool yet, go to the ` /libs/nrfutil `
31
- folder (where nrfutil 0.5.2 is installed as a sub-module) and run the following
32
- commands:
33
-
34
- > If you get a 'sudo: pip: command not found' error running 'sudo pip install',
35
- you can install pip via 'sudo easy_install pip'
36
-
37
- ```
38
- $ cd libs/nrfutil
39
- $ sudo pip install -r requirements.txt
40
- $ sudo python setup.py install
41
- ```
42
-
43
20
# Building and flashing firmware images
44
21
45
- ## Building CircuitPython binaries
22
+ ## Building CircuitPython
46
23
47
24
#### REPL over UART (default settings)
48
25
49
26
To build a CircuitPython binary with default settings for the
50
27
` feather52 ` target enter:
51
28
52
- > ** NOTE:** ` BOARD=feather52 ` is the default option and isn't stricly required.
53
-
54
29
```
55
30
$ make BOARD=feather52 V=1
56
31
```
57
32
58
- #### REPL over BLE support
33
+ #### REPL over BLE UART (AKA ` NUS ` )
59
34
60
- To build a CircuitPython binary with BLE support (S132) include ` SD=s132 `
61
- as part of the build process:
35
+ To build a CircuitPython binary with REPL over BLE UART, edit
36
+ ` bluetooth_conf.h ` with the following values (under
37
+ ` #elif (BLUETOOTH_SD == 132) ` ):
38
+
39
+ ```
40
+ #define MICROPY_PY_BLE (1)
41
+ #define MICROPY_PY_BLE_NUS (1)
42
+ #define BLUETOOTH_WEBBLUETOOTH_REPL (1)
43
+ ```
44
+
45
+ Then build the CircuitPython binary, including ` SD=s132 `
46
+ to enable BLE support in the build process:
62
47
63
48
```
64
49
$ make BOARD=feather52 V=1 SD=s132
65
50
```
66
51
67
- ## Flashing binaries with ` nrfutil `
52
+ ## Flashing with ` nrfutil `
53
+
54
+ The Adafruit Bluefruit nRF52 Feather ships with a serial and OTA BLE bootloader
55
+ that can be used to flash firmware images over a simple serial connection,
56
+ using the on-board USB serial converter.
57
+
58
+ These commands assume that you have already installed ` nrfutil ` , as described
59
+ in the [ learning guide] ( https://learn.adafruit.com/bluefruit-nrf52-feather-learning-guide/arduino-bsp-setup )
60
+ for the Arduino variant of the board.
68
61
69
62
### 1. ** Update bootloader** to single-bank version
70
63
@@ -95,7 +88,7 @@ To enable BLE5 support and the latest S132 release, flash the v5.0.0 bootloader
95
88
$ make BOARD=feather52 SERIAL=/dev/tty.SLAB_USBtoUART SOFTDEV_VERSION=5.0.0 boot-flash
96
89
```
97
90
98
- ### 2. Generate and flash a CircuitPython DFU .zip package over serial
91
+ ### 2. Generate a CircuitPython DFU .zip package and flash it over serial
99
92
100
93
The following command will package and flash the CircuitPython binary using the
101
94
appropriate bootloader mentionned above.
@@ -109,49 +102,9 @@ image, as described earlier in this readme.
109
102
$ make BOARD=feather52 SERIAL=/dev/tty.SLAB_USBtoUART dfu-gen dfu-flash
110
103
```
111
104
112
- If you built your CircuitPython binary with ** BLE** support you will need to
113
- add the ` SD=s132 ` flag as shown below:
105
+ If you built your CircuitPython binary with ** BLE UART ** support you will
106
+ need to add the ` SD=s132 ` flag as shown below:
114
107
115
108
```
116
109
$ make BOARD=feather52 SERIAL=/dev/tty.SLAB_USBtoUART SD=s132 dfu-gen dfu-flash
117
110
```
118
-
119
- ## Working with CircuitPython
120
-
121
- ### Running local files with ` ampy `
122
-
123
- [ ampy] ( https://learn.adafruit.com/micropython-basics-load-files-and-run-code/install-ampy )
124
- is a command-line tool that can be used with the nRF52 Feather to transfer
125
- local python files to the nRF52 for execution, rather than having to enter
126
- the REPL manually, enter paste mode, and paste the code yourself.
127
-
128
- > ** IMPORTANT** : You must have ` ampy ` version ** 1.0.3** or higher to use ` ampy `
129
- with the nRF52. The bootloader on the nRF52 requires a delay between the
130
- HW reset, and the moment when the command sequance is sent to enter raw
131
- mode. This required ` -d/--delay ` flag was added in release 1.0.3.
132
-
133
-
134
- Save the following file as ` test.py ` :
135
-
136
- ```
137
- import board
138
- import digitalio
139
- import time
140
-
141
- led = digitalio.DigitalInOut(board.LED2)
142
- led.direction = digitalio.Direction.OUTPUT
143
-
144
- while True:
145
- led.value = True
146
- time.sleep(0.5)
147
- led.value = False
148
- time.sleep(0.5)
149
- ```
150
-
151
- Then run the saved file via ampy, updating the serial port as required:
152
-
153
- ```
154
- $ ampy -p /dev/tty.SLAB_USBtoUART -d 1.5 run test.py
155
- ```
156
-
157
- This should give you blinky at 1 Hz on LED2 (the blue LED on the nRF52 Feather).
0 commit comments