User Manual DA16200 FreeRTOS SDK Startup Guide for Windows UM-WI-050

Abstract The DA16200 is a highly integrated ultra-low power Wi-Fi system on chip (SoC) that allows users to develop the Wi-Fi solution on a single chip. This document is an DA16200 SDK startup guide document intended for developers who want to program using the DA16200 chipset.

UM-WI-050

DA16200 FreeRTOS SDK Startup Guide for Windows

Contents Abstract ...... 1 Contents ...... 2 Figures ...... 2 Tables ...... 3 1 Terms and Definitions ...... 4 2 References ...... 4 3 Introduction...... 5 3.1 System Requirements ...... 5 4 Development Environments Setup ...... 5 4.1 Install Library ...... 5 4.1.1 JDK ...... 5 4.1.2 GNU Arm GCC ...... 7 4.2 IDE Setup ...... 8 4.2.1 Install the Eclipse IDE ...... 8 4.2.2 Install the Eclipse Embedded CDT Plug-in...... 9 5 Set Up/Import SDK ...... 12 5.1 Import SDK Source to the Eclipse IDE ...... 12 6 Build SDK ...... 14 7 Firmware Update ...... 15 7.1 DA16200 Connecting the Board ...... 15 7.2 Configure the Serial Port for UART ...... 16 7.3 Bootloader Image ...... 17 7.4 Main RTOS Image ...... 18 8 Debugging with JTAG Using J-Link ...... 20 8.1 Install J-Link Software ...... 20 8.2 Set Up J-Link Debugger ...... 21 8.2.1 Connect J-Link ...... 21 8.2.2 Import Launch Configurations ...... 23 8.3 Run Debug Mode ...... 24 8.4 Debugging ...... 25 8.4.1 DA16x_Main_Debug (Reboot) ...... 25 8.4.2 DA16x_Main_Debug (Attach) ...... 25 8.4.3 DA16x_Main_Debug (attach_with_rtos_info) ...... 25 Revision History ...... 26

Figures Figure 1: Download JDK ...... 5 Figure 2: Environment Variables ...... 6 Figure 3: Edit a Path ...... 6 Figure 4: Add a JDK Global Path ...... 6 Figure 5: Download node.js ...... 7

User Manual Revision 1.0 31-Mar-2021

CFR0012 2 of 27 © 2021 Dialog Semiconductor

UM-WI-050

DA16200 FreeRTOS SDK Startup Guide for Windows

Figure 6: Install node.js ...... 7 Figure 7: Install Xpack ...... 7 Figure 8: Install GNU Arm GCC ...... 8 Figure 9: Install Windows Build Tools ...... 8 Figure 10: Download Eclipse IDE for C/C++ Developers ...... 8 Figure 11: Launch the Eclipse IDE ...... 9 Figure 12: Run Eclipse Marketplace ...... 9 Figure 13: Install the Eclipse Embedded CDT Plug-in ...... 10 Figure 14: Eclipse Preference ...... 10 Figure 15: [MCU] Global Arm Toolchain Paths ...... 11 Figure 16: [MCU] Global Build Tools Path ...... 11 Figure 17: Import SDK to the Eclipse IDE ...... 12 Figure 18: Import SDK to the Eclipse IDE ...... 12 Figure 19: Import SDK to the Eclipse IDE ...... 13 Figure 20: Build SDK ...... 14 Figure 21: Build SDK ...... 14 Figure 22: Firmware Image Location ...... 15 Figure 23: Check COM ports on Device Manager ...... 16 Figure 24: Serial Port Setup ...... 17 Figure 25: Mask ROM ...... 17 Figure 26: Bootloader Prompt on Command Window ...... 17 Figure 27: Load Image File...... 18 Figure 28: Main Image Prompt on Command Window ...... 18 Figure 29: Load Image File...... 18 Figure 30: Factory Mode Prompt on Command Window ...... 19 Figure 31: Download J-Link Software ...... 20 Figure 32: Install J-Link Software ...... 20 Figure 33. J-Link 9-pin Cortex-M Adapter ...... 21 Figure 34: J-Link 20Pin ...... 22 Figure 35: DA16200 Module External Connector ...... 22 Figure 36. Import Launch Configurations ...... 23 Figure 37. Import Debug Configurations ...... 23 Figure 38. Run Debug Mode ...... 24 Figure 39. Select Debug Mode ...... 24

Tables Table 1: DA16200 Module External Connector Mapping for J-LINK 20Pin ...... 21

User Manual Revision 1.0 31-Mar-2021

CFR0012 3 of 27 © 2021 Dialog Semiconductor

UM-WI-050

DA16200 FreeRTOS SDK Startup Guide for Windows

1 Terms and Definitions SDK Kit JDK Development Kit IDE Integrated development environment RTOS Real Time COM Communication Port EVK Evaluation kit UART Universal asynchronous receiver/transmitter

2 References [1] DA16200, EVK User Manual, Dialog Semiconductor

User Manual Revision 1.0 31-Mar-2021

CFR0012 4 of 27 © 2021 Dialog Semiconductor

UM-WI-050

DA16200 FreeRTOS SDK Startup Guide for Windows

3 Introduction The DA16200 is a highly integrated ultra-low power Wi-Fi system on chip (SoC) that allows users to develop the Wi-Fi solution on a single chip. The user implements the application with the DA16200 SDK, the compile environment is the Eclipse IDE. This document describes how to set up development environments for the DA16200 SDK.

3.1 System Requirements ● OS: Windows 10 ● JDK 11 or higher ● GNU Arm GCC 10.2.1 ● Eclipse 2020-09 or higher

4 Development Environments Setup

4.1 Install Library

4.1.1 JDK 1. Download a JDK installation file from https://jdk.java.net/archive/. JDK version should be at least 11 or higher.

Figure 1: Download JDK

2. Extract the zip file. 3. Edit Windows global path: a. Select Windows Settings > Edit environment variables for your account.

User Manual Revision 1.0 31-Mar-2021

CFR0012 5 of 27 © 2021 Dialog Semiconductor

UM-WI-050

DA16200 FreeRTOS SDK Startup Guide for Windows

Figure 2: Environment Variables

b. Edit the path.

Figure 3: Edit a Path

c. Add a new variable "{JDK Location}\bin".

Figure 4: Add a JDK Global Path

User Manual Revision 1.0 31-Mar-2021

CFR0012 6 of 27 © 2021 Dialog Semiconductor

UM-WI-050

DA16200 FreeRTOS SDK Startup Guide for Windows

4.1.2 GNU Arm GCC To install GNU Arm GCC 10.2.1 as a cross compiler, do the following: 1. Install node.js by downloading an installation file: https://nodejs.org/en/download/

Figure 5: Download node.js

2. Run the installation file.

Figure 6: Install node.js

3. Install Xpack: ○ npm install --global xpm@latest

Figure 7: Install Xpack

4. Install GNU Arm GCC: ○ xpm install --global @xpack-dev-tools/[email protected]

User Manual Revision 1.0 31-Mar-2021

CFR0012 7 of 27 © 2021 Dialog Semiconductor

UM-WI-050

DA16200 FreeRTOS SDK Startup Guide for Windows

Figure 8: Install GNU Arm GCC

5. Install Windows Build Tools: ○ xpm install --global @xpack-dev-tools/windows-build-tools

Figure 9: Install Windows Build Tools

4.2 Eclipse IDE Setup

4.2.1 Install the Eclipse IDE To install Eclipse IDE for using the DA16200 SDK, do the following: 1. Download the Eclipse IDE for C/C++ Developers package for Windows from https://www.eclipse.org/downloads/packages

Figure 10: Download Eclipse IDE for C/C++ Developers

User Manual Revision 1.0 31-Mar-2021

CFR0012 8 of 27 © 2021 Dialog Semiconductor

UM-WI-050

DA16200 FreeRTOS SDK Startup Guide for Windows

2. Unzip package to the folder and run Eclipse IDE (eclipse.exe).

Figure 11: Launch the Eclipse IDE

4.2.2 Install the Eclipse Embedded CDT Plug-in 1. To run Eclipse Marketplace, select Help > Eclipse Marketplace.

Figure 12: Run Eclipse Marketplace

2. Find and install the Eclipse Embedded C/C++ plug-in (the latest version).

User Manual Revision 1.0 31-Mar-2021

CFR0012 9 of 27 © 2021 Dialog Semiconductor

UM-WI-050

DA16200 FreeRTOS SDK Startup Guide for Windows

Figure 13: Install the Eclipse Embedded CDT Plug-in

3. To check the installation, do the following:

Figure 14: Eclipse Preference

a. Select Window > Preferences > MCU > Global Arm Toolchains Paths and Global Build Tools Path

User Manual Revision 1.0 31-Mar-2021

CFR0012 10 of 27 © 2021 Dialog Semiconductor

UM-WI-050

DA16200 FreeRTOS SDK Startup Guide for Windows

b. Check if the paths are correct: – Global Arm Toolchains Paths: C:/Users/{user}/AppData/Roaming/xPacks/@xpack-dev- tools/arm-none-eabi-gcc/{gcc version}/.content/bin

Figure 15: [MCU] Global Arm Toolchain Paths

– Global Build Tools path: C:/Users/{user}/AppData/Roaming/xPacks/@xpack-dev- tools/windows-build-tools/{Window Build Tools version}/.content/bin

Figure 16: [MCU] Global Build Tools Path

User Manual Revision 1.0 31-Mar-2021

CFR0012 11 of 27 © 2021 Dialog Semiconductor

UM-WI-050

DA16200 FreeRTOS SDK Startup Guide for Windows

5 Set Up/Import SDK

5.1 Import SDK Source to the Eclipse IDE 1. To import a project, select File > Import > Existing project into workspace > Next.

Figure 17: Import SDK to the Eclipse IDE

2. Select the root directory by selecting the folder window (Click Browse > Select Folder) ○ Root directory: {SDK source location}\customer\projects

Figure 18: Import SDK to the Eclipse IDE

User Manual Revision 1.0 31-Mar-2021

CFR0012 12 of 27 © 2021 Dialog Semiconductor

UM-WI-050

DA16200 FreeRTOS SDK Startup Guide for Windows

3. Check all projects and click Finish.

Figure 19: Import SDK to the Eclipse IDE

User Manual Revision 1.0 31-Mar-2021

CFR0012 13 of 27 © 2021 Dialog Semiconductor

UM-WI-050

DA16200 FreeRTOS SDK Startup Guide for Windows

6 Build SDK 1. Right-click the sdk_main project and select Build Project.

Figure 20: Build SDK

Figure 21: Build SDK

User Manual Revision 1.0 31-Mar-2021

CFR0012 14 of 27 © 2021 Dialog Semiconductor

UM-WI-050

DA16200 FreeRTOS SDK Startup Guide for Windows

7 Firmware Update DA16200 requires two images. With a serial terminal tool, each image can be loaded individually into DA16200. ● : also known as Second Bootloader ○ DA16200_[OS_type][image_type]-[vendor]-[major]-[minior]- [customer_ver]_[sflash_model].img – [Image_type]: Bootloader (BOOT), Main – [vendor]: Internal use by vendor – [major]: Major version – [minor]: Minor version or SDK patch version – [customer_ver]: User-configurable customer version – [sflash_model]: sflash model or type used ○ For example: DA16200_FBOOT_GEN01-01-XXXX-000000_ W25Q32JW.img ●

: includes RTOS and applications ○ For example: DA16200_FRTOS_GEN01-01-XXXX-000000.img Firmware Image Location is at {SDK source location}\img

Figure 22: Firmware Image Location

7.1 DA16200 Connecting the Board This section describes the installation procedure for the drivers, the configuration of the serial port, and all necessary steps to verify the connection with the PC as well as solutions to any problems that may occur. On first connection to a host PC with Windows as operating system, the system will detect several devices and will automatically install all necessary drivers. If not automatically installed, then get the driver from http://www.ftdichip.com/Drivers/CDM/CDM21224_Setup.zip. There are two virtual COM ports created by the Windows driver. The first COM port (lower number, COM35 in this example) provides a UART interface for debugging or firmware download between the PC and the DA161200. The second (higher number, COM36 in this example) is used for ATCOMMAND. See Figure 23.

User Manual Revision 1.0 31-Mar-2021

CFR0012 15 of 27 © 2021 Dialog Semiconductor

UM-WI-050

DA16200 FreeRTOS SDK Startup Guide for Windows

Figure 23: Check COM ports on Device Manager

7.2 Configure the Serial Port for UART On a Windows Host, the utility Tera Term is used to fully validate the connection to the DA16200 EVK. Tera Term is a terminal emulator (communication program) that supports multiple communication including serial port connections. 1. Download Tera Term from https://ttssh2.osdn.jp. 2. Run the teraterm-x.yy.exe executable and follow the installation wizard. To make sure that the communication between the DA16200 EVK and the host PC is properly established, verify the UART connection between the two nodes: 1. Connect the DA16200 EVK to the PC via USB cable to USB Port. 2. Check if the host discovered two serial ports as in Figure 23. The second is connected to UART (see Section 7.1). 3. Open Tera Term from the Windows Start menu. 4. In the Tera Term: New connection dialog box: a. Select Serial. b. Select the COM Port to use. c. Click OK. 5. Select Setup > Serial Port and configure your UART port with the parameters as in Figure 24. 6. Open the Lowest COM port number assigned to the DA16200 EVK (see Figure 23) to figure out which port number is used by Windows by running the Device Manager. Make sure that the UART is configured as in Figure 24.

User Manual Revision 1.0 31-Mar-2021

CFR0012 16 of 27 © 2021 Dialog Semiconductor

UM-WI-050

DA16200 FreeRTOS SDK Startup Guide for Windows

Figure 24: Serial Port Setup

7.3 Bootloader Image is also known as the second bootloader, which is the first thing loaded into memory for a factory-created DUT (for example with an empty flash). Note that this image has SFDP information, which is important sflash type information, so always load this image before other images are loaded. If you get a new SDK, then always load the first. Procedure 1. Power on the DA16200 board. 2. At the [/DA16200] prompt, type reset to go to the Mask ROM prompt [MROM]. See Figure 25.

Figure 25: Mask ROM

3. At the [MROM] prompt, type loady boot or loady 0. See Figure 26.

Figure 26: Bootloader Prompt on Command Window

4. To select the image file for the Bootloader, from menu choose File > Transfer > YMODEM > Send. See Figure 27. ○ For example: DA16200_FBOOT_GEN01-01-XXXX-000000_ W25Q32JW.img ○ The result is printed at the end of the transfer Please ignore any messages like “err:..”

User Manual Revision 1.0 31-Mar-2021

CFR0012 17 of 27 © 2021 Dialog Semiconductor

UM-WI-050

DA16200 FreeRTOS SDK Startup Guide for Windows

Figure 27: Load Image File

7.4 Main RTOS Image This

contains RTOS, Wi-Fi libraries, and system/user applications. Procedure 1. At the [MROM] prompt, type loady 23000. See Figure 28.

Figure 28: Main Image Prompt on Command Window

2. To select the

file, from menu choose File > Transfer > YMODEM > Send. See Figure 29. ○ For example: DA16200_FRTOS_GEN01-01-XXXX-000000.img

Figure 29: Load Image File

User Manual Revision 1.0 31-Mar-2021

CFR0012 18 of 27 © 2021 Dialog Semiconductor

UM-WI-050

DA16200 FreeRTOS SDK Startup Guide for Windows

3. If the two images are loaded, then at the [MROM] prompt, type boot to boot your images. 4. Run factory reset as in Figure 30.

Figure 30: Factory Mode Prompt on Command Window

User Manual Revision 1.0 31-Mar-2021

CFR0012 19 of 27 © 2021 Dialog Semiconductor

UM-WI-050

DA16200 FreeRTOS SDK Startup Guide for Windows

8 Debugging with JTAG Using J-Link

8.1 Install J-Link Software 1. Download the installation file from the Segger website: https://www.segger.com/downloads/jlink/#J-LinkSoftwareAndDocumentationPack. 2. Select Download next to J-Link Software and Documentation pack for Windows.

Figure 31: Download J-Link Software

3. Install J-Link software.

Figure 32: Install J-Link Software

User Manual Revision 1.0 31-Mar-2021

CFR0012 20 of 27 © 2021 Dialog Semiconductor

UM-WI-050

DA16200 FreeRTOS SDK Startup Guide for Windows

8.2 Set Up J-Link Debugger

8.2.1 Connect J-Link The following section describes how to connect J-Link with DA16200 Module. There are two ways to connect J-Link Debugger: ● Use JTAG Socket Connect “J-Link 9-pin Cortex-M Adapter” to J-Link first, and then connect it to “JTAG socket” of DA16200 Board.

Figure 33. J-Link 9-pin Cortex-M Adapter

● Use DA16200 Module External Connector “DA16200 Module External CONNECTOR (J3, J4)” and “J-LINK 20Pin” can be used by jumping as follows.

Table 1: DA16200 Module External Connector Mapping for J-LINK 20Pin DA16200 (J3, J4) J-LINK VBAT (J4_3) 5 V Supply (19) VDD_DIO1 (J4_4) VTref (1) GND (J3_18) GND (8) JTAG_TMS (J3_4) SWDIO (7) JTAG_TCLK (J3_5) SWCLK (9) UART0_TXD_MA (J3_9) J-Link Tx (5) UART0_RXD_MA (J3_10) J-Link Rx (17)

User Manual Revision 1.0 31-Mar-2021

CFR0012 21 of 27 © 2021 Dialog Semiconductor

UM-WI-050

DA16200 FreeRTOS SDK Startup Guide for Windows

Figure 34: J-Link 20Pin

Figure 35: DA16200 Module External Connector

User Manual Revision 1.0 31-Mar-2021

CFR0012 22 of 27 © 2021 Dialog Semiconductor

UM-WI-050

DA16200 FreeRTOS SDK Startup Guide for Windows

8.2.2 Import Launch Configurations The following steps describe how to import GDB SEGGER J-Link Debugging Configurations. 1. In Eclipse, select File > Import > Run/Debug > Launch Configurations, and then click Next.

Figure 36. Import Launch Configurations

2. In the next window, select the Config folder in From Directory: {SDK source location}\build\j- link_cfg, select all “DA16x_Main_Debug” and click Finish. They are added to J-Link Configurations.

Figure 37. Import Debug Configurations

User Manual Revision 1.0 31-Mar-2021

CFR0012 23 of 27 © 2021 Dialog Semiconductor

UM-WI-050

DA16200 FreeRTOS SDK Startup Guide for Windows

8.3 Run Debug Mode 1. In Project Explorer, right-click main and select Debug As > Debug Configurations.

Figure 38. Run Debug Mode

2. Select one of three Debug modes (reboot, attach, attach with RTOS info) from GDB SEGGER J- Link Debugging, and then click Debug.

Figure 39. Select Debug Mode

User Manual Revision 1.0 31-Mar-2021

CFR0012 24 of 27 © 2021 Dialog Semiconductor

UM-WI-050

DA16200 FreeRTOS SDK Startup Guide for Windows

8.4 Debugging There are three types of debugging methods: "reboot", "attach" and "attach with RTOS info". Currently, the function to download SFLASH is not provided, so load the compiled image into SFLASH before debugging.

8.4.1 DA16x_Main_Debug (Reboot) In this mode, the “debugger” is executed after rebooting the image stored in SFLASH. In this mode, “watchdog” is turned off and “wdt_kicking thread” is not executed.

8.4.2 DA16x_Main_Debug (Attach) This mode executes the “debugger” in attach mode without rebooting the image currently stored in SFLASH. Before using this mode, first turn off the “watchdog” using the “sys.wdog off” command as follows:

[ /DA16200] # sys.wdog off WATCHDOG off

8.4.3 DA16x_Main_Debug (attach_with_rtos_info) Same as attach mode but displays “thread” information in debugger suspend state.

User Manual Revision 1.0 31-Mar-2021

CFR0012 25 of 27 © 2021 Dialog Semiconductor

UM-WI-050

DA16200 FreeRTOS SDK Startup Guide for Windows

Revision History

Revision Date Description 1.0 31-Mar-2021 First Release.

User Manual Revision 1.0 31-Mar-2021

CFR0012 26 of 27 © 2021 Dialog Semiconductor

UM-WI-050

DA16200 FreeRTOS SDK Startup Guide for Windows

Status Definitions

Status Definition

The content of this document is under review and subject to formal approval, which may result in modifications or DRAFT additions. APPROVED The content of this document has been approved for publication. or unmarked

Disclaimer

Unless otherwise agreed in writing, the Dialog Semiconductor products (and any associated software) referred to in this document are not designed, authorized or warranted to be suitable for use in life support, life-critical or safety-critical systems or equipment, nor in applications where failure or malfunction of a Dialog Semiconductor product (or associated software) can reasonably be expected to result in personal injury, death or severe property or environmental damage. Dialog Semiconductor and its suppliers accept no liability for inclusion and/or use of Dialog Semiconductor products (and any associated software) in such equipment or applications and therefore such inclusion and/or use is at the customer’s own risk.

Information in this document is believed to be accurate and reliable. However, Dialog Semiconductor does not give any representations or warranties, express or implied, as to the accuracy or completeness of such information. Dialog Semiconductor furthermore takes no responsibility whatsoever for the content in this document if provided by any information source outside of Dialog Semiconductor.

Dialog Semiconductor reserves the right to change without notice the information published in this document, including, without limitation, the specification and the design of the related semiconductor products, software and applications. Notwithstanding the foregoing, for any automotive grade version of the device, Dialog Semiconductor reserves the right to change the information published in this document, including, without limitation, the specification and the design of the related semiconductor products, software and applications, in accordance with its standard automotive change notification process.

Applications, software, and semiconductor products described in this document are for illustrative purposes only. Dialog Semiconductor makes no representation or warranty that such applications, software and semiconductor products will be suitable for the specified use without further testing or modification. Unless otherwise agreed in writing, such testing or modification is the sole responsibility of the customer and Dialog Semiconductor excludes all liability in this respect.

Nothing in this document may be construed as a license for customer to use the Dialog Semiconductor products, software and applications referred to in this document. Such license must be separately sought by customer with Dialog Semiconductor.

All use of Dialog Semiconductor products, software and applications referred to in this document is subject to Dialog Semiconductor’s Standard Terms and Conditions of Sale, available on the company website (www.dialog-semiconductor.com) unless otherwise stated.

Dialog, Dialog Semiconductor and the Dialog logo are trademarks of Dialog Semiconductor Plc or its subsidiaries. All other product or service names and marks are the property of their respective owners.

© 2021 Dialog Semiconductor. All rights reserved.

RoHS Compliance

Dialog Semiconductor’s suppliers certify that its products are in compliance with the requirements of Directive 2011/65/EU of the European Parliament on the restriction of the use of certain hazardous substances in electrical and electronic equipment. RoHS certificates from our suppliers are available on request.

Contacting Dialog Semiconductor

United Kingdom (Headquarters) North America Hong Kong China (Shenzhen) Dialog Semiconductor (UK) LTD Dialog Semiconductor Inc. Dialog Semiconductor Hong Kong Dialog Semiconductor China Phone: +44 1793 757700 Phone: +1 408 845 8500 Phone: +852 2607 4271 Phone: +86 755 2981 3669 Germany Japan Korea China (Shanghai) Dialog Semiconductor GmbH Dialog Semiconductor K. K. Dialog Semiconductor Korea Dialog Semiconductor China Phone: +49 7021 805-0 Phone: +81 3 5769 5100 Phone: +82 2 3469 8200 Phone: +86 21 5424 9058 The Netherlands Taiwan Dialog Semiconductor B.V. Dialog Semiconductor Taiwan Phone: +31 73 640 8822 Phone: +886 281 786 222 Email: Web site: [email protected] www.dialog-semiconductor.com

User Manual Revision 1.0 31-Mar-2021

CFR0012 27 of 27 © 2021 Dialog Semiconductor