1.. _96b_wistrio:
2
396Boards WisTrio
4#################
5
6Overview
7********
8
996Boards WisTrio LoRa Tracker board is based on the RAK Wireless RAK5205
10chipset integrating SX1276 LoRaWAN Modem, STM32L151CB-A MCU and GPS module.
11Zephyr applications use the 96b_wistrio configuration to run on these
12boards.
13
14.. figure:: img/96b-wistrio.jpg
15     :align: center
16     :alt: 96Boards WisTrio
17
18     96Boards WisTrio
19
20This board is one of the `96Boards IoT Edition`_ platforms providing LoRa
21connectivity.
22
23Hardware
24********
25
2696Boards WisTrio provides the following hardware components:
27
28- RAK5205 Chipset
29- 3.3V work voltage
30- 128 KB Flash
31- 16 KB SRAM
32- On board sensors:
33
34  - Accelerometer: STMicro LIS3DH
35  - Integrated Environmental sensor: Bosch BME680
36
37- 2 User LEDs
38- GPIO with external interrupt capability
39- UART (2)
40- I2C (1)
41- GPS Module
42- GPS Antenna
43- LoRa Antenna
44
45Supported Features
46==================
47
48The Zephyr 96b_wistrio board configuration supports the following hardware
49features:
50
51+-----------+------------+-------------------------------------+
52| Interface | Controller | Driver/Component                    |
53+===========+============+=====================================+
54| NVIC      | on-chip    | nested vector interrupt controller  |
55+-----------+------------+-------------------------------------+
56| SYSTICK   | on-chip    | system clock                        |
57+-----------+------------+-------------------------------------+
58| UART      | on-chip    | serial port                         |
59+-----------+------------+-------------------------------------+
60| GPIO      | on-chip    | gpio                                |
61+-----------+------------+-------------------------------------+
62| PINMUX    | on-chip    | pinmux                              |
63+-----------+------------+-------------------------------------+
64| I2C       | on-chip    | i2c                                 |
65+-----------+------------+-------------------------------------+
66| SPI       | on-chip    | spi                                 |
67+-----------+------------+-------------------------------------+
68| RTC       | on-chip    | rtc                                 |
69+-----------+------------+-------------------------------------+
70| EEPROM    | on-chip    | eeprom                              |
71+-----------+------------+-------------------------------------+
72
73The default board configuration can be found in
74:zephyr_file:`boards/96boards/wistrio/96b_wistrio_defconfig`
75
76Connections and IOs
77===================
78
79LED
80---
81
82- LED1 / User1 LED = PA12
83- LED2 / User2 LED = PB4
84
85Push buttons
86------------
87
88- BUTTON = RST (BT1)
89
90Serial Port
91===========
92
9396Boards WisTrio board has 2 UARTs. Zephyr console output is assigned
94to USART1 with 115200 8N1 as the default setting and USART3 is used for
95GPS module.
96
97I2C
98---
99
10096Boards WisTrio board has 1 I2C connected to on-board sensors.
101The default I2C mapping is:
102
103- I2C1_SCL  : PB8
104- I2C1_SDA  : PB9
105
106I2C1 also goes to the J22 connector and can be used to attach external
107sensors.
108
109SPI
110---
111
11296Boards WisTrio board has 1 SPI connected to on-chip LoRa Radio.
113The default SPI mapping is:
114
115- SPI1_SCLK  : PA5
116- SPI1_MISO  : PA6
117- SPI1_MOSI  : PA7
118- SPI1_NSS   : PB0
119
120Programming and Debugging
121*************************
122
123Flashing
124========
125
12696Boards WisTrio can be flashed by two methods, one using the ROM
127bootloader and another using the SWD debug port (which requires additional
128hardware).
129
130Flashing using the ROM bootloader requires a special activation pattern,
131which can be triggered by using the BOOT0 pin. The ROM bootloader supports
132flashing via UART, and I2C but this document describes the UART case only.
133You can read more about how to enable and use the ROM bootloader by
134checking the application note `AN2606`_ .
135
136Using ROM bootloader:
137---------------------
138
1391. Connect 96Boards WisTrio to your Linux PC using, USB-Micro to USB-A
140   cable.
141
1422. ROM bootloader can be triggered by the following pattern:
143
144   - Connect BOOT0 to VDD (link pin 1 and 2 on J12)
145   - Press and release the RST button
146
147More detailed information on activating the ROM bootloader can be found in
148Chapter 29 of Application note `AN2606`_. The ROM bootloader supports flashing
149via UART, and I2C protocols.
150
151Here is an example for building and flashing the :zephyr:code-sample:`hello_world` application using `stm32flash`_ command line utility:
152
153.. zephyr-app-commands::
154   :zephyr-app: samples/hello_world
155   :board: 96b_wistrio
156   :goals: build flash
157
158Using SWD debugger:
159-------------------
160
161Use the `Black Magic Debug Probe`_ as an SWD programmer, which can
162be connected to the SWD pins exposed on the J22 header using its flying
163leads and its 20 Pin JTAG Adapter Board Kit. When plugged into your host
164PC, the Black Magic Debug Probe enumerates as a USB serial device as
165documented on its `Getting started page`_.
166
167It also uses the GDB binary provided with the Zephyr SDK,
168``arm-zephyr-eabi-gdb``. Other GDB binaries, such as the GDB from GCC
169ARM Embedded, can be used as well.
170
171.. code-block:: console
172
173   $ arm-zephyr-eabi-gdb -q zephyr.elf
174   (gdb) target extended-remote /dev/ttyACM0
175   Remote debugging using /dev/ttyACM0
176   (gdb) monitor swdp_scan
177   Target voltage: 3.3V
178   Available Targets:
179   No. Att Driver
180
181Debugging
182=========
183
184After flashing 96Boards WisTrio, it can be debugged using the same
185GDB instance. To reattach, just follow the same steps above, till
186"attach 1". You can then debug as usual with GDB. In particular, type
187"run" at the GDB prompt to restart the program you've flashed.
188
189References
190**********
191
192.. target-notes::
193
194.. _AN2606:
195   https://www.st.com/resource/en/application_note/cd00167594.pdf
196
197.. _stm32flash:
198   https://sourceforge.net/p/stm32flash/wiki/Home/
199
200.. _Black Magic Debug Probe:
201   https://github.com/blacksphere/blackmagic/wiki
202
203.. _Getting started page:
204   https://github.com/blacksphere/blackmagic/wiki/Getting-Started
205
206.. _96Boards IoT Edition:
207    https://linaro.co/ie-specification
208