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