1.. _sam4e_xpro:
2
3SAM4E Xplained Pro
4###################
5
6Overview
7********
8
9The SAM4E Xplained Pro evaluation kit is a development platform to evaluate the
10Atmel SAM4E series microcontrollers.
11
12.. image:: img/sam4e_xpro.jpg
13     :align: center
14     :alt: SAM4E Xplained Pro
15
16Hardware
17********
18
19- ATSAM4E16E ARM Cortex-M4F Processor
20- 12 MHz crystal oscillator
21- internal 32.768 kHz crystal oscillator
22- 2 x IS61WV5128BLL 4Mb SRAM
23- MT29F2G08ABAEAWP 2Gb NAND
24- SD card connector
25- CAN-bus (TLE7250GVIOXUMA1 CAN Transceiver)
26- Ethernet port (KSZ8081MNXIA phy)
27- Micro-AB USB device
28- Micro-AB USB debug interface supporting CMSIS-DAP, Virtual COM Port and Data
29  Gateway Interface (DGI)
30- One reset and one user pushbutton
31- 1 yellow user LEDs
32
33
34Supported Features
35==================
36
37The sam4e_xpro board configuration supports the following hardware
38features:
39
40+-----------+------------+-------------------------------------+
41| Interface | Controller | Driver/Component                    |
42+===========+============+=====================================+
43| NVIC      | on-chip    | nested vector interrupt controller  |
44+-----------+------------+-------------------------------------+
45| SYSTICK   | on-chip    | systick                             |
46+-----------+------------+-------------------------------------+
47| UART      | on-chip    | serial port                         |
48+-----------+------------+-------------------------------------+
49| USART     | on-chip    | serial port                         |
50+-----------+------------+-------------------------------------+
51| I2C       | on-chip    | i2c                                 |
52+-----------+------------+-------------------------------------+
53| SPI       | on-chip    | spi                                 |
54+-----------+------------+-------------------------------------+
55| ETHERNET  | on-chip    | ethernet                            |
56+-----------+------------+-------------------------------------+
57| WATCHDOG  | on-chip    | watchdog                            |
58+-----------+------------+-------------------------------------+
59| GPIO      | on-chip    | gpio                                |
60+-----------+------------+-------------------------------------+
61
62Other hardware features are not currently supported by Zephyr.
63
64The default configuration can be found in the Kconfig
65:zephyr_file:`boards/arm/sam4e_xpro/sam4e_xpro_defconfig`.
66
67Connections and IOs
68===================
69
70The `SAM4E Xplained Pro User Guide`_ has detailed information about board
71connections. Download the `SAM4E Xplained Pro documentation`_ for more detail.
72
73System Clock
74============
75
76The SAM4E MCU is configured to use the 12 MHz internal oscillator on the board
77with the on-chip PLL to generate an 120 MHz system clock.
78
79Serial Port
80===========
81
82The ATSAM4E16E MCU has 2 UARTs and 2 USARTs. One of the UARTs (UART0) is
83configured for the console and is available as a Virtual COM Port by EDBG USB
84chip.
85
86Programming and Debugging
87*************************
88
89Flashing the Zephyr project onto SAM4E MCU requires the `OpenOCD tool`_.
90By default a factory new SAM4E chip will boot SAM-BA boot loader located in
91the ROM, not the flashed image. This is determined by the value of GPNVM1
92(General-Purpose NVM bit 1). The flash procedure will ensure that GPNVM1 is
93set to 1 changing the default behavior to boot from Flash.
94
95If your chip has a security bit GPNVM0 set you will be unable to program flash
96memory or connect to it via a debug interface. The only way to clear GPNVM0
97is to perform a chip erase procedure that will erase all GPNVM bits and the full
98contents of the SAM4E flash memory:
99
100- With the board power off, set a jumper on the J304 header.
101- Turn the board power on. The jumper can be removed soon after the power is on
102  (flash erasing procedure is started when the erase line is asserted for at
103  least 230ms)
104
105Flashing
106========
107
108For flash the board Zephyr provides two paths.  One uses the default OpenOCD
109tool and the second one uses :ref:`atmel_sam_ba_bootloader`.
110
111Using OpenOCD
112-------------
113
114#. Connect the SAM4E Xplained Pro board to your host computer using the USB
115   debug port. Then build and flash the :ref:`hello_world` application.
116
117   .. zephyr-app-commands::
118      :zephyr-app: samples/hello_world
119      :board: sam4e_xpro
120      :goals: build flash
121
122Using SAM-BA bootloader
123-----------------------
124
125#. Close the ``ERASE`` jumper on the SAM4E Xplained Pro board.  Power on the
126   board for 10s.
127
128#. Open the ``ERASE`` jumper.
129
130#. Connect the SAM4E Xplained Pro board to your host computer using the SoC
131   USB port. Then build and flash the :ref:`hello_world` application.
132
133   .. zephyr-app-commands::
134      :zephyr-app: samples/hello_world
135      :board: sam4e_xpro
136      :goals: build
137
138   .. code-block:: console
139
140      $ west flash -r bossac
141
142Visualizing the message
143-----------------------
144
145#. Run your favorite terminal program to listen for output. Under Linux the
146   terminal should be :code:`/dev/ttyACM0`. For example:
147
148   .. code-block:: console
149
150      $ minicom -D /dev/ttyACM0 -o
151
152   The -o option tells minicom not to send the modem initialization string.
153   Connection should be configured as follows:
154
155   - Speed: 115200
156   - Data: 8 bits
157   - Parity: None
158   - Stop bits: 1
159
160#. Press reset button
161
162   You should see "Hello World! sam4e_xpro" in your terminal.
163
164Debugging
165=========
166
167You can debug an application in the usual way.  Here is an example for the
168:ref:`hello_world` application.
169
170.. zephyr-app-commands::
171   :zephyr-app: samples/hello_world
172   :board: sam4e_xpro
173   :maybe-skip-config:
174   :goals: debug
175
176References
177**********
178
179.. target-notes::
180
181.. _SAM4E Xplained Pro User Guide:
182    http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-42216-SAM4E-Xplained-Pro_User-Guide.pdf
183
184.. _SAM4E Xplained Pro documentation:
185    http://ww1.microchip.com/downloads/en/DeviceDoc/SAM4E-Xplained-Pro_Design-Documentation.zip
186
187.. _OpenOCD tool:
188    http://openocd.org/
189
190.. _SAM-BA:
191    https://www.microchip.com/developmenttools/ProductDetails/PartNO/SAM-BA%20In-system%20Programmer
192