1.. _96b_stm32_sensor_mez:
2
396Boards STM32 Sensor Mezzanine
4###############################
5
6Overview
7********
8
996Boards STM32 Sensor Mezzanine is based on the ST Microelectronics
10STM32F446VE Cortex M4 CPU.
11
12This board acts as a mezzanine platform for all 96Boards CE compliant
13boards. It can also be used as a standalone board.
14
15.. figure:: img/96b_stm32_sensor_mez.jpg
16     :align: center
17     :alt: 96Boards STM32 Sensor Mezzanine
18
19     96Boards STM32 Sensor Mezzanine
20
21Hardware
22********
23
2496Boards STM32 Sensor Mezzanine provides the following hardware components:
25
26- STM32F446VE in LQFP100 package
27- ARM |reg| 32-bit Cortex |reg|-M4 CPU with FPU
28- 180 MHz max CPU frequency
29- 1.8V work voltage
30- 512 KB Flash
31- 128 KB SRAM
32- On board sensors:
33
34  - Temperature/Pressure: STMicro LPS22HB
35  - Accelerometer/Gyroscope: STMicro LSM6DS3H
36  - Magnetometer: STMicro LIS3MDL
37  - Microphone: STMicro MP34DT01
38
39- 3User LEDs
40- GPIO with external interrupt capability
41- UART
42- I2C (2)
43- SPI (3)
44- I2S (1)
45
46Supported Features
47==================
48
49The Zephyr 96b_stm32_sensor_mez board configuration supports the following
50hardware features:
51
52+-----------+------------+-------------------------------------+
53| Interface | Controller | Driver/Component                    |
54+===========+============+=====================================+
55| NVIC      | on-chip    | nested vector interrupt controller  |
56+-----------+------------+-------------------------------------+
57| SYSTICK   | on-chip    | system clock                        |
58+-----------+------------+-------------------------------------+
59| UART      | on-chip    | serial port                         |
60+-----------+------------+-------------------------------------+
61| GPIO      | on-chip    | gpio                                |
62+-----------+------------+-------------------------------------+
63| PINMUX    | on-chip    | pinmux                              |
64+-----------+------------+-------------------------------------+
65| FLASH     | on-chip    | flash                               |
66+-----------+------------+-------------------------------------+
67| SPI       | on-chip    | spi                                 |
68+-----------+------------+-------------------------------------+
69| I2C       | on-chip    | i2c                                 |
70+-----------+------------+-------------------------------------+
71| PWM       | on-chip    | pwm                                 |
72+-----------+------------+-------------------------------------+
73| I2S       | on-chip    | i2s                                 |
74+-----------+------------+-------------------------------------+
75
76The default board configuration can be found in
77:zephyr_file:`boards/96boards/stm32_sensor_mez/96b_stm32_sensor_mez_defconfig`
78
79Connections and IOs
80===================
81
82LED
83---
84
85- LED1 / User1 LED = PD10
86- LED2 / User2 LED = PD11
87- LED3 / User3 LED = PD12
88
89Push buttons
90------------
91
92- BUTTON = RST (BT1)
93- BUTTON = USR (BT2)
94
95System Clock
96============
97
9896Boards STM32 Sensor Mezzanine can be driven by an internal oscillator as
99well as the main PLL clock. In default board configuration, the 16MHz external
100oscillator is used to drive the main PLL clock to generate a System Clock
101(SYSCLK) at 84MHz. On the bus side, AHB/APB2 clocks runs at 84MHz, while APB1
102clock runs at 42MHz.
103
104Serial Port
105===========
106
107On 96Boards STM32 Sensor Mezzanine, Zephyr console output is assigned to UART4
108exposed via on-board Micro USB connector. Default settings are 115200 8N1.
109
110The default USART mappings for the remaining ones are:
111
112- USART1: Connected to AP via UART0 on the 96Boards Low-Speed Header.
113        - TX: PA9
114        - RX: PA10
115
116- USART2: Connected to D0(RX) and D1(TX) on the Arduino Header.
117        - TX: PD5
118        - RX: PD6
119
120- USART3: Broken out to Grove connector J10.
121        - TX: PD8
122        - RX: PD9
123
124I2C
125---
126
12796Boards STM32 Sensor Mezzanine board has up to 3 I2Cs. The default I2C
128mapping is:
129
130- I2C1_SCL  : PB6
131- I2C1_SDA  : PB7
132- I2C2_SCL  : PB10
133- I2C2_SDA  : PC12
134
135I2C2 goes to the Groove connectors and can be used to attach external sensors.
136
137SPI
138---
13996Boards STM32 Sensor Mezzanine board has 3 SPIs. SPI1 is used in slave mode
140as the communication bus with the AP. SPI2 is used in master mode to control
141the LSM6DS3H sensor. SPI4 is broken out to Grove Connector J5.
142The default SPI mapping is:
143
144- SPI1_NSS  : PA4
145- SPI1_SCK  : PA5
146- SPI1_MISO : PA6
147- SPI1_MOSI : PA7
148- SPI2_NSS  : PB9
149- SPI2_SCK  : PD3
150- SPI2_MISO : PB14
151- SPI2_MOSI : PB15
152- SPI4_NSS  : PE11
153- SPI4_SCK  : PE12
154- SPI4_MISO : PE13
155- SPI4_MOSI : PE14
156
157PWM
158---
15996Boards STM32 Sensor Mezzanine board exposes 6 PWM channels on the Arduino
160connector. The default PWM mapping is:
161
162- PWM3_CH1  : PB4  : D9
163- PWM3_CH3  : PC8  : D3
164- PWM4_CH3  : PD14 : D6
165- PWM4_CH4  : PD15 : D5
166- PWM9_CH1  : PE5  : D12
167- PWM9_CH2  : PE6  : D11
168
169I2S
170---
171
17296Boards STM32 Sensor Mezzanine board exposes 1 I2S port which is connected
173to the on-board ST MP34DT01 DMIC. The default I2S mapping is:
174
175- I2S2_SD   : PC1
176- I2S2_CK   : PC7
177
178Programming and Debugging
179*************************
180
181Building
182========
183
184Here is an example for building the :zephyr:code-sample:`hello_world` application.
185
186.. zephyr-app-commands::
187   :zephyr-app: samples/hello_world
188   :board: 96b_stm32_sensor_mez
189   :goals: build
190
191Flashing
192========
193
19496Boards STM32 Sensor Mezzanine board includes an ST-LINK/V2-1 embedded
195debug tool interface. This interface is supported by the openocd version
196included in the Zephyr SDK.
197
198Flashing an application to 96Boards STM32 Sensor Mezzanine
199----------------------------------------------------------
200
201Here is an example for the :zephyr:code-sample:`hello_world` application.
202
203Run a serial host program to connect with your 96Boards STM32 Sensor Mezzanine
204board.
205
206.. code-block:: console
207
208   $ minicom -b 115200 -D /dev/ttyACM0
209
210Build and flash the application:
211
212.. zephyr-app-commands::
213   :zephyr-app: samples/hello_world
214   :board: 96b_stm32_sensor_mez
215   :goals: build flash
216
217You should see the following message on the console:
218
219.. code-block:: console
220
221   $ Hello World! 96b_stm32_sensor_mez
222
223Debugging
224=========
225
226You can debug an application in the usual way.  Here is an example for the
227:zephyr:code-sample:`hello_world` application.
228
229.. zephyr-app-commands::
230   :zephyr-app: samples/hello_world
231   :board: 96b_stm32_sensor_mez
232   :maybe-skip-config:
233   :goals: debug
234
235References
236**********
237
238.. target-notes::
239
240.. _96Boards STM32 Sensor Mezzanine website:
241   https://www.96boards.org/documentation/mezzanine/stm32/
242
243.. _STM32F446VE on www.st.com:
244   https://www.st.com/en/microcontrollers/stm32f446ve.html
245
246.. _STM32F446 reference manual:
247   https://www.st.com/resource/en/reference_manual/dm00135183.pdf
248