1.. _96b_neonkey:
2
396Boards Neonkey
4################
5
6Overview
7********
8
996Boards Neonkey board is based on the STMicroelectronics STM32F411CE
10Cortex M4 CPU.
11
12.. figure:: img/96b_neonkey.jpg
13     :align: center
14     :alt: 96Boards Neonkey
15
16     96Boards Neonkey
17
18This board acts as a sensor hub platform for all 96Boards compliant
19family products. It can also be used as a standalone board.
20
21Hardware
22********
23
2496Boards Neonkey provides the following hardware components:
25
26- STM32F411CE in UFQFPN48 package
27- ARM |reg| 32-bit Cortex |reg|-M4 CPU with FPU
28- 84 MHz max CPU frequency
29- 1.8V work voltage
30- 512 KB Flash
31- 128 KB SRAM
32- On board sensors:
33
34  - Temperature/Humidity: SI7034-A10
35  - Pressure: BMP280
36  - ALS/Proximity: RPR-0521RS
37  - Geomagnetic: BMM150
38  - Accelerometer/Gyroscope: BMI160
39  - AMR Hall sensor: MRMS501A
40  - Microphone: SPK0415HM4H-B
41
42- 4 User LEDs
43- 15 General purpose LEDs
44- GPIO with external interrupt capability
45- I2C (3)
46- SPI (1)
47- I2S (1)
48
49Supported Features
50==================
51
52The Zephyr 96b_neonkey board configuration supports the following hardware
53features:
54
55+-----------+------------+-------------------------------------+
56| Interface | Controller | Driver/Component                    |
57+===========+============+=====================================+
58| NVIC      | on-chip    | nested vector interrupt controller  |
59+-----------+------------+-------------------------------------+
60| SYSTICK   | on-chip    | system clock                        |
61+-----------+------------+-------------------------------------+
62| UART      | on-chip    | serial port                         |
63+-----------+------------+-------------------------------------+
64| GPIO      | on-chip    | gpio                                |
65+-----------+------------+-------------------------------------+
66| PINMUX    | on-chip    | pinmux                              |
67+-----------+------------+-------------------------------------+
68| FLASH     | on-chip    | flash                               |
69+-----------+------------+-------------------------------------+
70| SPI       | on-chip    | spi                                 |
71+-----------+------------+-------------------------------------+
72| I2C       | on-chip    | i2c                                 |
73+-----------+------------+-------------------------------------+
74
75More details about the board can be found at `96Boards website`_.
76
77The default board configuration can be found in
78:zephyr_file:`boards/96boards/neonkey/96b_neonkey_defconfig`
79
80Connections and IOs
81===================
82
83LED
84---
85
86- LED1 / User1 LED = PB12
87- LED2 / User2 LED = PB13
88- LED3 / User3 LED = PB14
89- LED4 / User4 LED = PB15
90
91Push buttons
92------------
93
94- BUTTON = RST (SW1)
95- BUTTON = USR (SW2)
96
97System Clock
98============
99
10096Boards Neonkey can be driven by an internal oscillator as well as the main
101PLL clock. By default System clock is sourced by PLL clock at 84MHz, driven
102by internal oscillator.
103
104Serial Port
105===========
106
107On 96Boards Neonkey Zephyr console output is assigned to USART1.
108Default settings are 115200 8N1.
109
110I2C
111---
112
11396Boards Neonkey board has up to 3 I2Cs. The default I2C mapping for Zephyr is:
114
115- I2C1_SCL : PB6
116- I2C1_SDA : PB7
117- I2C2_SCL : PB10
118- I2C2_SDA : PB3
119- I2C3_SCL : PA8
120- I2C3_SCL : PB4
121
122SPI
123---
124
12596Boards Neonkey board has one SPI. The default SPI mapping for Zephyr is:
126
127- SPI1_NSS  : PA4
128- SPI1_SCK  : PA5
129- SPI1_MISO : PA6
130- SPI1_MOSI : PA7
131
132Programming and Debugging
133*************************
134
135Building
136========
137
138Here is an example for building the :zephyr:code-sample:`hello_world` application.
139
140.. zephyr-app-commands::
141   :zephyr-app: samples/hello_world
142   :board: 96b_neonkey
143   :goals: build
144
145Flashing
146========
147
14896Boards Neonkey can be flashed by two methods, one using the ROM
149bootloader and another using the SWD debug port (which requires additional
150hardware).
151
152Using ROM bootloader:
153---------------------
154
155ROM bootloader can be triggered by the following pattern:
156
1571. Connect BOOT0 to VDD (link JTAG pins 1 and 5 on P4 header)
1582. Press and hold the USR button
1593. Press and release the RST button
160
161More detailed information on activating the ROM bootloader can be found in
162Chapter 29 of Application note `AN2606`_. The ROM bootloader supports flashing
163via UART, I2C and SPI protocols.
164
165For flashing, `stm32flash`_ command line utility can be used. The following
166command will flash the ``zephyr.bin`` binary to the Neonkey board using UART
167and starts its execution:
168
169.. code-block:: console
170
171   $ stm32flash -w zephyr.bin -v -g 0x08000000 /dev/ttyS0
172
173.. note::
174   The above command assumes that Neonkey board is connected to
175   serial port ``/dev/ttyS0``.
176
177Using SWD debugger:
178-------------------
179
180For flashing via SWD debug port, 0.1" male header must be soldered at P4
181header available at the bottom of the board, near RST button.
182
183Use the `Black Magic Debug Probe`_ as an SWD programmer, which can
184be connected to the P4 header using its flying leads and its 20 Pin
185JTAG Adapter Board Kit. When plugged into your host PC, the Black
186Magic Debug Probe enumerates as a USB serial device as documented on
187its `Getting started page`_.
188
189It also uses the GDB binary provided with the Zephyr SDK,
190``arm-zephyr-eabi-gdb``. Other GDB binaries, such as the GDB from GCC
191ARM Embedded, can be used as well.
192
193.. code-block:: console
194
195   $ arm-zephyr-eabi-gdb -q zephyr.elf
196   (gdb) target extended-remote /dev/ttyACM0
197   Remote debugging using /dev/ttyACM0
198   (gdb) monitor swdp_scan
199   Target voltage: 1.8V
200   Available Targets:
201   No. Att Driver
202    1      STM32F4xx
203   (gdb) attach 1
204   Attaching to Remote target
205   0x080005d0 in ?? ()
206   (gdb) load
207
208Debugging
209=========
210
211After flashing 96Boards Neonkey, it can be debugged using the same
212GDB instance. To reattach, just follow the same steps above, till
213"attach 1". You can then debug as usual with GDB. In particular, type
214"run" at the GDB prompt to restart the program you've flashed.
215
216References
217**********
218
219.. target-notes::
220
221.. _96Boards website:
222   https://www.96boards.org/product/neonkey/
223
224.. _AN2606:
225   https://www.st.com/resource/en/application_note/cd00167594.pdf
226
227.. _stm32flash:
228   https://sourceforge.net/p/stm32flash/wiki/Home/
229
230.. _Black Magic Debug Probe:
231   https://github.com/blacksphere/blackmagic/wiki
232
233.. _Getting started page:
234   https://github.com/blacksphere/blackmagic/wiki/Getting-Started
235