1.. _sam4s_xplained:
2
3SAM4S Xplained
4################
5
6Overview
7********
8
9The SAM4S Xplained evaluation kit is a development platform to evaluate the
10Atmel SAM4S series microcontrollers.
11
12.. image:: img/sam4s_xplained.jpg
13     :align: center
14     :alt: SAM4S Xplained
15
16Hardware
17********
18
19- ATSAM4S16C ARM Cortex-M4 Processor
20- 12 MHz crystal oscillator
21- internal 32.768 kHz crystal oscillator
22- IS66WV51216DALL 8 Mb SRAM
23- Micro-AB USB device
24- Micro-AB USB debug interface supporting SEGGER OB and Virtual COM Port and
25  Data
26- One reset and one user pushbutton
27- 2 yellow user LEDs
28- IC pads for external flash chip
29
30Supported Features
31==================
32
33The sam4s_xplained board configuration supports the following hardware
34features:
35
36+-----------+------------+-------------------------------------+
37| Interface | Controller | Driver/Component                    |
38+===========+============+=====================================+
39| NVIC      | on-chip    | nested vector interrupt controller  |
40+-----------+------------+-------------------------------------+
41| SYSTICK   | on-chip    | systick                             |
42+-----------+------------+-------------------------------------+
43| UART      | on-chip    | serial port                         |
44+-----------+------------+-------------------------------------+
45| USART     | on-chip    | serial port                         |
46+-----------+------------+-------------------------------------+
47| I2C       | on-chip    | i2c                                 |
48+-----------+------------+-------------------------------------+
49| SPI       | on-chip    | spi                                 |
50+-----------+------------+-------------------------------------+
51| WATCHDOG  | on-chip    | watchdog                            |
52+-----------+------------+-------------------------------------+
53| GPIO      | on-chip    | gpio                                |
54+-----------+------------+-------------------------------------+
55| HWINFO    | on-chip    | Unique device serial number         |
56+-----------+------------+-------------------------------------+
57| SMC       | on-chip    | memc (PSRAM)                        |
58+-----------+------------+-------------------------------------+
59| PWM       | on-chip    | pwm                                 |
60+-----------+------------+-------------------------------------+
61| ADC       | on-chip    | adc                                 |
62+-----------+------------+-------------------------------------+
63
64Other hardware features are not currently supported by Zephyr.
65
66The default configuration can be found in the Kconfig
67:zephyr_file:`boards/arm/sam4s_xplained/sam4s_xplained_defconfig`.
68
69Connections and IOs
70===================
71
72Download the `SAM4S Xplained Design Files`_ for more information. It has
73full schematic and gerbers files.
74
75System Clock
76============
77
78The SAM4S MCU is configured to use the 12 MHz internal oscillator on the board
79with the on-chip PLL to generate an 84 MHz system clock.
80
81Serial Port
82===========
83
84The ATSAM4S16C MCU has 2 UARTs and 2 USARTs. One of the UARTs (UART0) is
85connected to the Segger J-Link OB chip (the AT91SAM3U4 is programmed to be
86Segger J-Link OB). Segger J-Link OB brings the UART out as a virtual COM port.
87The section flashing uses the UART from the Segger USB debug connection.
88
89Programming and Debugging
90*************************
91
92The SAM4S Xplained board comes with Segger `J-Link OB <https://www.segger.com/jlink-ob.html>`_. This provides a debug
93interface to the SAM4S16C chip. You can use Ozone or JLink to communicate with
94the SAM4S16C.
95
96Flashing
97========
98
99For flash the board Zephyr provides two paths.  One uses the default JLink
100tool and the second one uses :ref:`atmel_sam_ba_bootloader`.
101
102Using JLink
103-------------
104
105#. Download JLink from the Segger `JLink Downloads Page`_. Go to the section
106   "J-Link Software and Documentation Pack" and install the "J-Link Software
107   and Documentation pack for Linux". The application JLinkExe needs to be
108   accessible from your path.
109
110#. Connect the SAM4S Xplained board to your host computer using the USB debug
111   port. Then build and flash the :ref:`hello_world` application.
112
113   .. zephyr-app-commands::
114      :zephyr-app: samples/hello_world
115      :board: sam4s_xplained
116      :goals: build flash
117
118
119Using SAM-BA bootloader
120-----------------------
121
122#. Close the ``J25`` jumper on the SAM4S Xplained board.  Power on the board
123   for 10s.
124
125#. Open the ``J25`` jumper.
126
127#. Connect the SAM4S Xplained board to your host computer using the SoC USB
128   port. Then build and flash the :ref:`hello_world` application.
129
130   .. zephyr-app-commands::
131      :zephyr-app: samples/hello_world
132      :board: sam4s_xplained
133      :goals: build
134
135   .. code-block:: console
136
137      $ west flash -r bossac
138
139
140Visualizing the message
141-----------------------
142
143#. Run your favorite terminal program to listen for output. Under Linux the
144   terminal should be :code:`/dev/ttyACM0`. For example:
145
146   .. code-block:: console
147
148      $ minicom -D /dev/ttyACM0 -o
149
150   The -o option tells minicom not to send the modem initialization string.
151   Connection should be configured as follows:
152
153   - Speed: 115200
154   - Data: 8 bits
155   - Parity: None
156   - Stop bits: 1
157
158#. Press reset button
159
160   You should see "Hello World! sam4s_xplained" in your terminal.
161
162
163Debugging
164=========
165
166You can debug an application in the usual way.  Here is an example for the
167:ref:`hello_world` application.
168
169.. zephyr-app-commands::
170   :zephyr-app: samples/hello_world
171   :board: sam4s_xplained
172   :maybe-skip-config:
173   :goals: debug
174
175References
176**********
177
178.. target-notes::
179
180.. _SAM4S Xplained Online User Guide:
181    http://ww1.microchip.com/downloads/en/devicedoc/atmel-42075-sam4s-xplained-pro_user-guide.pdf
182
183.. _JLink Downloads Page:
184    https://www.segger.com/downloads/jlink
185
186.. _SAM4S Xplained Design Files:
187    http://ww1.microchip.com/downloads/en/DeviceDoc/SAM4S-XPLD__KitsFiles.zip
188