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