1.. zephyr:board:: bt610
2
3Overview
4********
5
6The Sentrius™ BT610 Sensor is a battery powered, Bluetooth v5 Long Range
7integrated sensor platform that uses a Nordic Semiconductor nRF52840 ARM
8Cortex-M4F CPU.
9
10The sensor 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* :abbr:`QSPI (Quad Serial Peripheral Interface)`
21* RADIO (Bluetooth Low Energy and 802.15.4)
22* :abbr:`RTC (nRF RTC System Clock)`
23* Segger RTT (RTT Console)
24* :abbr:`SPI (Serial Peripheral Interface)`
25* :abbr:`UART (Universal Asynchronous Receiver-Transmitter)`
26* :abbr:`WDT (Watchdog Timer)`
27
28.. figure:: img/bt610_back.jpg
29     :align: center
30     :alt: Sentrius BT610 Sensor, rear view
31
32     Sentrius BT610 Sensor, rear view
33
34More information about the board can be found at the
35`Sentrius BT610 website`_.
36
37Hardware
38********
39
40Supported Features
41==================
42
43.. zephyr:board-supported-hw::
44
45.. figure:: img/bt610_board.jpg
46     :align: center
47     :alt: Sentrius BT610 Sensor, board layout
48
49     Sentrius BT610 Sensor, board layout
50
51Connections and IOs
52===================
53
54LED
55---
56
57Two LEDs are visible through the BT610 housing lid. Note that the LEDs can be
58driven either directly, or via PWM. PWM should be used when current consumption
59is required to be minimised.
60
61* LED_1 (red) = LED0 = P1.07 (Red LED 1)
62* LED_2 (green) = LED1 = P1.03 (Green LED 2)
63
64* LED_PWM_1 (red) = LED0PWM = P1.07 (Red PWM LED 1)
65* LED_PWM_2 (green) = LED1PWM = P1.03 (Green PWM LED 2)
66
67Push button
68------------
69
70The BT610 incorporates three mechanical push buttons. Note these are only
71accessible with the housing cover removed.
72
73Two of the buttons are available for use via the board DTS file, as follows.
74
75* BUTTON_1 = SW0 = P0.24 (Boot button SW1)
76* BUTTON_2 = SW1 = P1.01 (Tamper switch SW2)
77
78A third mechanical push button is provided to allow reset of the on-board
79microcontroller.
80
81Magnetoresistive sensor
82-----------------------
83
84The BT610 incorporates a Honeywell SM351LT magnetoresistive sensor. Refer to
85the `Honeywell SM351LT datasheet`_ for further details.
86
87* MAG_1 = SW2 = P1.15 (SM3531LT_0)
88
89External flash memory
90---------------------
91
92A 64Mbit external flash memory part is available for storage of application
93images and data. Refer to the `Macronix MX25R6435FZNIL0 datasheet`_ for further
94details.
95
96The flash memory is connected to the on-board QSPI device controller.
97
98* MX25R64 = QSPI
99
100Voltage reference
101-----------------
102
103A precision 2.5V voltage reference is provided on the V_REF input for use
104during AD measurements.
105
106This can deliver up to 50mA peak and 20mA continuous current.
107
108
109Sensor connectivity
110-------------------
111
112The BT610 incorporates three terminal blocks J5, J6 & J7 that allow
113connectivity to its sensor inputs, as follows.
114
115Terminal Block J5
116-----------------
117
118+-----------+------------------------+----------------------------+-----------+
119| Pin No.   | Name                   | Description                | Direction |
120+===========+========================+============================+===========+
121| 1         | EXT_SPI_CS_2           | External SPI CS 2          | OUT       |
122+-----------+------------------------+----------------------------+-----------+
123| 2         | GND                    | GND                        | (N/A)     |
124+-----------+------------------------+----------------------------+-----------+
125| 3         | AIN4                   | Analog Input 4             | IN        |
126+-----------+------------------------+----------------------------+-----------+
127| 4         | AIN3                   | Analog Input 3             | IN        |
128+-----------+------------------------+----------------------------+-----------+
129| 5         | GND                    | GND                        | (N/A)     |
130+-----------+------------------------+----------------------------+-----------+
131| 6         | AIN2                   | Analog Input 2             | IN        |
132+-----------+------------------------+----------------------------+-----------+
133| 7         | AIN1                   | Analog Input 1             | IN        |
134+-----------+------------------------+----------------------------+-----------+
135| 8         | GND                    | GND                        | (N/A)     |
136+-----------+------------------------+----------------------------+-----------+
137| 9         | DIN2                   | Digital Input 2            | IN        |
138+-----------+------------------------+----------------------------+-----------+
139| 10        | DO2                    | Digital Output 2           | OUT       |
140+-----------+------------------------+----------------------------+-----------+
141
142Terminal Block J6
143-----------------
144
145+-----------+------------------------+----------------------------+-----------+
146| Pin No.   | Name                   | Description                | Direction |
147+===========+========================+============================+===========+
148| 1         | DO1                    | Digital Output 1           | OUT       |
149+-----------+------------------------+----------------------------+-----------+
150| 2         | DIN1                   | Digital Input 1            | IN        |
151+-----------+------------------------+----------------------------+-----------+
152| 3         | GND                    | GND                        | (N/A)     |
153+-----------+------------------------+----------------------------+-----------+
154| 4         | THERM4                 | Thermistor Input 4         | IN        |
155+-----------+------------------------+----------------------------+-----------+
156| 5         | THERM3                 | Thermistor Input 3         | IN        |
157+-----------+------------------------+----------------------------+-----------+
158| 6         | GND                    | GND                        | (N/A)     |
159+-----------+------------------------+----------------------------+-----------+
160| 7         | THERM2                 | Thermistor Input 2         | IN        |
161+-----------+------------------------+----------------------------+-----------+
162| 8         | THERM1                 | Thermistor Input 1         | IN        |
163+-----------+------------------------+----------------------------+-----------+
164| 9         | GND                    | GND                        | (N/A)     |
165+-----------+------------------------+----------------------------+-----------+
166| 10        | B+ OUT                 | Ext. sensor power supply   | (N/A)     |
167+-----------+------------------------+----------------------------+-----------+
168
169Terminal Block J7
170-----------------
171
172+-----------+------------------------+----------------------------+-----------+
173| Pin No.   | Name                   | Description                | Direction |
174+===========+========================+============================+===========+
175| 1         | UART_1_RTS             | UART 1 RTS                 | IN        |
176+-----------+------------------------+----------------------------+-----------+
177| 2         | UART_1_CTS             | UART 1 CTS                 | OUT       |
178+-----------+------------------------+----------------------------+-----------+
179| 3         | UART_1_RXD             | UART 1 RXD                 | IN        |
180+-----------+------------------------+----------------------------+-----------+
181| 4         | UART_1_TXD             | UART 1 TXD                 | OUT       |
182+-----------+------------------------+----------------------------+-----------+
183| 5         | EXT_I2C_SCL            | External I2C SCL           | OUT       |
184+-----------+------------------------+----------------------------+-----------+
185| 6         | EXT_I2C_SDA            | External I2C SDA           | IN/OUT    |
186+-----------+------------------------+----------------------------+-----------+
187| 7         | EXT_SPI_CLK/TRACEDATA3 | Ext. SPI CLK/TRACE DATA 3  | OUT       |
188+-----------+------------------------+----------------------------+-----------+
189| 8         | EXT_SPI_MISO           | External SPI MISO          | IN        |
190+-----------+------------------------+----------------------------+-----------+
191| 9         | EXT_SPI_MOSI           | External SPI MOSI          | OUT       |
192+-----------+------------------------+----------------------------+-----------+
193| 10        | EXT_SPI_CS_1           | External SPI CS 1          | OUT       |
194+-----------+------------------------+----------------------------+-----------+
195
196Analog inputs
197-------------
198
199The four external Analog Inputs are multiplexed to a single host
200microcontroller AD input, AIN_1, via a TI TMUX1204 multiplexer.
201
202Refer to the `TI TMUX1204 datasheet`_ for further details.
203
204Signals up to 12V, to a maximum of 50mA, can be applied to the external Analog
205Inputs.
206
207External Analog Input connections are made to the multiplexer as follows.
208
209+--------------+--------------+
210| Input        | MUX Input    |
211+==============+==============+
212| AIN1         | S1           |
213+--------------+--------------+
214| AIN2         | S2           |
215+--------------+--------------+
216| AIN3         | S3           |
217+--------------+--------------+
218| AIN4         | S4           |
219+--------------+--------------+
220
221A TI TCA9538 port expander is used to determine the mode of each Analog Input,
222for either voltage or current measurement, and also to control the mutliplexer.
223A high level applied to the appropriate expander port pin enables the
224associated analog input as a current input; when a low logic level is applied,
225voltage measurement mode is selected.
226
227Refer to the `TI TCA9538 datasheet`_ for further details.
228
229The expander port connections are as follows.
230
231+--------------+---------------+
232| Pin          | Function      |
233+==============+===============+
234| P0           | AIN1 mode     |
235+--------------+---------------+
236| P1           | AIN2 mode     |
237+--------------+---------------+
238| P2           | AIN3 mode     |
239+--------------+---------------+
240| P3           | AIN4 mode     |
241+--------------+---------------+
242| P4           | MUX A0        |
243+--------------+---------------+
244| P5           | MUX A1        |
245+--------------+---------------+
246| P6           | (N/C)         |
247+--------------+---------------+
248| P7           | (N/C)         |
249+--------------+---------------+
250
251The following illustrates some possible configuration values for the port
252expander. Note that it is possible for combinations of voltage and current
253measurement to be applied such that some external Analog Inputs measure current
254and others voltage. This is not shown below.
255
256+----------------+------------------------------+
257| Expander value | Selected Analog Input & mode |
258+================+==============================+
259| b'00000000'    | AIN1, voltage measurement    |
260+----------------+------------------------------+
261| b'00000001'    | AIN1, current measurement    |
262+----------------+------------------------------+
263| b'00010000'    | AIN2, voltage measurement    |
264+----------------+------------------------------+
265| b'00010010'    | AIN2, current measurement    |
266+----------------+------------------------------+
267| b'00100000'    | AIN3, voltage measurement    |
268+----------------+------------------------------+
269| b'00100100'    | AIN3, current measurement    |
270+----------------+------------------------------+
271| b'00110000'    | AIN4, voltage measurement    |
272+----------------+------------------------------+
273| b'00111000'    | AIN4, current measurement    |
274+----------------+------------------------------+
275
276Circuitry associated with the analog input measurements can be disabled when
277not in use.
278
279A GPIO is used to control this behaviour, as shown below.
280
281+----------------+-----------+
282| ANALOG_ENABLE  | Behaviour |
283+================+===========+
284| 0              | Disabled  |
285+----------------+-----------+
286| 1              | Enabled   |
287+----------------+-----------+
288
289Thermistor inputs
290-----------------
291
292The four external thermistor inputs are connected to a single AD input, AIN_2,
293via a TI TMUX1204 multiplexer.
294
295Refer to the `TI TMUX1204 datasheet`_ for further details.
296
297External analog input connections are made to the multiplexer as follows.
298
299+--------------+--------------+
300| Input        | MUX Input    |
301+==============+==============+
302| THERM1       | S1           |
303+--------------+--------------+
304| THERM2       | S2           |
305+--------------+--------------+
306| THERM3       | S3           |
307+--------------+--------------+
308| THERM4       | S4           |
309+--------------+--------------+
310
311The same port expander used to select external analog inputs is also used to
312select external thermistor inputs.
313
314The table below defines possible values that can be written.
315
316+----------------+-----------------------+
317| Expander value | Selected Analog Input |
318+================+=======================+
319| b'00000000'    | THERM1                |
320+----------------+-----------------------+
321| b'00010000'    | THERM2                |
322+----------------+-----------------------+
323| b'00100000'    | THERM3                |
324+----------------+-----------------------+
325| b'00110000'    | THERM4                |
326+----------------+-----------------------+
327
328A GPIO line is used to enable electronics associated with thermistor
329measurement. This is controlled as shown below.
330
331+----------------+-----------------------+
332| THERM_ENABLE   | Behaviour             |
333+================+=======================+
334| 0              | Enabled               |
335+----------------+-----------------------+
336| 1              | Disabled              |
337+----------------+-----------------------+
338
339Note the thermistor circuit must be calibrated before use. A suggested method
340for achieving this is described in the
341`BT610 Zephyr Application Thermistor Calibration`_ application note.
342
343Digital inputs
344--------------
345
346Two external digital inputs are available for connection to external signals.
347For the digital level being applied to be detected, an appropriate output pin
348must first be set. This approach is taken to ensure supporting circuitry can be
349powered down when the input state is not being determined. When in use, the
350external digital input level can be read from the appropriate input pin.
351
352The output and input pins required are as follows.
353
354+----------------+----------------+
355| Enable Pin     | Input Read Pin |
356+================+================+
357| DIN_1_ENABLE   | DIN_1          |
358+----------------+----------------+
359| DIN_2_ENABLE   | DIN_2          |
360+----------------+----------------+
361
362Digital outputs
363---------------
364
365Two external digital outputs are available to provide signals to or to directly
366drive external equipment.
367
368To provide a high level on the external digital output, a high logic level is
369applied to the appropriate host microcontroller output.
370
371The output pins required are as follows.
372
373+----------------+--------------------------+
374| Output Pin     | External Sensor Terminal |
375+================+==========================+
376| DO_1_MCU       | DO1                      |
377+----------------+--------------------------+
378| DO_2_MCU       | DO2                      |
379+----------------+--------------------------+
380
381External power supply
382---------------------
383
384Power can be supplied to external sensors via the B+ OUT terminal. This is
385enabled by setting the BATTERY_OUTPUT_ENABLE GPIO line. In addition, the
386external supply can be boosted to 5V by setting the HIGH_SUPPLY_ENABLE GPIO
387line. When 5V is not selected, the external power supply follows the
388battery voltage.
389
390Up to 50mA peak and 20mA continuous current can be delivered by the External
391Power Supply.
392
393External sensor I2C port
394------------------------
395
396External I2C sensors can be connected on the external I2C port. Note that
397external I2C sensors should be powered from the B+ terminal to ensure applied
398voltage levels match those expected internally by the board.
399
400Required pins are as follows.
401
402+-------------+--------------------------+
403| Output Pin  | External Sensor Terminal |
404+=============+==========================+
405| SCL_PIN     | EXT_I2C_SCL              |
406+-------------+--------------------------+
407| SDA_PIN     | EXT_I2C_SDA              |
408+-------------+--------------------------+
409
410
411External sensor SPI port
412------------------------
413
414Up to 2 external SPI sensors can be connected on the external SPI port. Note
415that external SPI sensors should be powered from the B+ terminal to ensure
416applied voltage levels match those expected internally by the board.
417
418Required pins are as follows.
419
420+-------------+--------------------------+
421| Output Pin  | External Sensor Terminal |
422+=============+==========================+
423| SCK_PIN     | EXT_I2C_SCL              |
424+-------------+--------------------------+
425| MOSI_PIN    | EXT_I2C_SDA              |
426+-------------+--------------------------+
427| MISO_PIN    | EXT_SPI_MISO             |
428+-------------+--------------------------+
429| SDA_PIN     | EXT_I2C_SDA              |
430+-------------+--------------------------+
431| CS_GPIOS    | EXT_I2C_SDA              |
432+-------------+--------------------------+
433| CS_GPIOS    | EXT_I2C_SDA              |
434+-------------+--------------------------+
435
436
437Programming and Debugging
438*************************
439
440Applications for the ``bt610`` board configuration can be
441built and flashed in the usual way (see :ref:`build_an_application`
442and :ref:`application_run` for more details); however, the standard
443debugging targets are not currently available.
444
445The BT610 features a 10 way header, J3, for connection of a
446programmer/debugger, with pinout as follows.
447
448+-----------+------------+----------------------+
449| Pin No.   | Name       | Description          |
450+===========+============+======================+
451| 1         | 3.3V       | Power Supply, 3.3V   |
452+-----------+------------+----------------------+
453| 2         | SWDIO      | Data Input/Output    |
454+-----------+------------+----------------------+
455| 3         | GND        | GND                  |
456+-----------+------------+----------------------+
457| 4         | SWDCLK     | Clock Pin            |
458+-----------+------------+----------------------+
459| 5         | GND        | GND                  |
460+-----------+------------+----------------------+
461| 6         | SWO        | Trace Output Pin     |
462+-----------+------------+----------------------+
463| 7         | (N/C)      | Not Connected        |
464+-----------+------------+----------------------+
465| 8         | (N/C)      | Not Connected        |
466+-----------+------------+----------------------+
467| 9         | GND        | GND                  |
468+-----------+------------+----------------------+
469| 10        | nRESET     | Reset Pin            |
470+-----------+------------+----------------------+
471
472Access to the sensor debug UART is facilitated by a 6 pin header, J1, with
473pinout as follows.
474
475+-----------+------------+----------------------+-----------+
476| Pin No.   | Name       | Description          | Direction |
477+===========+============+======================+===========+
478| 1         | GND        | GND                  | N/A       |
479+-----------+------------+----------------------+-----------+
480| 2         | UART_0_RTS | UART 0 RTS Pin       | IN        |
481+-----------+------------+----------------------+-----------+
482| 3         | 3.3V       | Power Supply, 3.3V   | N/A       |
483+-----------+------------+----------------------+-----------+
484| 4         | UART_0_RX  | UART 0 RX Pin        | IN        |
485+-----------+------------+----------------------+-----------+
486| 5         | UART_0_TX  | UART 0 TX Pin        | OUT       |
487+-----------+------------+----------------------+-----------+
488| 6         | UART_0_CTS | UART 0 CTS Pin       | OUT       |
489+-----------+------------+----------------------+-----------+
490
491Note that pin 3 requires a solder bridge to be closed to enable powering of the
492BT610 board via the UART connector.
493
494Flashing
495========
496
497Follow the instructions in the :ref:`nordic_segger` page to install
498and configure all the necessary software. Further information can be
499found in :ref:`nordic_segger_flashing`. Then build and flash
500applications as usual (see :ref:`build_an_application` and
501:ref:`application_run` for more details).
502
503Here is an example for the :zephyr:code-sample:`hello_world` application.
504
505First, run your favorite terminal program to listen for output.
506
507NOTE: On the BT610, the UART lines are at TTL levels and must be passed through
508an appropriate line driver circuit for translation to RS232 levels. Refer to
509the `MAX3232 datasheet`_ for a suitable driver IC.
510
511.. code-block:: console
512
513   $ minicom -D <tty_device> -b 115200
514
515Replace :code:`<tty_device>` with the port where the BT610 can be found. For
516example, under Linux, :code:`/dev/ttyUSB0`.
517
518Then build and flash the application in the usual way.
519
520.. zephyr-app-commands::
521   :zephyr-app: samples/hello_world
522   :board: bt610
523   :goals: build flash
524
525Note that an external debugger is required to perform application flashing.
526
527Debugging
528=========
529
530The ``bt610`` board does not have an on-board J-Link debug IC
531as some nRF5x development boards, however, instructions from the
532:ref:`nordic_segger` page also apply to this board, with the additional step
533of connecting an external debugger.
534
535Testing Bluetooth on the BT610
536***********************************
537Many of the Bluetooth examples will work on the BT610.
538Try them out:
539
540* :zephyr:code-sample:`ble_peripheral`
541* :zephyr:code-sample:`bluetooth_eddystone`
542* :zephyr:code-sample:`bluetooth_ibeacon`
543
544
545Testing the LEDs and buttons on the BT610
546*****************************************
547
548There are 2 samples that allow you to test that the buttons (switches) and LEDs
549on the board are working properly with Zephyr:
550
551* :zephyr:code-sample:`blinky`
552* :zephyr:code-sample:`button`
553
554You can build and flash the examples to make sure Zephyr is running correctly
555on your board. The button, LED and sensor device definitions can be found in
556:zephyr_file:`boards/ezurio/bt610/bt610.dts`.
557
558
559References
560**********
561
562.. target-notes::
563
564.. _Sentrius BT610 website: https://www.ezurio.com/iot-devices/iot-sensors/sentrius-bt610-io-sensor
565.. _Honeywell SM351LT datasheet: https://sensing.honeywell.com/honeywell-sensing-nanopower-series-datasheet-50095501-c-en.pdf
566.. _MAX3232 datasheet: https://www.ti.com/lit/ds/symlink/max3232.pdf
567.. _TI TMUX1204 datasheet: https://www.ti.com/lit/gpn/TMUX1204
568.. _TI TCA9538 datasheet: https://www.ti.com/lit/gpn/TCA9538
569.. _Macronix MX25R6435FZNIL0 datasheet: https://www.macronix.com/Lists/Datasheet/Attachments/7913/MX25R6435F,%20Wide%20Range,%2064Mb,%20v1.5.pdf
570.. _BT610 Zephyr Application Thermistor Calibration: https://www.ezurio.com/technology/bt610-thermistor-coefficient-calculator
571