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
81:zephyr_file:`boards/96boards/argonkey/96b_argonkey_defconfig`
82
83Connections and IOs
84===================
85
86LED
87---
88
89- LED1 / User1 LED = PB2
90- LED2 / User2 LED = PC13
91
92Push buttons
93------------
94
95- BUTTON = RST (BT1)
96- BUTTON = USR (BT2)
97
98System Clock
99============
100
10196Boards Argonkey can be driven by an internal oscillator as well as the main
102PLL clock. In default board configuration, the 16MHz external oscillator is
103used to drive the main PLL clock to generate a System Clock (SYSCLK) at 84MHz.
104On the bus side, AHB clock runs at 84MHz, while APB1/APB2 clock runs at 42MHz.
105
106Serial Port
107===========
108
109On 96Boards Argonkey, Zephyr console output is assigned to USART1.
110Default settings are 115200 8N1.
111
112I2C
113---
114
11596Boards Argonkey board has up to 3 I2Cs. The default I2C mapping is:
116
117- I2C1_SCL  : PB6
118- I2C1_SDA  : PB7
119- I2C2_SCL  : PB10
120- I2C2_SDA  : PB9
121- I2C3_SCL  : PA8
122- I2C3_SCL  : PB4
123
124I2C3 goes to the P2 connector and can be used to attach external sensors.
125It goes to 100Kbit maximum.
126
127SPI
128---
12996Boards Argonkey board has 2 SPIs. SPI1 is used in slave mode as the communication
130bus with the AP. SPI2 is used in master mode to control the LSM6DSL sensor.
131The default SPI mapping is:
132
133- SPI1_NSS  : PA4
134- SPI1_SCK  : PA5
135- SPI1_MISO : PA6
136- SPI1_MOSI : PA7
137- SPI2_NSS  : PB12
138- SPI2_SCK  : PB13
139- SPI2_MISO : PB14
140- SPI2_MOSI : PB15
141
142Programming and Debugging
143*************************
144
145Building
146========
147
148Here is an example for building the :zephyr:code-sample:`hello_world` application.
149
150.. zephyr-app-commands::
151   :zephyr-app: samples/hello_world
152   :board: 96b_argonkey
153   :goals: build
154
155Flashing
156========
157
15896Boards Argonkey can be flashed by two methods, one using the ROM
159bootloader and another using the SWD debug port (which requires additional
160hardware).
161
162Flashing using the ROM bootloader requires a special activation pattern,
163which can be triggered by using the BOOT0 pin. The ROM bootloader supports
164flashing via USB (DFU), UART, I2C and SPI, but this document describes the
165UART case only. You can read more about how to enable and use the ROM
166bootloader by checking the application note `AN2606`_ .
167
168Using ROM bootloader:
169---------------------
170
171Hereafter the documents describes basic steps to perform ArgonKey firmware
172flashing on a Linux PC using UART as communication channel.
173
1741. Connect ArgonKey UART to your Linux PC using, for example, a USB-TTL serial
175   cable. The flashing procedure has been tested using a `TTL-232RG`_ cable with
176   FTDI chip. The UART pins on ArgonKey can be found on the P3 low speed
177   expansion connector on the back of the board.
178
179   - GND (black)  to ArgonKey GND (P3.1)
180   - TXD (orange) to ArgonKey UART0_TXD (P3.5)
181   - RXD (yellow) to ArgonKey UART0_RXD (P3.7)
182
183   When the USB cable is inserted to the Linux PC the following device will be
184   created: /dev/ttyUSBx (x is usually '0').
185
1862. Force STM32F412CG to enter in Bootloader mode
187
188   - Connect BOOT0 to 1V8 (link P2.1 to P3.30)
189   - Press and release the RST button
190
1913. Use stm32flash utility to flash the ArgonKey:
192
193.. code-block:: console
194
195    $ stm32flash  -w zephyr.bin -v -g 0x08000000 /dev/ttyUSB0
196
197See References section for more info on `stm32flash`_.
198
199Using SWD debugger:
200-------------------
201
202Select a commercial JTAG/SWD h/w tool and connect it to ArgonKey P4 connector.
203
204The ArgonKey has been tested using the `ST-LINK/V2`_ tool. Once that the tool
205is connected to the PC through USB, it presents itself as a USB composite
206device with mass storage capability. The device can be then mounted in linux
207and the f/w can be actually copied there and will be automatically flashed by
208the ST-LINK onto the ArgonKey.
209
210Example:
211
212.. code-block:: console
213
214   $ mount /dev/sdb /mnt
215   $ cp zephyr.bin /mnt
216   $ umount /mnt
217
218Debugging
219=========
220
221References
222**********
223
224.. target-notes::
225
226.. _ARGONKEY website:
227   https://www.st.com/en/evaluation-tools/steval-mki187v1.html
228
229.. _AN2606:
230   https://www.st.com/resource/en/application_note/cd00167594.pdf
231
232.. _stm32flash:
233   https://sourceforge.net/p/stm32flash/wiki/Home/
234
235.. _ST-LINK/V2:
236   https://www.st.com/en/development-tools/st-link-v2.html
237
238.. _TTL-232RG:
239   http://www.ftdichip.com/Support/Documents/DataSheets/Cables/DS_TTL-232RG_CABLES.pdf
240