1.. zephyr:board:: mec172xmodular_assy6930
2
3Overview
4********
5The MEC172x Modular Card ASSY6930 (Rev. B) is a development board to evaluate the
6Microchip MEC172X series microcontrollers.  This board can work standalone
7or be mated with any platform that complies with MECC specification.
8
9Hardware
10********
11
12- MEC172x (MEC1723, MEC1727 and MEC1728) ARM Cortex-M4 Processor
13- 416 KB RAM and 128 KB boot ROM
14- UART1 using microUSB
15- PECI interface 3.0
16- FAN, PWM and TACHO pins
17- 5 SMBus instances
18- eSPI header
19- VCI interface
20- 1 hardware driven PS/2 ports
21- Keyboard interface headers
22
23For more information about the SOC please see `MEC172x Reference Manual`_
24
25At difference from MEC172x evaluation board, modular MEC172x exposes the pins in 2 different ways:
26
271) Standalone mode via headers
28
29   - GPIOs
30   - JTAG port
31   - eSPI bus
32   - I2C0, I2C1 and I2C6
33   - PWM1, PWM2, PWM3
34   - Shared  SPI
35   - Keyboard Interface
36
372) Mated mode with another platform that has a high density MECC connector
38
39   - FAN, PWM8
40   - I2C3 and I2C7
41   - eSPI bus
42
43The board is powered through the +5V USB micro-A connector or from the MECC connector.
44
45
46Supported Features
47==================
48
49The mec172xmodular_assy6930 (Rev. B) board configuration supports the following hardware features:
50
51+-----------+------------+-------------------------------------+
52| Interface | Controller | Driver/Component                    |
53+===========+============+=====================================+
54| NVIC      | on-chip    | nested vector interrupt controller  |
55+-----------+------------+-------------------------------------+
56| SYSTICK   | on-chip    | systick                             |
57+-----------+------------+-------------------------------------+
58| UART      | on-chip    | serial port                         |
59+-----------+------------+-------------------------------------+
60| GPIO      | on-chip    | gpio                                |
61+-----------+------------+-------------------------------------+
62| I2C       | on-chip    | i2c                                 |
63+-----------+------------+-------------------------------------+
64| PINMUX    | on-chip    | pinmux                              |
65+-----------+------------+-------------------------------------+
66| PS/2      | on-chip    | ps2                                 |
67+-----------+------------+-------------------------------------+
68| KSCAN     | on-chip    | kscan                               |
69+-----------+------------+-------------------------------------+
70| TACH      | on-chip    | tachometer                          |
71+-----------+------------+-------------------------------------+
72| RPMFAN    | on-chip    | Fan speed controller                |
73+-----------+------------+-------------------------------------+
74
75Other hardware features are not currently supported by Zephyr (at the moment)
76
77The default configuration can be found in the
78:zephyr_file:`boards/microchip/mec172xmodular_assy6930/mec172xmodular_assy6930_defconfig` Kconfig file.
79
80Connections and IOs
81===================
82
83This evaluation board kit is comprised of the following HW blocks:
84
85- MEC172x Modular ASSY 6930 Rev B1 `MEC172x Modular EC Card - Assy_6930 Rev B1p1`_
86
87System Clock
88============
89
90The MEC172x MCU is configured to use the 96Mhz internal oscillator with the
91on-chip PLL to generate a resulting EC clock rate of 12 MHz. See Processor clock
92control register in chapter 4 "4.0 POWER, CLOCKS, and RESETS" of the data sheet in
93the references at the end of this document.
94
95Serial Port
96===========
97
98UART1 is configured for serial logs.
99
100Jumper settings
101***************
102
103Please follow the jumper settings below to properly demo this
104board. Advanced users may deviate from this recommendation.
105
106Jumper setting for MEC172x Modular Assy 6930 Rev B1p1
107=====================================================
108
109Power-Related Jumpers
110---------------------
111If you wish to power from type A/B connector ``P1`` set the jumper ``JP22 1-2``.
112This is required for standalone mode.
113If you wish to power through MECC connector ``P2`` and mate to external platform,
114set the jumper to ``JP22 2-3``.
115
116NOTE: A single jumper is required in JP22.
117
118If you wish to set VTR2 to 3.3V, set the jumper ``JP26 2-3``.
119This is required for Windows application.
120If you wish to set VTR2 to 1.8V, set the jumper ``JP26 1-2``.
121This is required for Chrome application.
122
123Boot-ROM Straps
124---------------
125This jumper configures MEC172x Boot-ROM strap.
126
127+---------------------+
128| JP23 (UART_BSTRAP)  |
129+=====================+
130| 1-2                 |
131+---------------------+
132
133``JP23 1-2`` pulls UART_BSTRAP to GND.  MEC172x Boot-ROM samples UART_BSTRAP and if low,
134UART interface is used for Crisis Recovery.
135
136Boot Source Select
137------------------
138The jumpers below configure MEC172x to boot from Shared SPI, Slave Attached Flash (SAF)
139or Master Attached Flash (MAF).
140
141+-------------------+----------+
142| Boot Source       | JP25     |
143+===================+==========+
144| Shared SPI or SAF | 5-6      |
145+-------------------+----------+
146| MAF               | 1-2, 4-6 |
147+-------------------+----------+
148
149
150Programming and Debugging
151*************************
152
153Setup
154=====
155
156#. If you use Dediprog SF100 programmer, then setup it.
157
158   Windows version can be found at the `SF100 Product page`_.
159
160   Linux version source code can be found at `SF100 Linux GitHub`_.
161   Follow the `SF100 Linux manual`_ to complete setup of the SF100 programmer.
162   For Linux please make sure that you copied ``60-dediprog.rules``
163   from the ``SF100Linux`` folder to the :code:`/etc/udev/rules.s` (or rules.d)
164   then restart service using:
165
166   .. code-block:: console
167
168      $ udevadm control --reload
169
170   Add directory with program ``dpcmd`` (on Linux)
171   or ``dpcmd.exe`` (on Windows) to your ``PATH``.
172
173#. Clone the `MEC172x SPI Image Gen`_ repository or download the files within
174   that directory.
175
176#. Make the image generation available for Zephyr, by making the tool
177   searchable by path, for example:
178
179   .. code-block:: console
180
181      -DMEC172X_SPI_GEN=<path to spi_gen tool>/mec172x_spi_gen_lin_x86_64
182
183   Note that the tools for Linux and Windows have different file names.
184
185#. The default MEC172X_SPI_CFG file is spi_cfg.txt located in ${BOARD_DIR}/support.
186   Example of SPI_CFG for 4MBit (spi_cfg_4MBit.txt) and 128MBit (spi_cfg_128MBit.txt)
187   SPI flash can be found in the same folder.  If needed, a custom SPI image
188   configuration file can be specified to override the default one.
189
190   .. code-block:: console
191
192      -DMEC172X_SPI_CFG=<path to spi_cfg file>/spi_cfg.txt
193
194#. Example command to generate 128MBit spi image for hello_world:
195
196   .. code-block:: console
197
198      west build -p auto -b mec172xmodular_assy6930 samples/hello_world -- -DMEC172X_SPI_GEN=$HOME/CPGZephyrDocs/MEC172x/SPI_image_gen/mec172x_spi_gen_lin_x86_64 -DMEC172X_SPI_CFG=$HOME/zephyrproject/zephyr/boards/microchip/mec172xmodular_assy6930/support/spi_cfg_128MBit.txt
199
200
201Wiring
202========
203
204#. Connect programmer to the header J2 on the ASSY6930 board, it will flash the SPI NOR chip
205   ``U2``. Make sure that your programmer's offset is 0x0.
206   For programming you can use Dediprog SF100 or a similar tool for flashing SPI chips.
207
208   +------------+---------------+
209   |  Dediprog  |               |
210   |  Connector |      J2       |
211   +============+===============+
212   |    VCC     |       1       |
213   +------------+---------------+
214   |    GND     |       2       |
215   +------------+---------------+
216   |    CS      |       3       |
217   +------------+---------------+
218   |    CLK     |       4       |
219   +------------+---------------+
220   |    MISO    |       6       |
221   +------------+---------------+
222   |    MOSI    |       5       |
223   +------------+---------------+
224
225#. Connect UART1 port of the mec172xmodular_assy6930 (Rev. B) board
226   to your host computer using the RS232 cable.
227
228#. Apply power to the board via a micro-USB cable.
229   Configure this option by using a jumper between ``JP22 1-2``.
230
231Building
232========
233
234#. Build :zephyr:code-sample:`hello_world` application as you would normally do.
235
236#. The file :file:`spi_image.bin` will be created if the build system
237   can find the image generation tool. This binary image can be used
238   to flash the SPI chip.
239
240Flashing
241========
242
243#. Run your favorite terminal program to listen for output.
244   Under Linux the terminal should be :code:`/dev/ttyUSB0`. Do not close it.
245
246   For example:
247
248   .. code-block:: console
249
250      $ minicom -D /dev/ttyUSB0 -o
251
252   The -o option tells minicom not to send the modem initialization
253   string. Connection should be configured as follows:
254
255   - Speed: 115200
256   - Data: 8 bits
257   - Parity: None
258   - Stop bits: 1
259
260#. Flash your board using ``west`` from the second terminal window.
261   Split first and second terminal windows to view both of them.
262
263   .. code-block:: console
264
265      $ west flash
266
267   .. note:: When west process started press Reset button ``S1`` and do not release it
268    till the whole west process will not be finished successfully.
269
270#. You should see ``"Hello World! mec172xmodular_assy6930"`` in the first terminal window.
271   If you don't see this message, press the Reset button and the message should appear.
272
273Debugging
274=========
275``J1`` header on the board allows for JTAG connections for debug.
276
277Troubleshooting
278===============
279#. In case you don't see your application running, please make sure ``LED1`` is lit.
280   If ``LED1`` is off, check the power-related jumpers again.
281
282#. If you can't program the board using Dediprog, disconnect and reconnect cable connected to
283   ``P1`` and try again.
284
285#. If Dediprog can't detect the onboard flash, press the board's ``S1`` Reset button and try again.
286
287
288References
289**********
290.. target-notes::
291
292.. _MEC172x Reference Manual:
293    https://github.com/MicrochipTech/CPGZephyrDocs/blob/master/MEC172x/MEC172x-Data-Sheet.pdf
294.. _MEC172x Modular EC Card - Assy_6930 Rev B1p1:
295    https://github.com/MicrochipTech/CPGZephyrDocs/blob/master/MEC172x/MEC172X-MECC_Assy_6930_B1p1-SCH.pdf
296.. _MEC172x SPI Image Gen:
297    https://github.com/MicrochipTech/CPGZephyrDocs/tree/master/MEC172x/SPI_image_gen
298.. _SF100 Linux GitHub:
299    https://github.com/DediProgSW/SF100Linux
300.. _SF100 Product page:
301    https://www.dediprog.com/product/SF100
302.. _SF100 Linux manual:
303    https://www.dediprog.com/download/save/727.pdf
304