1.. zephyr:board:: cc3220sf_launchxl
2
3Overview
4********
5The SimpleLink Wi-Fi CC3220SF LaunchPad development kit (CC3220SF-LAUNCHXL)
6highlights CC3220SF, a single-chip wireless microcontroller (MCU) with
71MB internal flash, 4MB external serial flash, 256KB of RAM and enhanced
8security features.
9
10See the `TI CC3220 Product Page`_ for details.
11
12Features:
13=========
14
15* Two separate execution environments: a user application dedicated ARM
16  Cortex-M4 MCU and a network processor MCU to run all Wi-Fi and
17  internet logical layers
18* 40-pin LaunchPad standard leveraging the BoosterPack ecosystem
19* On-board accelerometer and temperature sensor
20* Two buttons and three LEDs for user interaction
21* UART through USB to PC
22* BoosterPack plug-in module for adding graphical displays, audio
23  codecs, antenna selection, environmental sensing, and more
24* Power from USB for the LaunchPad and optional external BoosterPack
25* XDS110-based JTAG emulation with serial port for flash programming
26
27Details on the CC3220SF LaunchXL development board can be found in the
28`CC3220SF LaunchPad Dev Kit Hardware User's Guide`_.
29
30Hardware
31********
32
33The CC3220SF SoC has two MCUs:
34
35#. Applications MCU - an ARM |reg| Cortex |reg|-M4 Core at 80 MHz, with 256Kb RAM,
36   and access to external serial 4MB flash with bootloader and peripheral
37   drivers in ROM.
38
39#. Network Coprocessor (NWP) - a dedicated ARM MCU, which completely
40   offloads Wi-Fi and internet protocols from the application MCU.
41
42Complete details of the CC3220SF SoC can be found in the `CC3220 TRM`_.
43
44Supported Features
45==================
46
47.. zephyr:board-supported-hw::
48
49.. note::
50
51   For consistency with TI SimpleLink SDK and BoosterPack examples,
52   the I2C driver defaults to I2C_BITRATE_FAST mode (400 kHz) bus speed
53   on bootup.
54
55The accelerometer, temperature sensors, or other peripherals
56accessible through the BoosterPack, are not currently supported.
57
58Programming and Debugging
59*************************
60
61TI officially supports development on the CC3220SF using the TI
62`CC3220 SDK`_ on Windows and Linux using TI tools: Code Composer
63Studio for debugging and `UniFlash`_ for flashing.
64
65For Windows developers, see the `CC3220 Getting Started Guide`_ for
66instructions on installation of tools, and how to flash the board using
67UniFlash.
68
69Note that zephyr.bin produced by the Zephyr SDK may not load via
70UniFlash tool.  If encountering difficulties, use the zephyr.elf
71file and openocd instead (see below).
72
73The following instructions are geared towards Linux developers who
74prefer command line tools to an IDE.
75
76Before flashing and debugging the board, there are a few one-time board
77setup steps to follow.
78
79Prerequisites:
80==============
81
82#. Download and install the latest version of `UniFlash`_.
83#. Jumper SOP[2..0] (J15) to [010], and connect the USB cable to the PC.
84
85   This should result in a new device "Texas Instruments XDS110 Embed
86   with CMSIS-DAP" appearing at /dev/ttyACM1 and /dev/ttyACM0.
87
88#. Update the service pack, and place the board in "Development Mode".
89
90   Setting "Development Mode" enables the JTAG interface, necessary
91   for subsequent use of OpenOCD and updating XDS110 firmware.
92
93   Follow the instructions in Section 2.4 "Download the Application",
94   in the `CC3220 Getting Started Guide`_, except for steps 5 and 6 in
95   Section 2.4.1 which select an MCU image.
96
97#. Ensure the XDS-110 emulation firmware is updated.
98
99   Download and install the latest `XDS-110 emulation package`_.
100
101   Follow these `xds110 firmware update directions
102   <http://software-dl.ti.com/ccs/esd/documents/xdsdebugprobes/emu_xds110.html#updating-the-xds110-firmware>`_
103
104   Note that the emulation package install may place the xdsdfu utility
105   in ``<install_dir>/ccs_base/common/uscif/xds110/``.
106
107#. Switch Jumper SOP[2..0] (J15) back to [001].
108
109   Remove power from the board (disconnect USB cable) before switching jumpers.
110
111#. Install OpenOCD
112
113   You can obtain OpenOCD by following these
114   :ref:`installing the latest Zephyr SDK instructions <toolchain_zephyr_sdk>`.
115
116   After the installation, add the directory containing the OpenOCD executable
117   to your environment's PATH variable. For example, use this command in Linux:
118
119   .. code-block:: console
120
121      export PATH=$ZEPHYR_SDK_INSTALL_DIR/sysroots/x86_64-pokysdk-linux/usr/bin/openocd:$PATH
122
123   If you had previously installed TI OpenOCD, you can simply switch to use
124   the one in the Zephyr SDK. If for some reason you wish to continue to use
125   your TI OpenOCD installation, you can set the OPENOCD and
126   OPENOCD_DEFAULT_PATH variables in
127   :zephyr_file:`boards/ti/cc3220sf_launchxl/board.cmake` to point the build
128   to the paths of the OpenOCD binary and its scripts, before
129   including the common openocd.board.cmake file:
130
131   .. code-block:: cmake
132
133      set(OPENOCD "/usr/local/bin/openocd" CACHE FILEPATH "" FORCE)
134      set(OPENOCD_DEFAULT_PATH /usr/local/share/openocd/scripts)
135      include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
136
137#. Ensure CONFIG_XIP=y (default) is set.
138
139   This locates the program into flash, and sets CONFIG_CC3220SF_DEBUG=y,
140   which prepends a debug header enabling the flash to persist over
141   subsequent reboots, bypassing the bootloader flash signature
142   verification.
143
144   See Section 21.10 "Debugging Flash User Application Using JTAG" of the
145   `CC3220 TRM`_ for details on the secure flash boot process.
146
147
148Once the above prerequisites are met, applications for the ``_cc3220sf_launchxl``
149board can be built, flashed, and debugged with openocd and gdb per the Zephyr
150Application Development Primer (see :ref:`build_an_application` and
151:ref:`application_run`).
152
153Flashing
154========
155
156To build and flash an application, execute the following commands for <my_app>:
157
158.. zephyr-app-commands::
159   :app: <my_app>
160   :board: cc3220sf_launchxl
161   :goals: flash
162
163This will load the image into flash.
164
165To see program output from UART0, connect a separate terminal window:
166
167.. code-block:: console
168
169  % screen /dev/ttyACM0 115200 8N1
170
171Then press the reset button (SW1) on the board to run the program.
172
173When using OpenOCD from Zephyr SDK to flash the device, you may notice
174the program hangs when starting the network processor on the device, if the
175program uses it. There is a known issue with how that version of OpenOCD
176resets the network processor. You would need to manually hit the reset button
177on the board to properly reset the device after flashing.
178
179Debugging
180=========
181
182To debug a previously flashed image, after resetting the board, use the 'debug'
183build target:
184
185.. zephyr-app-commands::
186   :app: <my_app>
187   :board: cc3220sf_launchxl
188   :maybe-skip-config:
189   :goals: debug
190
191
192Wi-Fi Support
193*************
194
195The SimpleLink Host Driver, imported from the SimpleLink SDK, has been ported
196to Zephyr, and communicates over a dedicated SPI to the network co-processor.
197It is available as a Zephyr Wi-Fi device driver in
198:zephyr_file:`drivers/wifi/simplelink`.
199
200Usage:
201======
202
203Set :kconfig:option:`CONFIG_WIFI_SIMPLELINK` and :kconfig:option:`CONFIG_WIFI` to ``y``
204to enable Wi-Fi.
205See :zephyr_file:`samples/net/wifi/shell/boards/cc3220sf_launchxl.conf`.
206
207Provisioning:
208=============
209
210SimpleLink provides a few rather sophisticated Wi-Fi provisioning methods.
211To keep it simple for Zephyr development and demos, the SimpleLink
212"Fast Connect" policy is enabled, with one-shot scanning.
213This enables the cc3220sf_launchxl to automatically reconnect to the last
214good known access point (AP), without having to restart a scan, and
215re-specify the SSID and password.
216
217To connect to an AP, first run the Zephyr Wi-Fi shell sample application,
218and connect to a known AP with SSID and password.
219
220See :zephyr:code-sample:`wifi-shell`
221
222Once the connection succeeds, the network co-processor keeps the AP identity in
223its persistent memory.  Newly loaded Wi-Fi applications then need not explicitly
224execute any Wi-Fi scan or connect operations, until the need to change to a new AP.
225
226Secure Socket Offload
227*********************
228
229The SimpleLink Wi-Fi driver provides socket operations to the Zephyr socket
230offload point, enabling Zephyr BSD socket API calls to be directed to the
231SimpleLink Wi-Fi driver, by setting :kconfig:option:`CONFIG_NET_SOCKETS_OFFLOAD`
232to ``y``.
233
234Secure socket (TLS) communication is handled as part of the socket APIs,
235and enabled by:
236
237- setting both :kconfig:option:`CONFIG_NET_SOCKETS_SOCKOPT_TLS`
238  and :kconfig:option:`CONFIG_TLS_CREDENTIAL_FILENAMES` to ``y``,
239- using the TI Uniflash tool to program the required certificates and
240  keys to the secure flash filesystem, and enabling the TI Trusted
241  Root-Certificate Catalog.
242
243See :zephyr:code-sample:`sockets-http-get` and
244:zephyr_file:`samples/net/sockets/http_get/boards/cc3220sf_launchxl.conf` for an
245example.
246
247See the document `Simplelink Wi-Fi Certificates Handling`_ for details on
248using the TI UniFlash tool for certificate programming.
249
250References
251**********
252
253CC32xx Wiki:
254    http://processors.wiki.ti.com/index.php/CC31xx_%26_CC32xx
255
256.. _TI CC3220 Product Page:
257    http://www.ti.com/product/cc3220
258
259.. _CC3220 TRM:
260   http://www.ti.com/lit/pdf/swru465
261
262.. _CC3220 Programmer's Guide:
263   http://www.ti.com/lit/pdf/swru464
264
265.. _CC3220 Getting Started Guide:
266   http://www.ti.com/lit/pdf/swru461
267
268.. _UniFlash:
269   http://processors.wiki.ti.com/index.php/Category:CCS_UniFlash
270
271.. _CC3220 SDK:
272   http://www.ti.com/tool/download/SIMPLELINK-CC3220-SDK
273
274.. _CC3220SF LaunchPad Dev Kit Hardware User's Guide:
275   http://www.ti.com/lit/pdf/swru463
276
277..  _XDS-110 emulation package:
278   http://processors.wiki.ti.com/index.php/XDS_Emulation_Software_Package#XDS_Emulation_Software_.28emupack.29_Download
279
280..  _Simplelink Wi-Fi Certificates Handling:
281   http://www.ti.com/lit/pdf/swpu332
282