1.. _96b_argonkey:
2
396Boards Argonkey
4#################
5
6Overview
7********
8
996Boards Argonkey board is based on the ST Microelectronics STM32F412CG
10Cortex M4 CPU.
11
12This board acts as a sensor hub platform for all 96Boards compliant
13family products. It can also be used as a standalone board.
14
15.. figure:: img/96b_argonkey.jpg
16     :align: center
17     :alt: 96Boards Argonkey
18
19     96Boards Argonkey
20
21Hardware
22********
23
2496Boards Argonkey provides the following hardware components:
25
26- STM32F412CG in UFQFPN48 package
27- ARM |reg| 32-bit Cortex |reg|-M4 CPU with FPU
28- 100 MHz max CPU frequency
29- 1.8V work voltage
30- 1024 KB Flash
31- 256 KB SRAM
32- On board sensors:
33
34  - Humidity: STMicro HTS221
35  - Temperature/Pressure: STMicro LPS22HB
36  - ALS: Intersil ISL29034
37  - Proximity: STMicro VL53L0X
38  - Accelerometer/Gyroscope: STMicro LSM6DSL
39  - Geomagnetic: STMicro LIS2MDL
40  - AMR Hall sensor: MRMS501A
41  - Microphone: STMicro MP34DT05
42
43- 2 User LEDs
44- 16 General purpose LEDs
45- GPIO with external interrupt capability
46- UART
47- I2C (3)
48- SPI (1)
49- I2S (1)
50
51Supported Features
52==================
53
54The Zephyr 96b_argonkey board configuration supports the following hardware
55features:
56
57+-----------+------------+-------------------------------------+
58| Interface | Controller | Driver/Component                    |
59+===========+============+=====================================+
60| NVIC      | on-chip    | nested vector interrupt controller  |
61+-----------+------------+-------------------------------------+
62| SYSTICK   | on-chip    | system clock                        |
63+-----------+------------+-------------------------------------+
64| UART      | on-chip    | serial port                         |
65+-----------+------------+-------------------------------------+
66| GPIO      | on-chip    | gpio                                |
67+-----------+------------+-------------------------------------+
68| PINMUX    | on-chip    | pinmux                              |
69+-----------+------------+-------------------------------------+
70| FLASH     | on-chip    | flash                               |
71+-----------+------------+-------------------------------------+
72| SPI       | on-chip    | spi                                 |
73+-----------+------------+-------------------------------------+
74| I2C       | on-chip    | i2c                                 |
75+-----------+------------+-------------------------------------+
76
77More information about the board can be found at the
78`ARGONKEY website`_.
79
80The default board configuration can be found in the defconfig file:
81
82        ``boards/arm/96b_argonkey/96b_argonkey_defconfig``
83
84Connections and IOs
85===================
86
87LED
88---
89
90- LED1 / User1 LED = PB2
91- LED2 / User2 LED = PC13
92
93Push buttons
94------------
95
96- BUTTON = RST (BT1)
97- BUTTON = USR (BT2)
98
99System Clock
100============
101
10296Boards Argonkey can be driven by an internal oscillator as well as the main
103PLL clock. In default board configuration, the 16MHz external oscillator is
104used to drive the main PLL clock to generate a System Clock (SYSCLK) at 84MHz.
105On the bus side, AHB clock runs at 84MHz, while APB1/APB2 clock runs at 42MHz.
106
107Serial Port
108===========
109
110On 96Boards Argonkey, Zephyr console output is assigned to USART1.
111Default settings are 115200 8N1.
112
113I2C
114---
115
11696Boards Argonkey board has up to 3 I2Cs. The default I2C mapping is:
117
118- I2C1_SCL  : PB6
119- I2C1_SDA  : PB7
120- I2C2_SCL  : PB10
121- I2C2_SDA  : PB9
122- I2C3_SCL  : PA8
123- I2C3_SCL  : PB4
124
125I2C3 goes to the P2 connector and can be used to attach external sensors.
126It goes to 100Kbit maximum.
127
128SPI
129---
13096Boards Argonkey board has 2 SPIs. SPI1 is used in slave mode as the communication
131bus with the AP. SPI2 is used in master mode to control the LSM6DSL sensor.
132The default SPI mapping is:
133
134- SPI1_NSS  : PA4
135- SPI1_SCK  : PA5
136- SPI1_MISO : PA6
137- SPI1_MOSI : PA7
138- SPI2_NSS  : PB12
139- SPI2_SCK  : PB13
140- SPI2_MISO : PB14
141- SPI2_MOSI : PB15
142
143Programming and Debugging
144*************************
145
146Building
147========
148
149Here is an example for building the :ref:`hello_world` application.
150
151.. zephyr-app-commands::
152   :zephyr-app: samples/hello_world
153   :board: 96b_argonkey
154   :goals: build
155
156Flashing
157========
158
15996Boards Argonkey can be flashed by two methods, one using the ROM
160bootloader and another using the SWD debug port (which requires additional
161hardware).
162
163Flashing using the ROM bootloader requires a special activation pattern,
164which can be triggered by using the BOOT0 pin. The ROM bootloader supports
165flashing via USB (DFU), UART, I2C and SPI, but this document describes the
166UART case only. You can read more about how to enable and use the ROM
167bootloader by checking the application note `AN2606`_ .
168
169Using ROM bootloader:
170---------------------
171
172Hereafter the documents describes basic steps to perform ArgonKey firmware
173flashing on a Linux PC using UART as communication channel.
174
1751. Connect ArgonKey UART to your Linux PC using, for example, a USB-TTL serial
176   cable. The flashing procedure has been tested using a `TTL-232RG`_ cable with
177   FTDI chip. The UART pins on ArgonKey can be found on the P3 low speed
178   expansion connector on the back of the board.
179
180   - GND (black)  to ArgonKey GND (P3.1)
181   - TXD (orange) to ArgonKey UART0_TXD (P3.5)
182   - RXD (yellow) to ArgonKey UART0_RXD (P3.7)
183
184   When the USB cable is inserted to the Linux PC the following device will be
185   created: /dev/ttyUSBx (x is usually '0').
186
1872. Force STM32F412CG to enter in Bootloader mode
188
189   - Connect BOOT0 to 1V8 (link P2.1 to P3.30)
190   - Press and release the RST button
191
1923. Use stm32flash utility to flash the ArgonKey:
193
194.. code-block:: console
195
196    $ stm32flash  -w zephyr.bin -v -g 0x08000000 /dev/ttyUSB0
197
198See References section for more info on `stm32flash`_.
199
200Using SWD debugger:
201-------------------
202
203Select a commercial JTAG/SWD h/w tool and connect it to ArgonKey P4 connector.
204
205The ArgonKey has been tested using the `ST-LINK/V2`_ tool. Once that the tool
206is connected to the PC through USB, it presents itself as a USB composite
207device with mass storage capability. The device can be then mounted in linux
208and the f/w can be actually copied there and will be automatically flashed by
209the ST-LINK onto the ArgonKey.
210
211Example:
212
213.. code-block:: console
214
215   $ mount /dev/sdb /mnt
216   $ cp zephyr.bin /mnt
217   $ umount /mnt
218
219Debugging
220=========
221
222References
223**********
224
225.. target-notes::
226
227.. _ARGONKEY website:
228   https://www.st.com/en/evaluation-tools/steval-mki187v1.html
229
230.. _AN2606:
231   https://www.st.com/resource/en/application_note/cd00167594.pdf
232
233.. _stm32flash:
234   https://sourceforge.net/p/stm32flash/wiki/Home/
235
236.. _ST-LINK/V2:
237   https://www.st.com/en/development-tools/st-link-v2.html
238
239.. _TTL-232RG:
240   http://www.ftdichip.com/Support/Documents/DataSheets/Cables/DS_TTL-232RG_CABLES.pdf
241