1.. zephyr:board:: bl654_sensor_board
2
3Overview
4********
5
6The BL654 Sensor Board hardware provides support for the Ezurio
7BL654 module which is powered by a Nordic Semiconductor nRF52840 ARM
8Cortex-M4F CPU.
9
10This sensor board has the following features:
11
12* :abbr:`ADC (Analog to Digital Converter)`
13* CLOCK
14* FLASH
15* :abbr:`GPIO (General Purpose Input Output)`
16* :abbr:`I2C (Inter-Integrated Circuit)`
17* :abbr:`MPU (Memory Protection Unit)`
18* :abbr:`NVIC (Nested Vectored Interrupt Controller)`
19* :abbr:`PWM (Pulse Width Modulation)`
20* RADIO (Bluetooth Low Energy and 802.15.4)
21* :abbr:`RTC (nRF RTC System Clock)`
22* Segger RTT (RTT Console)
23* :abbr:`SPI (Serial Peripheral Interface)`
24* :abbr:`UART (Universal asynchronous receiver-transmitter)`
25* :abbr:`WDT (Watchdog Timer)`
26
27.. figure:: img/bl654_sensor_board_usb_swd_programmer.jpg
28     :align: center
29     :alt: BL654 Sensor Board connected to USB-SWD Programmer (UART and SWD access)
30
31     BL654 Sensor Board connected to USB-SWD Programmer (UART and SWD access)
32
33More information about the BL654 module can be found on the `BL654 website`_,
34more information about the USB-SWD Programmer can be found on the
35`USB-SWD Programmer website`_.
36
37Hardware
38********
39
40Supported Features
41==================
42
43The BL654 Sensor Board configuration supports the following hardware features:
44
45+-----------+------------+----------------------+
46| Interface | Controller | Driver/Component     |
47+===========+============+======================+
48| ADC       | on-chip    | adc                  |
49+-----------+------------+----------------------+
50| CLOCK     | on-chip    | clock_control        |
51+-----------+------------+----------------------+
52| FLASH     | on-chip    | flash                |
53+-----------+------------+----------------------+
54| GPIO      | on-chip    | gpio                 |
55+-----------+------------+----------------------+
56| I2C(M)    | on-chip    | i2c                  |
57+-----------+------------+----------------------+
58| MPU       | on-chip    | arch/arm             |
59+-----------+------------+----------------------+
60| NVIC      | on-chip    | arch/arm             |
61+-----------+------------+----------------------+
62| PWM       | on-chip    | pwm                  |
63+-----------+------------+----------------------+
64| RADIO     | on-chip    | Bluetooth,           |
65|           |            | ieee802154           |
66+-----------+------------+----------------------+
67| RTC       | on-chip    | system clock         |
68+-----------+------------+----------------------+
69| RTT       | Segger     | console              |
70+-----------+------------+----------------------+
71| SPI(M/S)  | on-chip    | spi                  |
72+-----------+------------+----------------------+
73| UART      | on-chip    | serial               |
74+-----------+------------+----------------------+
75| WDT       | on-chip    | watchdog             |
76+-----------+------------+----------------------+
77
78Other hardware features have not been enabled yet for this board.
79See the `BL654 website`_ for a complete list of BL654 module hardware features.
80
81Connections and IOs
82===================
83
84LED
85---
86
87* LED1 (blue) = P0.16 (active low)
88
89Push button
90-----------
91
92* BUTTON1 (SW1) = P1.03 (active high)
93
94Sensor
95------
96
97The BL654 Sensor Board has an on-board Bosch BME280
98temperature/humidity/pressure sensor which is connected to the BL654 via I2C.
99
100* SCL = P0.27
101* SDA = P0.26
102
103More information about the Bosch BME280 sensor can be found on the
104`Bosch BME280 sensor website`_.
105
106Powering the sensor
107*******************
108
109The sensor can be powered directly from a coin cell or from a voltage supplied
110on the UART pins, the board accepts voltage from 1.8v-3.3v. Note that if using a
111battery with a UART/debugger connected, the voltage of the UART/debugger (if it
112does not automatically sense/adjust) must be within 0.3v of the voltage of the
113coin cell to prevent suppression diodes in the nRF52840 silicon being activated
114or possible back-powering of the battery.
115
116To power the board from an external source via UART, the solder bridge SB1 must
117be blobbed.
118
119Programming and Debugging
120*************************
121
122Applications for the ``bl654_sensor_board`` board configuration can be built,
123flashed, and debugged in the usual way. See :ref:`build_an_application` and
124:ref:`application_run` for more details on building and running. An external
125debugger/programmer is required which can be connected to using a Tag-Connect
126TC2030-CTX cable, a Ezurio USB-SWD Programmer board or Segger JLink
127programmer can be used to program and debug the BL654 sensor board.
128
129Flashing
130========
131
132If using an external JLink, follow the instructions in the :ref:`nordic_segger`
133page to install and configure all the necessary software. Further information
134can be found in :ref:`nordic_segger_flashing`. Then build and flash applications
135as usual (see :ref:`build_an_application` and :ref:`application_run` for more
136details). If using a Ezurio USB-SWD Programmer Board, see the
137`pyOCD website`_ to find details about the software and how to install it.
138
139Here is an example for the :zephyr:code-sample:`hello_world` application.
140
141First, run your favorite terminal program to listen for output - note that an
142external UART is required to be connected to the BL654 sensor board's UART, if
143using the Ezurio USB-SWD Programmer Board, the BL654 sensor board
144can be plugged in to the UART header. An FTDI cable can also be used - the
145voltage of the I/O lines and power line must be between 1.8v and 3.3v, do not
146connect an FTDI cable with a 5v power line to the BL654 sensor board.
147
148J3 UART connector pinout (all pins referenced to operating voltage Vdd):
149
150+---------+------+---------------------------------------------+-----------+
151| Pin No. | Name | Description                                 | Direction |
152+=========+======+=============================================+===========+
153| 1       | GND  | GND                                         | (N/A)     |
154+---------+------+---------------------------------------------+-----------+
155| 2       | RTS  | UART Ready-to-send pin                      | OUT       |
156+---------+------+---------------------------------------------+-----------+
157| 3       | VDD  | Supply voltage (requires SB1 to be blobbed) | (N/A)     |
158+---------+------+---------------------------------------------+-----------+
159| 4       | RXD  | UART Receive pin                            | IN        |
160+---------+------+---------------------------------------------+-----------+
161| 5       | TXD  | UART Transmit pin                           | (N/A)     |
162+---------+------+---------------------------------------------+-----------+
163| 6       | CTS  | UART Clear-to-send pin                      | IN        |
164+---------+------+---------------------------------------------+-----------+
165
166.. code-block:: console
167
168   $ minicom -D <tty_device> -b 115200
169
170Replace :code:`<tty_device>` with the port where the BL654 sensor board
171can be found. For example, under Linux, :code:`/dev/ttyACM0`.
172
173The BL654 sensor board needs an external programmer to program it, any SWD
174programmer which has a 9-pin ARM debug port can be used with a Tag-Connect
175TC2030-CTX cable. If using the Ezurio USB-SWD Programmer Board,
176connect the cable to P1 and ensure the board is set to supply power to the
177target at 3.3v.
178
179J1 Tag-Connect SWD Pinout:
180
181+---------+--------+-----------------------------------+-----------+
182| Pin No. | Name   | Description                       | Direction |
183+=========+========+===================================+===========+
184| 1       | VDD    | Operating voltage                 | (N/A)     |
185+---------+--------+-----------------------------------+-----------+
186| 2       | SWDIO  | Serial wire data input/output pin | IN/OUT    |
187+---------+--------+-----------------------------------+-----------+
188| 3       | nRESET | Module reset pin                  | IN        |
189+---------+--------+-----------------------------------+-----------+
190| 4       | SWCLK  | Serial wire clock input pin       | IN        |
191+---------+--------+-----------------------------------+-----------+
192| 5       | GND    | GND                               | (N/A)     |
193+---------+--------+-----------------------------------+-----------+
194| 6       | SWO    | Serial wire output pin            | OUT       |
195+---------+--------+-----------------------------------+-----------+
196
197Then build and flash the application in the usual way.
198
199.. zephyr-app-commands::
200   :zephyr-app: samples/hello_world
201   :board: bl654_sensor_board
202   :goals: build flash
203
204Debugging
205=========
206
207Refer to the :ref:`nordic_segger` page to learn about debugging Nordic based
208boards if using an external JLink debugger. If using a Ezurio
209USB-SWD Programmer Board, pyOCD can be used for debugging.
210
211Testing Bluetooth on the BL654 Sensor Board
212*******************************************
213Many of the Bluetooth examples will work on the BL654 Sensor Board.
214Try them out:
215
216* :zephyr:code-sample:`ble_peripheral`
217* :zephyr:code-sample:`bluetooth_eddystone`
218* :zephyr:code-sample:`bluetooth_ibeacon`
219
220
221Testing the LED and button on the BL654 Sensor Board
222****************************************************
223
224There are 2 samples that allow you to test that the button (switch) and LED on
225the board are working properly with Zephyr:
226
227* :zephyr:code-sample:`blinky`
228* :zephyr:code-sample:`button`
229
230You can build and flash the examples to make sure Zephyr is running correctly on
231your board. The button and LED definitions can be found in
232:zephyr_file:`boards/ezurio/bl654_sensor_board/bl654_sensor_board.dts`.
233
234
235References
236**********
237
238.. target-notes::
239
240.. _Bosch BME280 sensor website: https://www.bosch-sensortec.com/products/environmental-sensors/humidity-sensors-bme280/
241.. _BL654 website: https://ezurio.com/wireless-modules/bluetooth-modules/bluetooth-5-modules/bl654-series
242.. _pyOCD website: https://github.com/pyocd/pyOCD
243.. _USB-SWD Programmer website: https://www.ezurio.com/usb-swd-programmer
244