50
FINAL User Manual DA16200 AT Command UM-WI-003 Abstract This document describes the use of AT commands to configure the DA16200.

DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

  • Upload
    others

  • View
    10

  • Download
    0

Embed Size (px)

Citation preview

Page 1: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

FINAL

User Manual

DA16200 AT Command

UM-WI-003

Abstract

This document describes the use of AT commands to configure the DA16200.

Page 2: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 2 of 50 © 2020 Dialog Semiconductor

Contents

Abstract ................................................................................................................................................ 1

Figures .................................................................................................................................................. 4

Tables ................................................................................................................................................... 4

1 Introduction.................................................................................................................................... 5

2 AT Command Development Environment Configuration ......................................................... 5

2.1 How to Connect the DA16200 Board .................................................................................... 5

2.2 Configure the Serial Port for UART ....................................................................................... 6

2.3 Configuration for MCU Wake-Up (Optional) ......................................................................... 7

3 AT Command Format .................................................................................................................... 9

3.1 Basic Command Format ....................................................................................................... 9

3.2 Extended Command Format ................................................................................................. 9

3.3 Response Format .................................................................................................................. 9

4 Basic Function Commands ........................................................................................................ 11

5 Network Function Commands ................................................................................................... 14

6 Wi-Fi Function Commands ......................................................................................................... 17

7 Advanced Function Commands ................................................................................................ 23

7.1 MQTT Commands ............................................................................................................... 23

7.1.1 MQTT Client Connection Example ...................................................................... 25

7.1.2 MQTT TLS Connection Example ......................................................................... 25

7.1.3 MQTT Example with DPM ................................................................................... 26

7.2 OTA Commands ................................................................................................................. 28

7.2.1 OTA Download Example ..................................................................................... 29

7.2.2 OTA Download Progress Example ...................................................................... 29

7.2.3 OTA Renew Example .......................................................................................... 29

8 Transfer Function Commands ................................................................................................... 31

8.1 Socket Commands .............................................................................................................. 31

8.2 Data Transfer Commands ................................................................................................... 33

8.3 Data Transfer with DPM ...................................................................................................... 34

8.3.1 TCP Server .......................................................................................................... 34

8.3.2 TCP Client ........................................................................................................... 35

8.3.3 UDP Session ....................................................................................................... 35

9 RF Test Function Commands .................................................................................................... 36

10 System & Peripheral Function Commands .............................................................................. 39

10.1 SPI Commands ................................................................................................................... 39

10.2 OTP Commands ................................................................................................................. 39

10.3 XTAL Commands ................................................................................................................ 41

10.4 Flash Dump Commands ..................................................................................................... 41

10.5 GPIO Commands ................................................................................................................ 42

10.6 Sleep Commands ................................................................................................................ 43

Page 3: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 3 of 50 © 2020 Dialog Semiconductor

11 Examples ...................................................................................................................................... 44

11.1 Data Transfer Test .............................................................................................................. 44

11.1.1 TCP Server Socket Test ...................................................................................... 44

11.1.2 TCP Client Socket Test ....................................................................................... 45

11.1.3 UDP Socket Test ................................................................................................. 46

Appendix ............................................................................................................................................ 48

Revision History ................................................................................................................................ 49

Page 4: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 4 of 50 © 2020 Dialog Semiconductor

Figures

Figure 1: AT Command Development Environment ............................................................................. 5 Figure 2: Check COM ports on Device Manager .................................................................................. 6 Figure 3: Serial Port Configuration ........................................................................................................ 7 Figure 4: GPIO Wakeup ........................................................................................................................ 8 Figure 5: Example Sequence to Initiate MQTT Protocol with DPM .................................................... 26 Figure 6: Procedure to Send MQTT Messages .................................................................................. 27 Figure 7: Procedure to Process MQTT Messages .............................................................................. 28 Figure 8: IO Ninja - TCP Client Socket Setting ................................................................................... 45 Figure 9: IO Ninja - TCP Server Socket Setting .................................................................................. 46 Figure 10: IO Ninja - UDP Socket Setting ........................................................................................... 47

Tables

Table 1: Error response codes ............................................................................................................ 10 Table 2: Basic Function Command List ............................................................................................... 11 Table 3: Initiation Response List ......................................................................................................... 13 Table 4: Network Function Command List .......................................................................................... 14 Table 5: Certificate Command ............................................................................................................. 16 Table 6: Wi-Fi Function Command List ............................................................................................... 17 Table 7: Wi-Fi Function Response List ............................................................................................... 22 Table 8: MQTT Command List ............................................................................................................ 23 Table 9: MQTT Response List ............................................................................................................ 25 Table 10: OTA Command List ............................................................................................................. 28 Table 11: OTA Response List ............................................................................................................. 29 Table 12: OTA Response Code List .................................................................................................... 29 Table 13: Socket Command List ......................................................................................................... 31 Table 14: Socket Connection Response List ...................................................................................... 32 Table 15: Data Transmission Command ............................................................................................. 33 Table 16: Data Reception Responses ................................................................................................. 33 Table 17: RF Test Command List ....................................................................................................... 36 Table 18: SPI Command List .............................................................................................................. 39 Table 19: OTP Command List ............................................................................................................. 39 Table 20: OTP Memory Address for writing MAC address ................................................................. 40 Table 21: Size of memory by XTAL offset ........................................................................................... 40 Table 22: XTAL Command List ........................................................................................................... 41 Table 23: Flash Dump Command List ................................................................................................. 41 Table 24: GPIO Command List ........................................................................................................... 42 Table 25: Sleep Command List ........................................................................................................... 43

Page 5: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 5 of 50 © 2020 Dialog Semiconductor

1 Introduction

The DA16200 AT Command is a command to control smart modem products of Hayes Microcomputer and other compatible modems. AT Command is applied to almost all standardized modems that are available at present. The original title is 'Hayes Command' and is also called 'AT Command' since the command begins mostly with AT. AT is an abbreviation of 'attention', which means to take note of or fix one's sight upon something. An example of an AT Command is ATZ. With

this command the modem becomes initialized and returns to a state with no command input.

Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after 'AT,' even more than one command in a row.

Most of the Hayes Modem Commands have a command right before 'AT' except '+++', which is an independently used command. You may put a series of commands together whether they contain a capital letter, a small letter, or a blank.

2 AT Command Development Environment Configuration

2.1 How to Connect the DA16200 Board

This section describes the installation procedure for the drivers, the configuration of the serial port, and all necessary steps to set-up and check the connection with the PC.

Figure 1: AT Command Development Environment

On first connection to a host PC with Microsoft Windows as operating system, the system will detect several devices and will automatically install all necessary drivers. If the driver is not automatically installed, then get the driver from the following url: 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 Figure 2) provides a UART interface for debugging or firmware download between the PC and the DA161200. The second (higher number, COM36 in Figure 2) is used for AT COMMAND as shown in Figure 2.

Page 6: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 6 of 50 © 2020 Dialog Semiconductor

Figure 2: Check COM ports on Device Manager

2.2 Configure the Serial Port for UART

On a Windows Host, the utility Tera Term is used to connect to the DA16200 EVK. Tera Term is a free 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.

3. Follow the installation wizard.

To make sure that the communication between the DA16200 EVK and the host PC is established correctly, check the UART connection between the two nodes. Do the following steps:

1. Use a USB cable to connect the DA16200 EVK to the PC.

2. Make sure that the PC discovered the two serial ports in Windows Device Manager as shown in Figure 2. The higher COM port number is connected to UART1.

3. Open Tera Term from the Windows Start menu.

4. In the Tera Term: New connection dialog:

a. Select Serial.

b. Select the COM Port to use.

c. Click OK.

5. Select Setup > Serial Port and configure the UART port with the parameters as shown in Figure 3. Select the higher COM port number as discovered in step 2.

Page 7: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 7 of 50 © 2020 Dialog Semiconductor

Figure 3: Serial Port Configuration

2.3 Configuration for MCU Wake-Up (Optional)

Depending on the application, an MCU may want to be in sleep state while the DA16200 is in sleep mode, and wake up when the DA16200 wakes up from DPM Sleep.

To use the MCU wake-up feature, connect pin GPIO_11 of the DA16200 to an MCU PIN that is used for wake-up. Then, when the DA16200 wakes up, GPIO_11 is put in output mode and set to High (Active High). The wake-up PIN of MCU should be configured to detect the rising edge of GPIO_11 for wake-up.

Page 8: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 8 of 50 © 2020 Dialog Semiconductor

Figure 4: GPIO Wakeup

Page 9: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 9 of 50 © 2020 Dialog Semiconductor

3 AT Command Format

3.1 Basic Command Format

● Write CMD

Basic command execution.

ATXX

For example: ATZ

OK

● Read CMD

Get the parameter values of the command.

ATXX=?

For example: ATQ=?

Display result on

OK

3.2 Extended Command Format

● Write CMD

Extended command execution.

AT+XXX=<param1>,<param2>,<param3>,<param4>…<paramN>

For example: AT+NWIP=0,172.16.0.100,255.255.255.0,172.16.0.1

OK

If comma(s) or single-quote(s) is(are) used in the parameter, then a single quote is required before and after.

For example: AT+WFJAP='ssid,comma'single-quote',3,1,'password'

OK

Note: The use of the phrase ', (single quote and comma next to each other) in the parameter is prohibited.

● Read CMD

Get the parameter values of the command.

AT+XXX=?

For example: AT+NWIP=?

+ANIP:172.16.0.17,255.255.255.0,172.16.0.1

OK

3.3 Response Format

● Startup response

The AT command response when DA16200 is reset.

<CR><LF>+INIT:DONE,<mode><CR><LF>

Page 10: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 10 of 50 © 2020 Dialog Semiconductor

The AT command response when DA16200 wakes up from DPM sleep.

● <CR><LF>+INIT:WAKEUP,<type><CR><LF>Basic response

Basic response gives the command result and is accompanied by a carriage return and a line feed.

■ Normal response

<CR><LF>OK<CR><LF>

■ Error response

<CR><LF>ERROR:<error code><CR><LF>

● Extended response

Extended response gives the command setting values and is followed by basic response.

<CR><LF>+XXX:[value1],[value2],…

<CR><LF>OK<CR><LF>

● Error response codes

Table 1: Error response codes

Code Description

-1 Unknown command

-2 Insufficient parameter

-3 Too many parameters

-4 Wrong parameter value

-5 Unsupported function

-6 Not connected to an AP

-7 No result

-8 Response buffer overflow

-9 Function is not configured

-10 Command timeout

-11 NVRAM write failure

-12 Retention memory write failure

-99 Unknown error

Page 11: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 11 of 50 © 2020 Dialog Semiconductor

4 Basic Function Commands

Table 2: Basic Function Command List

Command Parameters Description

? (none) Same with “Help” command.

help (none) Show AT command usage.

AT+ (none) AT command list.

ATZ (none) Initialize AT command.

ATF (none) DA16200 factory reset.

ATE (none) ECHO On/Off.

ATQ (none) Set displaying result On/Off.

AT+RESTART (none) System restart.

AT+RESET (none) System reset. Go to the boot mode ([MROM] prompt).

AT+VER (none) Get version info.

Response: +VER:<ramlib version>,<ptim version>,<main version>

AT+TIME

<date>,<time> Set the current time.

<date>: yyyy-mm-dd

<time>: hh:mm:ss

Response: OK or ERROR

For example: AT+TIME=2016-12-14,11:40:00

? Get the current time.

Response: +TIME:<yyyy-mm-dd> <hh:mm:ss>

AT+RLT (none) Get system running time

Response: +RLT:<days>,<hh:mm.ss>

AT+TZONE <sec> GMT Time zone setting (-43200 ~ 43200)

<sec>: Time zone setting parameter

Response: OK or ERROR

For example: AT+TZONE=32400 (+09:00; KR)

? Get GMT Time zone parameter

Response: +TZONE:<sec>

AT+DEFAP (none) Factory reset and setup Soft-AP mode with default configuration. To initialize the Soft-AP interface, the system will reboot automatically.

● SSID: DA16200_xxxxxx (using a part of the MAC addr)

● Authentication: WPA2/CCMP

● IP address: 10.0.0.1

● DHCP server: Enabled

● …

Response: OK or ERROR (reboot)

Page 12: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 12 of 50 © 2020 Dialog Semiconductor

Command Parameters Description

AT+BIDX <idx> Set Boot index.

<idx>: Boot index (0 or 1)

Response: OK or ERROR

For example: AT+BIDX=1

? Get the current Boot index.

Response: +BIDX:<0|1>

AT+DPM <dpm> Set DPM On/Off. To change the use of DPM, the system will reboot automatically.

<dpm>: 0 (Off), 1 (On)

Response: OK or ERROR

For example: AT+DPM=1

? Get the current DPM setting.

Response: +DPM:<0|1>

AT+DPMKA <period> Set DPM keepalive period.

<period>: keepalive period (millisecond, 0 ~ 600000)

Response: OK or ERROR

For example: AT+DPMKA=30000

AT+

DPMTIMWU

<count> Set DPM TIM wakeup count.

<count>: TIM wakeup count (1 ~ 65535)

Response: OK or ERROR

For example: AT+DPMTIMWU=10

AT+

DPMUSERWU

<time> Set DPM user wakeup time.

<time>: user wakeup period (second, 0 ~ 86400)

Response: OK or ERROR

For example: AT+DPMUSERWU=3600

AT+

CLRDPMSLPEXT

(none) Set the user application not to enter DPM sleep in case of external wakeup. The AT command host system should execute this command within 200 ms after waking up the DA16200 with the external wakeup pin, otherwise the DA16200 will go into DPM sleep.

Response: OK or ERROR

AT+

SETDPMSLPEXT

(none) Set the user application ready to enter DPM sleep in case of external wakeup. After an external wakeup pin wakes up the DA16200, the AT command host system should execute this command after the jobs are finished.

Response: OK or ERROR

AT+ SETDPMSLP2EXT

(none) Set the user application ready to enter DPM Sleep 2 mode in case of external wakeup. After an external wakeup pin wakes up DA16200, the AT command host system should execute this command after the jobs are finished.

Response: OK or ERROR

AT+MCUWUDONE (none) Notify that the MCU wakes up completely. After this command is received, DA16200 starts to send messages to the MCU. (i.e. MCU should send this command immediately after executing "External wake-up".)

Response: OK or ERROR

Page 13: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 13 of 50 © 2020 Dialog Semiconductor

Table 3: Initiation Response List

Response Parameters Description

+INIT DONE,<mode> DA16200 boot is complete.

<mode>: 0 (STA), 1 (Soft-AP)

For example: +INIT:DONE,0

WAKEUP,<type> DA16200 wake-up is complete from DPM sleep state.

<type> wake-up type

- UC: Unicast packet received

- NOBCN: No beacon from the connected AP

- DEAUTH: Disconnected from the connected AP

- EXT: External wake-up

- RTC: by a timer registered

For example: +INIT:WAKEUP,UC

Page 14: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 14 of 50 © 2020 Dialog Semiconductor

5 Network Function Commands

Table 4: Network Function Command List

Command Parameters Description

AT+NWIP <iface>,<ip_addr>,

<netmask>,<gw>

Set IP address.

<iface>: WLAN interface. 0 (WLAN0, STA), 1 (WLAN1, Soft-AP)

<ip_addr>: IP Address

<netmask>: Subnet mask

<gw>: Gateway

Response: OK or ERROR

For example: AT+NWIP=0,192.168.0.100,255.255.255.0,192.168.0.1

? Get IP address of the current WLAN interface.

Response: +NWIP: <iface>,<ip_addr>,<netmask>,<gw> (none)

AT+NWDNS <dns_ip> Set DNS server IP address of STA interface.

<dns_ip>: DNS server IP address

Response: OK or ERROR

For example: AT+NWDNS=8.8.8.8

? Get DNS server IP address of STA interface.

Response: +NWDNS:<dns_ip> (none)

AT+NWHOST <name> Get the host IP address by name.

<name>: Domain name

Response: +NWHOST:<ip>

For example: AT+NWHOST=https://www.dialog-semiconductor.com/

AT+NWPING <iface>,<dst_ip>,

<count>

Ping test.

<iface>: WLAN interface. 0 (WLAN0), 1 (WLAN1)

<dst_ip>: Target IP address

<count>: The number of ICMP message transmissions

Response: +NWPING:<sent_count>,<recv_count>,

<avg_time>,<min_time>,<max_time>

For example: AT+NWPING=0,192.168.0.1,4

AT+NWDHC <dhcpc> Start / Stop DHCP client

<dhcpc>: 0 (stop), 1 (start)

Response: OK or ERROR

For example: AT+NWDHC=1

? Get DHCP client status.

Response: +NWDHC:<dhcpc> (none)

AT+NWDHR <start_ip>,<end_ip> Set IP address range of DHCP server.

<start_ip>: Starting IP address assigned by DHCP server

<end_ip>: Ending IP address assigned by DHCP server

Response: OK or ERROR

For example: AT+NWDHR=10.0.0.2,10.0.0.11

? Get IP address range of DHCP server.

Page 15: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 15 of 50 © 2020 Dialog Semiconductor

Command Parameters Description

(none) Response: +NWDHR:<start_ip>,<end_ip>

AT+NWDHLT <lease_time> Set IP lease time (in seconds) of DHCP server.

<lease_time>: IP lease time

Response: OK or ERROR

For example: AT+NWDHLT=1800

? Get IP lease time of DHCP server.

Response: +NWDHLT:<lease_time> (none)

AT+NWDHDNS <dns_ip> Set DNS server IP address of DHCP server.

<dns_ip>: DNS server IP address

Response: OK or ERROR

For example: AT+NWDHDNS=8.8.8.8

? Get DNS server IP address of DHCP server.

Response: +NWDHDNS:<dns_ip> (none)

AT+NWDHS <dhcpd> Start / Stop DHCP server.

<dhcpd>: 0 (stop), 1 (start)

Response: OK or ERROR

For example: AT+NWDHS=1

<dhcpd>,

<start_ip>,<end_ip>,

<lease_time>,

<dns_ip>

Start DHCP server with options.

<dhcpd>: 1 (start)

<start_ip>: Starting IP address for DHCP client

<end_ip>: Ending IP address for DHCP client

<lease_time>: IP lease time (optional, in second, default is 1800)

<dns_ip>: DNS server IP address (optional)

Response: OK or ERROR

For example: AT+NWDHS=1,10.0.0.2,10.0.0.10,1800,168.126.63.1

? Get DHCP client status.

Response: +NWDHS:<dhcpd> (none)

AT+NWSNS <server_ip> Set SNTP server IP address.

<server_ip>: SNTP server IP address

Response: OK or ERROR

For example: AT+NWSNS=8.8.8.8

? Get SNTP server IP address.

Response: +NWSNS:<sntp> (none)

AT+NWSNUP <period> Set SNTP client update period (in seconds)

<period>: SNTP client update period

Response: OK or ERROR

For example: AT+NWSNUP=86400

? Get SNTP client update period.

Response: +NWSNUP:<period> (none)

Page 16: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 16 of 50 © 2020 Dialog Semiconductor

Command Parameters Description

AT+NWSNTP <sntp> Start / Stop SNTP

<sntp>: 0 (stop), 1 (start)

Response: OK or ERROR

For example: AT+NWSNTP=0

<sntp>,

<server_ip>,

<period>

Start SNTP with options.

<sntp>: 1 (start)

<server_ip>: SNTP server IP address (or domain)

<period>: SNTP client update period (optional, second, default is 86400)

Response: OK or ERROR

For example: AT+NWSNTP=1,pool.ntp.org,86400

? Get SNTP status.

Response: +NWSNTP:<sntp> (none)

AT+NWTLSV <ver> Set TLS version.

<ver>: TLS Version. 0 (TLSv 1.0), 1 (TLSv1.1), 2 (TLSv1.2)

Response: OK or ERROR

For example: AT+NWDTLS=0

? Get the current TLS version

Response: +NWTLSV=<ver> (none)

AT+NWCCRT (none) Check if certificates exist.

(Root CA (bit 2) / Cert (bit 1) / Key (bit 0))

For example: if DA16200 has the Root CA and Cert, return value is 6.

Response: +VER:<cert>

AT+NWDCRT (none) Delete all TLS certificates including private key.

Response: OK or ERROR

Table 5: Certificate Command

Escape

Sequence

Parameters Description

<ESC>C <cert_id>,<content><ETX> Store certificate or private key.

Max length is 2048.

<cert_id>: Certificate ID. 0 (Root CA), 1 (Client Certificate), 2 (Private Key)

<content>: Certificate data.

<ETX>: Indication of the end of content (Ctrl+C, 0x03).

Response: OK or ERROR

For example:

<ESC>C1,----- BEGIN CERTIFICATE -----MIIodknvfano923nf/

...<ETX>

Page 17: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 17 of 50 © 2020 Dialog Semiconductor

6 Wi-Fi Function Commands

Table 6: Wi-Fi Function Command List

Command Parameters Description

AT+WFMODE <mode> Set Wi-Fi mode.

<mode>: 0 (STA), 1 (Soft-AP)

Response: OK or ERROR

For example: AT+WFMODE=1

? Get the current Wi-Fi mode.

Response: +WFMODE:<mode> (none)

AT+WFMAC <mac> Write user MAC address in the NVRAM.

The last digit should be an even number.

Response: OK or ERROR

For example: AT+WFMAC=EC:9F:0D:90:00:48

? Get the current MAC address of the activated WLAN interface.

DA16200 provides 3 types of MAC address (OTP MAC address, user MAC address, and spoofing MAC address). The priority is OTP < User < Spoofing.

Response: +WFMAC:<mac>

(none)

AT+WFSPF <mac> Write spoofing MAC address in the NVRAM.

The last digit should be an even number.

Response: OK or ERROR

For example: AT+WFSPF=EC:9F:0D:90:00:48

AT+WFOTP <mac> Write MAC address in the OTP memory. An old MAC address in the OTP will be invalidated if it exists. (There are 4 mac address slots available in OTP. So there is the possibility to write only 4 MAC addresses in total at production.)

Response: OK or ERROR

For example: AT+WFOTP=EC:9F:0D:90:00:48

The last hex of <mac> should be an even number.

The MAC address written in the OTP is used as WLAN0 MAC address and then WLAN’s MAC+1 will be used as WLAN1 MAC address.

AT+WFSTAT (none) Get Wi-Fi configuration.

Response: +WFSTAT:<Wi-Fi interface><var>…

AT+WFPBC (none) Run WPS PBC method.

Response: OK or ERROR

AT+WFPIN <pin> Run WPS PIN method.

<pin>: PIN (8 digits)

(none): Generate a random PIN

Response: +WFPIN:<pin>

OK or ERROR

For example: AT+WFPIN

AT+WFPIN=42170518

(none)

Page 18: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 18 of 50 © 2020 Dialog Semiconductor

Command Parameters Description

? Get the current PIN.

Response: +WFPIN:<pin>

AT+WFCWPS (none) Cancel WPS (both PBC and PIN).

Response: OK or ERROR

AT+WFCC <code> Set country code.

<code>: Country code (defined by ISO 3166-1 alpha-2 standard) (e.g. KR, US, JP, CH …)

Response: OK or ERROR

For example: AT+WFCC=KR

? Get the current country code.

Response: AT+WFCC=<code> (none)

AT+WFSCAN (none) Scan APs.

Response: +WFSCAN:<bssid><\t><frequency><\t><signal strength><\t><flag><\t><ssid><LF>…

AT+WFJAP <ssid>,<sec>

(sec=0)

Connect to an AP.

<ssid>: AP SSID

<sec>: Security protocol. 0 (OPEN), 1 (WEP), 2 (WPA), 3 (WPA2), 4 (WPA+WPA2)

<idx>: Key index for WEP. 0~3

<enc>: Encryption. 0 (TKIP), 1 (AES), 2 (TKIP+AES)

<key>: Passphrase

Response: OK or ERROR

For example: AT+WFJAP=DA16200_OPEN,0

AT+WFJAP=DA16200_WEP,1,0,12345

AT+WFJAP=DA16200_WPA2,3,0,1234qwer

AT+WFJAP='SSID,COMMA',3,1,'pass'phrase'

<ssid>,<sec>,

<idx>,<key>

(sec=1)

<ssid>,<sec>,

<enc>,<key>

(sec=2|3|4)

? Get the current AP information.

Response: +WFJAP:'<ssid>',0

+WFJAP:'<ssid>',1,<idx>,'<key>'

+WFJAP:'<ssid>',<2|3|4>,<enc>,'<key>'

(none)

AT+WFJAPA <ssid>,<key> Connect to an AP.

If <key> exists, then security protocol is WPA+WPA2 and encryption is TKIP+AES.

if <key> is omitted, then security protocol is OPEN.

<ssid>: AP SSID

<key>: Passphrase

Response: OK or ERROR

For example: AT+WFJAPA=DA16200_OPEN

AT+WFJAPA=DA16200_WPA,12345678

AT+WFJAPA='SSID,COMMA','pass'phrase'

? Get the current AP information. (SSID & Passphrase only.)

Response: +WFJAPA:'<ssid>'

+WFJAPA:'<ssid>','<key>' (none)

Page 19: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 19 of 50 © 2020 Dialog Semiconductor

Command Parameters Description

AT+WFCAP (none) Connect to an AP with the current WLAN0 interface configuration.

Response: OK or ERROR

AT+WFQAP (none) Disconnect from the currently associated AP.

Response: OK or ERROR

AT+WFSTA (none) Check Wi-Fi connection.

Response: +WFSTA:<status>

<status> 1 (Connected), 0 (disconnected)

AT+WFROAP <roam> Operate STA roaming.

<roam>: 1 (run), 0 (stop)

Response: OK or ERROR

For example: AT+WFROAP=1

? Get the roaming status.

Response: +WFROAP:<roam> (none)

AT+WFROTH <rssi> Set STA roaming threshold.

<rssi>: Roaming threshold value (0 ~ -95 dBm)

Response: OK or ERROR

For example: AT+WFROTH=-80

? Get the STA roaming threshold.

Response: +WFROTH:<rssi> (none)

AT+WFDIS <disabled> Set the Wi-Fi profile unused. If set to 1, DA16200 will not start to connect to the configured AP when rebooting.

<disabled >: 1 (Unused), 0 (Used)

Response: OK or ERROR

For example: AT+WFDIS=1

? Get the status of Wi-Fi profile

Response: +WFDIS:<disabled> (none)

AT+WFENTAP <ssid>,<wpa>,<enc>,

<phase1>,<phase2>

Set AP information for WPA Enterprise (EAP).

<ssid>: AP SSID

<wpa>: Authentication. 0 (WPA), 1 (WPA2), 2 (WPA+WPA2)

<enc>: Encryption. 0 (TKIP), 1 (AES), 2 (TKIP+AES)

<phase1>: EAP Phase 1 Type. 0 (PEAP), 1 (TTLS), 2 (FAST), 3 (TLS)

<phase2>: (Optional) EAP Phase 2 Type. 0 (MSCHAPV2), 1 (GTC)

Response: OK or ERROR

For example: AT+WFENTAP=DA16200_ENT_AP,1,1,0,0

AT+WFENTAP=DA16200_ENT_AP,2,2,3

? Get the current AP information for WPA Enterprise (EAP).

Response: +WFENTAP=<ssid>,<wpa>,<enc>,<phase1>,<phase2>

+WFENTAP=<ssid>,<wpa>,<enc>,3 (EAP-TLS)

(none)

Page 20: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 20 of 50 © 2020 Dialog Semiconductor

Command Parameters Description

AT+WFENTLI <id>,<pw> Set Enterprise log-in information.

<id>: ID

<pw>: (Optional) Password

Response: OK or ERROR

For example: AT+WFENTLI=peap,12345678

AT+WFENTLI=tls

? Get the current Enterprise log-in information.

Response: +WFENTLI=<id>,<pw>

+WFENTLI=<id> (EAP-TLS) (none)

AT+WFSAP <ssid>,<sec>,

<ch>,<code>

(sec=0)

Setup Soft-AP interface.

<ssid>: AP SSID

<sec>: Security protocol. 0 (OPEN), 2 (WPA), 3 (WPA2), 4 (WPA+WPA2)

<enc>: Encryption. 0 (TKIP), 1 (AES), 2 (TKIP+AES)

<key>: Passphrase

<ch>: (Optional) Operating channel (Default is 1 or uses the current channel if Soft-AP is operating)

<code>: (Optional) Country code. If exists, <ch> is essential.

Response: OK or ERROR

For example: AT+WFSAP=DA16200_OPEN,0

AT+WFSAP=DA16200_WPA2,3,1,12345678,1,KR

AT+WFSAP='DA16200,COMMA',3,1,'12345678',1,KR

<ssid>,<sec>,

<enc>,<key>,

<ch>,<code>

(sec=2|3|4)

? Get the Soft-AP interface configuration.

Response:

+WFSAP:'<ssid>',<auth>,<enc>,'<key>',<ch>,<code> (none)

AT+WFOAP (none) Operate Soft-AP interface.

Response: OK or ERROR

AT+WFTAP (none) Stop Soft-AP interface.

Response: OK or ERROR

AT+WFRAP (none) Restart Soft-AP interface.

Response: OK or ERROR

AT+WFLCST (none) Get connected station information.

Response: +WFLCST:<mac><LF><flags><LF><var>…

AT+WFAPWM <mode> Set IEEE 802.11 Wi-Fi mode of Soft-AP interface.

<mode>: 0 (B/G/N), 1 (G/N), 2 (B/G), 3 (N), 4 (G), 5 (B)

Response: OK or ERROR

For example: AT+WFAPWM=1

? Get IEEE 802.11 Wi-Fi mode of Soft-AP interface.

Response: +WFAPWM:<mode> (none)

AT+WFAPCH <ch> Set the operating channel number for the Soft-AP interface.

<ch>: Operating channel (0 ~ 14, 0 is auto)

Response: OK or ERROR

For example: AT+WFAPCH=6

? Get the operating channel number for the Soft-AP interface.

Page 21: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 21 of 50 © 2020 Dialog Semiconductor

Command Parameters Description

(none) Response: +WFAPCH:<ch>

AT+WFAPBI <interval> Set AP beacon interval.

<interval>: Beacon interval (ms)

Response: OK or ERROR

For example: AT+WFAPBI=100

? Get AP beacon interval.

Response: +WFAPBI:<interval> (none)

AT+WFAPUI <timeout> Set station disconnection timeout in Soft-AP mode.

<timeout>: Disconnection timeout (sec)

Response: OK or ERROR

For example: AT+WFAPUI=300

? Get station disconnection timeout in Soft-AP mode.

Response: +WFAPUI:<timeout> (none)

AT+WFAPRT <threshold> Set AP RTS threshold (octets)

<threshold>: RTS threshold (1 ~ 2347)

Response: OK or ERROR

For example: AT+WFAPRT=2347

? Get AP RTS threshold.

Response: +WFAPRT:<threshold> (none)

AT+WFAPDE <mac> Send de-authentication frame to the connected station.

<mac>: MAC address of the connected station

Response: OK or ERROR

For example: AT+WFAPDE=f8:a9:d0:49:b1:ba

AT+WFAPDI <mac> Send disassociation frame to the connected station.

<mac>: MAC address of the connected station

Response: OK or ERROR

For example: AT+WFAPDI=f8:a9:d0:49:b1:ba

AT+WFWMM <wmm> Set WMM (Wi-Fi Multimedia) on/off.

<wmm>: 0 (off), 1 (on)

Response: OK or ERROR

For example: AT+WFWMM=1

? Get WMM status.

Response: +WFWMM:<wmm> (none)

AT+WFWMP <wmmps> Set WMM-PS (WMM Power Save) on/off.

<wmmps>: 0 (off), 1 (on)

Response: OK or ERROR

For example: AT+WFWMP=0

? Get WMM-PS status.

Response: +WFWMP:<wmmps>

Page 22: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 22 of 50 © 2020 Dialog Semiconductor

Table 7: Wi-Fi Function Response List

Response Parameters Description

+WFJAP <result>,<ssid>,<ip> The result of AP connection in STA mode. (The result of AT+WFJAP or AT+WFJAPA or AT+WFCAP.)

<result>: 0 (failed), 1 (succeeded)

<ssid>: SSID of the AP when succeeded.

<ip>: IP address of the station when succeeded.

For example: +WFJAP:0

+WFJAP:1,'ap_test',192.168.0.10

+WFDAP <reserved> Disconnected from the AP.

<reserved>: 0

For example: +WFDAP:0

+WFCST <mac> A Wi-Fi station connected in Soft-AP mode.

<mac>: MAC address of the connected station

+WFDST <mac> A Wi-Fi station disconnected in Soft-AP mode.

<mac>: MAC address of the disconnected station

Page 23: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 23 of 50 © 2020 Dialog Semiconductor

7 Advanced Function Commands

7.1 MQTT Commands

Table 8: MQTT Command List

Command Parameters Description

AT+NWMQCL <mqtt_client> Enable/disable the MQTT client.

<mqtt_client>: 0 (disable), 1 (enable)

Response: OK or ERROR

For example: AT+NWMQCL=1

? Get the MQTT client status.

Response: +NWMQCL:<mqtt_client> (none)

AT+NWMQMSG <msg>,<topic> Publish an MQTT message.

<msg>: message to be published (max length: 256 bytes)

<topic>: MQTT topic (optional)

Response: OK or ERROR

For example: AT+NWMQMSG=Hello World

AT+NWMQMSG='{"name1":"val1","name2":"val2"}'

AT+NWMQBR <ip>,<port> Set the IP address and the port number of MQTT Broker.

<ip>: Broker’s IP address

<port>: Broker’s port number

Response: OK or ERROR

For example: AT+NWMQBR=192.168.0.15,1883

? Get the IP address and the port number of MQTT Broker.

Response: +NWMQBR:<ip>,<port> (none)

AT+NWMQQOS <qos> Set the MQTT QoS level.

<qos>: 0 (at most once), 1 (at least once), 2 (exactly once)

Response: OK or ERROR

For example: AT+NWMQQOS=1

? Get the MQTT QoS level.

Response: +NWMQQOS:<qos> (none)

AT+NWMQTLS <tls> Enable/disable MQTT TLS function.

<tls>: 1 (enable), 0 (disable)

Response: OK or ERROR

For example: AT+NWMQTLS=1

? Get MQTT TLS status.

Response: +NWMQTLS:<tls> (none)

AT+NWMQTS <num>,<topic#1>, <topic#2>,

Set the topic(s) of the MQTT subscriber.

<num>: the number of topics

<topic#n>: MQTT subscriber topic(s)

Response: OK or ERROR

For example: AT+NWMQTS=2,da16k,dialog

?

Page 24: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 24 of 50 © 2020 Dialog Semiconductor

Command Parameters Description

(none) Get the MQTT subscriber topic(s).

Response: +NWMQTS:<num>,<topic#1>,<topic#2>,…

AT+NWMQTP <topic> Set the topic(s) of the MQTT publisher.

<topic>: MQTT publisher topic

Response: OK or ERROR

For example: AT+NWMQTP=da16k

? Get the MQTT publisher topic.

Response: +NWMQTP:<topic> (none)

AT+NWMQPING <period> Set MQTT ping period.

<period>: Ping period (second)

Response: OK or ERROR

For example: AT+NWMQPING=600

? Get the current MQTT ping period.

Response: +NWMQPING:<period> (none)

AT+NWMQCID <client_id> Set MQTT Client ID

<client_id>: Client ID

Response: OK or ERROR

For example: AT+NWMQCID=MQTT_00F3

? Get the current MQTT Client ID

Response: +NWMQCID:<client_id> (none)

AT+NWMQLI <name>,<pw> MQTT login information.

<name>: ID

<pw>: password

Response: OK or ERROR

For example: AT+NWMQLI=da16k_user,12345678

? Get the MQTT login information.

Response: +NWMQLI:<name>,<pw> (none)

AT+NWMQWILL <topic>,<msg>,<qos> Set MQTT Will message.

<topic>: Will topic

<msg>: Will message

<qos>: Will QoS. 0 (at most once), 1 (at least once), 2 (exactly once)

Response: OK or ERROR

For example: AT+NWMQWILL=da16k_will,bye,0

? Get the MQTT Will message.

Response: +NWMQWILL:<topic>,<msg>,<qos> (none)

AT+NWMQDEL (none) Reset MQTT configurations.

Response: OK or ERROR

Page 25: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 25 of 50 © 2020 Dialog Semiconductor

Command Parameters Description

AT+NWMQTT <ip>,<port>, <sub_topic>, <pub_topic>, <qos>,<tls>, <username>, <password>

Run MQTT Client with options. After entering this command, system will reboot automatically.

<ip>: Broker’s IP address

<port>: Broker’s port number

<sub_topic>: MQTT subscriber topic

<pub_topic>: MQTT publisher topic

<qos>: MQTT QoS level

<tls>: Enable/disable MQTT TLS. 1 (enable), 0 (disable)

<username>: Login ID (optional)

<password>: Login password (optional)

Response: OK or ERROR

For example: AT+NWMQTT=192.168.0.15,1883,da16k_sub, da16k_pub,2,1,mqtt_id,12345678

Table 9: MQTT Response List

Response Parameters Description

+NWMQCL <result> The result of MQTT client connection.

<result>: 0 (disconnected), 1 (connected)

For example: +NWMQCL:1

+NWMQMSG <msg>,<topic>,<length> Received MQTT message.

<msg>: message data

<topic>: received topic

<length>: message length

7.1.1 MQTT Client Connection Example

Configure the parameters and start the subscriber (After Wi-Fi Connection)

AT+NWMQBR=172.16.0.1,1884

AT+NWMQTS=1,da16k_sub

AT+NWMQTP=da16k_pubAT+NWMQCL=1

If the connection is successful, the following text is shown:

+NWMQCL:1

If DA16K receives a PUBLISH from a broker, the following text is shown:

+NWMQMSG:Hello World,da16k,11

DA16K can send a PUBLISH to a broker. Type the following command:

AT+NWMQMSG=Hello I'm DA16K

7.1.2 MQTT TLS Connection Example

Configure the MQTT parameters.

AT+NWMQBR=172.16.0.1,8883

Page 26: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 26 of 50 © 2020 Dialog Semiconductor

AT+NWMQTS=1,da16k_sub

AT+NWMQTP=da16k_pub

AT+NWMQTLS=1

To check the validity of a certificate, the DA16K should set the exact current time.

AT+TIME=yyyy-mm-dd,hh:mm:ss

And store the certificate and private key if needed. (<ESC>C in chapter 5)

After all settings are made, start the client.

AT+NWMQCL=1

7.1.3 MQTT Example with DPM

Figure 5: Example Sequence to Initiate MQTT Protocol with DPM

Figure 5 is an example sequence to initiate the MQTT protocol with DPM in the DA16200.

In the normal boot state, connect to an AP (AT+WFJAPA) and change the DA16200 run mode to DPM mode (AT+DPM=1). To configure the MQTT connection information, enter command AT+CLRDPMSLPEXT and type the following as an example:

Page 27: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 27 of 50 © 2020 Dialog Semiconductor

AT+NWMQTT=test.mosquitto.org,1883,sub_topic,pub_topic,0,0

Figure 6: Procedure to Send MQTT Messages

Figure 6 shows the procedure to send an MQTT message in sleep mode.

When MCU wakes up the DA16200, the response "+INIT:WAKEUP,EXT" is sent. The MCU sends the command "AT+MCUWUDONE" to inform that MCU is ready to operate. To prevent that the DA16200 enters DPM sleep mode, MCU should send command AT+CLRDPMSLPEXT before an MQTT PUBLISH is sent. To make the DA16200 enter DPM sleep mode again, send a PUBLISH with command "AT+NWMQMSG" and then enter command "AT+SETDPMSLPEXT".

Page 28: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 28 of 50 © 2020 Dialog Semiconductor

Figure 7: Procedure to Process MQTT Messages

Figure 7 shows the procedure to process an MQTT message received while in sleep mode.

When the DA16200 wakes up by a PUBLISH message from an MQTT broker, the response "+INIT:WAKEUP,UC" is sent. The MCU sends the "AT+MCUWUDONE" to inform that it is ready to operate. Next, the DA16200 sends the received PUBLISH to the MCU and enters DPM sleep mode again.

7.2 OTA Commands

Table 10: OTA Command List

Command Parameters Description

AT+NWOTADWSTART <fw_type>,<uri>

Start FW download.

<fw_type>: slib / rtos

<uri>: Server URL where the FW exists

Response: +NWOTADWSTART:0x00

For example: AT+NWOTADWSTART=slib,https://172.16.0.1/DA16200_SLIB-GEN01-01-1111-000000.img

AT+NWOTARENEW (none) Reboot with updated FW.

For example: AT+NWOTARENEW

AT+NWOTADWPROG <fw_type> FW download progress.

<fw_type>: slib / rtos

Response: +NWOTADWPROG:100

For example: AT+NWOTADWPROG=slib

Page 29: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 29 of 50 © 2020 Dialog Semiconductor

Table 11: OTA Response List

Response Parameters Description

+NWOTADWSTART <status> FW download status.

<status>: 0x00 is success. See Table 12 for other status values.

For example: +NWOTADWSTART:0x00

+NWOTARENEW <status> FW renew status.

<status>: 0x00 is success. See OTA Response Code List for others.

For example: +NWOTARENEW:0x00

+NWOTADWPROG <progress> FW download progress.

<progress>: Print download progress in percent.

For example: +NWOTADWPROG:100

Table 12: OTA Response Code List

Return Value Description

0x00 Return success.

0x01 Return failed.

0x02 Sflash address is wrong.

0x03 FW type is unknown.

0x04 Server URL is unknown.

0x05 FW size is too big.

0x06 CRC is not correct.

0x07 FW version is unknown.

0x08 FW version is incompatible.

0x09 Fw not found on the server.

0x0A Failed to connect to server.

0x0B All new FWs have not been downloaded. You must download both slib and rtos to renew.

7.2.1 OTA Download Example

SLIB download:

AT+NWOTADWSTART=slib,https:// 172.16.0.1/DA16200_SLIB-GEN01-01-1111-000000.img

RTOS download:

AT+NWOTADWSTART=rtos,https:// 172.16.0.1/DA16200_RTOS-GEN01-01-1111-000000.img

7.2.2 OTA Download Progress Example

SLIB download progress:

AT+NWOTADWPROG=slib

RTOS download progress:

AT+NWOTADWPROG=rtos

7.2.3 OTA Renew Example

Renew Firmware (reboot with updated FW):

Page 30: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 30 of 50 © 2020 Dialog Semiconductor

AT+NWOTARENEW

Page 31: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 31 of 50 © 2020 Dialog Semiconductor

8 Transfer Function Commands

8.1 Socket Commands

Table 13: Socket Command List

Command Parameters Description

AT+TRTS <local_port> Open a TCP server socket.

<local_port>: Local port number of the socket

Response: OK or ERROR

For example: AT+TRTS=88

AT+TRTC <server_ip>,

<server_port>,

<local_port>

Open a TCP client socket and connect to a TCP server.

<server_ip>: IP address of TCP server to be accessed

<server_port>: Port number of TCP server

<local_port>: Local port number of the socket (optional, 0: auto)

Response: OK or ERROR

For example: AT+TRTC=192.168.20.1,88

AT+TRUSE <local_port> Open a UDP socket.

<local_port>: Local port number of the socket

Response: OK or ERROR

For example: AT+TRUSE=89

AT+TRUR <remote_ip>,

<remote_port>

Set remote IP and port of the UDP socket.

<remote_ip>: Remote IP address

<remote_port>: Remote port number

Response: OK or ERROR

For example: AT+TRUR=192.168.20.1,90

AT+TRPRT <cid> Get session information by CID.

<cid>: 0 (TCP server), 1 (TCP client), 2 (UDP)

Response: <cid>,[TCP|UDP],<remote_ip>,<remote_port>,

<local_port>

For example: AT+TRPRT=1

AT+TRPALL (none) Get all session information.

Response: <cid>,[TCP|UDP],<remote_ip>,<remote_port>,

<local_port><LF>…

AT+TRTRM <cid> Close (terminate) a session by CID.

<cid>: 0 (TCP server), 1 (TCP client), 2 (UDP)

Response: OK or ERROR

For example: AT+TRTRM=1

AT+TRTALL (none) Close (terminate) all sessions.

Response: OK or ERROR

AT+TRSAVE (none) Save status of all sessions to NVRAM.

Response: OK or ERROR

Page 32: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 32 of 50 © 2020 Dialog Semiconductor

Table 14: Socket Connection Response List

Response Parameters Description

+TRCTS <cid>,

<remote_ip>,

<remote_port>

A remote TCP client is connected to the TCP server that was opened by AT+TRTS.

<cid>: 0 (TCP Server)

<remote_ip>: TCP client IP address

<remote_port>: TCP client port number

For example: +TRCTS:0,192.168.0.5,3713

+TRXTS <cid>,

<remote_ip>,

<remote_port>

A remote TCP client is disconnected from the TCP server that was opened by AT+TRTS.

<cid>: 0 (TCP Server)

<remote_ip>: TCP client IP address

<remote_port>: TCP client port number

For example: +TRXTS:0,192.168.0.5,3713

+TRXTC <cid>,

<remote_ip>,

<remote_port>

The TCP client socket that was opened by AT+TRTC is disconnected.

<cid>: 1 (TCP Client)

<remote_ip>: TCP server IP address

<remote_port>: TCP server port number

For example: +TRXTC:1,192.168.0.5,3713

Page 33: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 33 of 50 © 2020 Dialog Semiconductor

8.2 Data Transfer Commands

Table 15: Data Transmission Command

Escape

Sequence

Parameters Description

<ESC>S <cid><length>,

<remote_ip >,

<remote_port >,<data>

Transmit data through a socket with the CID specified.

<ESC>: the escape character (0x1B)

<cid>: 0 (TCP server), 1 (TCP client), 2 (UDP)

<length>: Data length (If this is 0 then read the command until ‘\r’ or ‘\n’ is met. Max length is 2048 bytes but data will be fragmented by MTU).

<remote_ip>: Remote IP address.

<remote_port>: Remote port number.

- For TCP Server, <remote_ip> and <remote_port> of a TCP Client should be given. Maximum 4 TCP Clients can be connected to the TCP Server.

- For TCP Client, 0, 0 is given (as the destination is the server)

- For UDP: if you give 0,0, the data is sent to the destination that AT+TRUR has specified. if non-0 <remote_ip> and <remote_port> are given, UDP temporarily sends to the destination <remote_ip> and <remote_port> specifies.

Response: OK or ERROR

For example: <ESC>S00,192.168.0.1,3713,da16200\r

<ESC>S110,0,0,abcde12345

<ESC>S210,0,0,abcde12345

<ESC>S210,10.0.0.1,2543,abcde12345

Table 16: Data Reception Responses

Response Parameters Description

+TRDTS <cid>,

<src_ip>,<src_port>,

<length>,<data>

Receive data through TCP server socket.

<cid>: 0 (TCP Server)

<src_ip>: Source IP address

<src_port>: Source port number

<length>: Data length

<data>: Received data

For example: +TRDTS:0,172.16.7.1,54687,10,DIA_ACT_TS

+TRDTC <cid>,

<src_ip>,<src_port>,

<length>,<data>

Receive data through TCP client socket.

<cid>: 1 (TCP Client)

<src_ip>: Source IP address

<src_port>: Source port number

<length>: Data length

<data>: Received data

For example: +TRDTC:1,192.168.20.1,88,10, DIA_ACT_TC

Page 34: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 34 of 50 © 2020 Dialog Semiconductor

Response Parameters Description

+TRDUS <cid>,

<src_ip>,<src_port>,

<length>,<data>

Receive data through UDP server socket.

<cid>: 2 (UDP Session)

<src_ip>: Source IP address

<src_port>: Source port number

<length>: Data length

<data>: Received data

For example: +TRDUS:0,172.16.7.1.54687,10.DIA_ACT_US

8.3 Data Transfer with DPM

8.3.1 TCP Server

After a connection to an AP is made in the normal boot state, open a TCP server socket and save the config to NVRAM.

AT+TRTS=32000

AT+TRSAVE

Change the DA16200 state to DPM mode (AT+DPM=1). When the DA16200 starts the session on DPM mode successfully, the following text is shown:

+INIT:DONE,0

+WFJAP:1,'WIFI_AP',192.168.5.19

+TRPALL:0,TCP,0.0.0.0,0,32000

When a TCP client connects to DA16200, the following text is shown:

+INIT:WAKEUP,UC

+TRCTS:0,192.168.0.1,42000

When the DA16200 receives a message from a client, the following text is shown:

+INIT:WAKEUP,UC

+TRDTS:0,192.168.0.1,42000,10,1234567890

To send a TCP message, enter "AT+MCUWUDONE" immediately after "external wake-up" is triggered. To prevent that DA16200 enters DPM sleep mode, MCU should send AT+CLRDPMSLPEXT before a message is sent. The DA16200 sends data to a TCP client with command "<ESC>S". Finally, to enter DPM sleep mode, enter "AT+SETDPMSLTEXT".

When a TCP client disconnects from DA16200, the following text is shown:

+INIT:WAKEUP,UC

+TRXTS:0,192.168.0.1,42000

Page 35: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 35 of 50 © 2020 Dialog Semiconductor

8.3.2 TCP Client

After a connection is made to an AP in the normal boot state, connect the TCP client of the DA16200 to a TCP server and save the config to NVRAM. (To save TCP client config information, the DA16200 should connect to the server successfully beforehand.)

AT+TRTC=192.168.5.1,34000

AT+TRSAVE

Change the DA16200 state to DPM mode (AT+DPM=1). When the DA16200 starts the session on DPM mode successfully, the following text is shown:

+INIT:DONE,0

+WFJAP:1,'WIFI_AP',192.168.5.19

+TRPALL:1,TCP,192.168.5.1,34000,30000

The procedure to exchange TCP data is the same as in section 8.3.1. When the DA16200 receives a message from the server, the following text is shown:

+INIT:WAKEUP,UC

+TRDTC:1,192.168.5.1,34000,10,1234567890

8.3.3 UDP Session

After a connection is made to an AP in the normal boot state, open a UDP socket and save the config to NVRAM.

AT+TRUSE=48000

AT+TRSAVE

Change the DA16200 state to DPM mode. When the DA16200 starts the session in DPM mode successfully, the following text is shown:

+INIT:DONE,0

+WFJAP:1,'WIFI_AP',192.168.5.19

+TRPALL:2,UDP,0.0.0.0,0,48000

The procedure to exchange UDP data is the same as in section 8.3.1. When the DA16200 receives a message from the server, the following text is shown:

+INIT:WAKEUP,UC

+TRDUS:2,192.168.5.23,35000,10,1234567890

Page 36: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 36 of 50 © 2020 Dialog Semiconductor

9 RF Test Function Commands

Table 17: RF Test Command List

Command Parameters Description

AT+

TMRFNOINIT

<flag> Set boot mode.

<flag>: 0 (normal boot), 1 (RF test mode boot)

Response: OK or ERROR

For example: AT+TMRFNOINIT=1

AT+

TMLMACINIT

(none) Initialize LMAC (for test mode).

Response: OK or ERROR

AT+RFTESTSTART (none) Start RF test mode.

AT+RFTESTSTOP (none) Stop RF test mode.

Page 37: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 37 of 50 © 2020 Dialog Semiconductor

Command Parameters Description

AT+RFTX <Ch>,

<BW>,

<numFrames>,

<frameLen>,

<txRate>,

<txPower>,

<destAddr>,

<bssid>,

<htEnable>,

<GI>,

<greenField>,

<preambleType>,

<qosEnable>,

<ackPolicy>,

<scrambler>,

<aifsnVal>,

<ant>

Start RF TX test.

<Ch>: Carrier frequency (2412 ~ 2484 MHz)

<BW>: Carrier bandwidth. 20 MHz fixed.

<numFrames>: Number of frames to transmit

<frameLen>: Length of frame (bytes)

<txRate>: Data rate

b1: 11b DSSS 1 Mbps

b2: 11b DSSS 2 Mbps

b5_5: 11b DSSS 5.5 Mbps

b11: 11b DSSS 11 Mbps

g6: 11g 6 Mbps

g9: 11g 9 Mbps

g12: 11g 12 Mbps

g18: 11g 18 Mbps

g24: 11g 24 Mbps

g36: 11g 36 Mbps

g48: 11g 48 Mbps

g54: 11g 54 Mbps

n6_5: 11n 6.5 Mbps (7.2 Mbps @Short GI)

n13: 11n 13 Mbps (14.4 Mbps @Short GI)

n19_5: 11n 19.5 Mbps (21.7 Mbps @Short GI)

n26: 11n 26 Mbps (28.9 Mbps @Short GI)

n39: 11n 39 Mbps (43.3 Mbps @Short GI)

n52: 11n 52 Mbps (57.8 Mbps @Short GI)

n58_5: 11n 58.5 Mbps (65 Mbps @Short GI)

n65: 11n 65 Mbps (72.2 Mbps @Short GI)

<txPower>: TX power (0 ~ 15), 0.8 dB step

<destAddr>: MAC address to send packet

<bssid>: BSSID

<htEnable>: N/A

<GI>: [short|long]. Guad interval. 11n mode only

<greenField>: [on|off]. Set greenfield mode on/off

<preambleType>: [short|long]. Preamble type @DSSS mode

<qosEnable>: [on|off]. MAC header QoS control

<ackPolicy>: [NO|NORM|BA|CBA]

<scrambler>: N/A

<aifsnVal>: [0 ~ 15]. Indicate the AIFS in units of slots after SIFS that HW should wait for before starting backoff, for access category

<ant>: [0]. Fixed.

AT+RFTXSTOP (none) Stop RF TX test.

Page 38: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 38 of 50 © 2020 Dialog Semiconductor

Command Parameters Description

AT+RFCWTEST <Ch>,

<BW>,

<txPower>,

<ant>,

<CWCycle>

Start CW test.

<Ch>: Carrier frequency (2412 ~ 2484 MHz)

<BW>: Carrier bandwidth. 20 MHz fixed

<txPower>: TX power (0 ~ 15), 0.8 dB step

<ant>: [0]. Fixed

<CWCycle>: [1|2|4|5|8|10] MHz

AT+RFCWSTOP (none) Stop CW test.

AT+RFPER (none) Display PER state,

Indicate number of Valid packets, FCS Errors packets, PHY Errors packets, Overflow Errors

AT+RFPERRESET (none) Reset PER count.

AT+

RFCONTSTART

<txRate>,

<txPower>,

<Ch>

Start RF continuous TX test.

<txRate>: Data rate. Refer to AT+RFTX command

<txPower>: TX power (0 ~ 15), 0.8 dB step

<Ch>: Carrier frequency (2412 ~ 2484 MHz)

AT+RFCONTSTOP (none) Stop RF continuous TX test.

AT+RFCHANNEL <Ch> Change RF channel.

<Ch>: Carrier frequency (2412 ~ 2484 MHz)

Page 39: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 39 of 50 © 2020 Dialog Semiconductor

10 System & Peripheral Function Commands

10.1 SPI Commands

Table 18: SPI Command List

Command Parameters Description

AT+SPICONF <clockpol>,

<clockpha>

Configure SPI.

<clockpol>: Clock polarity [0|1]

<clockpha>: Clock phase [0|1]

10.2 OTP Commands

Table 19: OTP Command List

Command Parameters Description

AT+UOTPRDASC <addr>,<cnt> Read OTP data.

DA16200’s physical OTP offset range is h0~h7FF; at each offset, 4 bytes are stored / read.

For accessing OTP using this command, 4-byte aligned address should be given. For example: h0, h4, h8 ...

<addr>: OTP address to read 4-byte aligned

<cnt>: bytes to read

Response: OK or Error

A string of 4-bit HEXA value represented by the ASCII code

For example: Reading 4 bytes at offset h100 ➔ h100 * 4 = h400

AT+UOTPRDASC=400,4

aabbccdd

OK

Page 40: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 40 of 50 © 2020 Dialog Semiconductor

Command Parameters Description

AT+UOTPWRASC <addr>,<cnt>,<value> Write OTP data.

DA16200’s physical OTP offset range: h0~h7FF; at each offset, 4 bytes are stored / read.

For accessing OTP using AT-COMMAND, 4-byte aligned address should be given: For example: h0, h4, h8 ...

<addr>: OTP address to write 4-byte aligned

<cnt>: bytes to write

<value>: A string of 4-bit HEXA value represented by the ASCII code

Response: OK or Error

For example: Writing h12345678 to OTP Address 0x400:

AT+UOTPWRASC=400,4,12345678

OK

AT+UOTPRDASC=400,4

12345678

OK

Important:

For MAC address read / write, AT+WFOTP (write) and AT+WFMAC (read) must be used. Please do not use AT+UOTPRDASC/ AT+UOTPWRASC for this purpose.

OTP offset from 0x00 ~ 0x2b should not be written as this section is for “secure” boot.

DA16200 provides 4 slots to store MAC addresses and 8 bytes are allocated for each slot.

Table 20: OTP Memory Address for writing MAC address

Slot OTP Address Description Size(Byte)

MAC Address #0 0x100 MAC Address Low 4

0x101 MAC Address High 4

MAC Address #1 0x102 MAC Address Low 4

0x103 MAC Address High 4

MAC Address #2 0x104 MAC Address Low 4

0x105 MAC Address High 4

MAC Address #3 0x106 MAC Address Low 4

0x107 MAC Address High 4

DA16200 provides 2 slots to store XTAL offset in the OTP memory. Slot #0 is the primary slot while Slot#1 is for back-up, which is used when overriding Slot #0.

Table 21: Size of memory by XTAL offset

Slot OTP Address Description Size (Bytes)

XTAL Offset #0

0x10A XTAL Offset #0 value 2

XTAL Offset #1

0x10B XTAL Offset #1 value 2

Page 41: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 41 of 50 © 2020 Dialog Semiconductor

10.3 XTAL Commands

These commands are used for XTAL calibration and the usage is described in DA16200 Module Production Guide.

Table 22: XTAL Command List

Command Parameters Description

AT+XTALWR <value> Write XTAL Offset to DA16200 system register. This value will be erased after system reset and the register is set with the OTP XTAL offset value.

<value>: 7-bits to Write [h'1 ~ h'7f]

Response: OK or Error

For example:

AT+XTALWR=7f

OK

AT+XTALWR=80

ERROR

AT+XTALRD (none) Read XTAL Offset from DA16200 System.

Response:

<A string of 7-bit HEXA value represented by the ASCII Code>

OK or Error

For example:

AT+XTALRD

0x7f

OK

10.4 Flash Dump Commands

Table 23: Flash Dump Command List

Command Parameters Description

AT+FLASHDUMP <address>,

<length>

Dump serial flash data.

<address>: Start address [h’0 ~ h’3fffff]

<length>: data length [d’]

Response:

<dump data>

<CR><LF>0x[crc[7] crc[6] crc[5] crc[4] crc[3] crc[2] crc[1] crc[0]] <CR><LF><CR><LF>OK<CR><LF>

or Error

For example: Following example reads 32KB from 0x0.

AT+FLASHDUMP=0,32768

Page 42: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 42 of 50 © 2020 Dialog Semiconductor

10.5 GPIO Commands

Table 24: GPIO Command List

Command Parameters Description

AT+GPIOSTART <port>,

<pin >,

<direction>

Configures the GPIO pin mux and the direction of a GPIO.

<port>: GPIO port number.

* 0: GPIOA

* 1: GPIOC

<pin>: GPIO pin number. This is a hexadecimal value and indicates a GPIO bitmap.

<direction>: GPIO pin direction.

* 0: sets the pin as an input

* 1: sets the pin as an output

Response: OK or Error.

For example:

To configure GPIOA[3:0] output:

AT+GPIOSTART=0,f,1

To configure GPIOC[8:6] input:

AT+GPIOSTART=2,1c0,0

AT+GPIORD <port>,

<pin>

Reads the GPIO input level.

<port>: GPIO port number.

* 0: GPIOA

* 1: GPIOC

<pin>: GPIO pin number. This is a hexadecimal value and indicates a GPIO bitmap.

Response:

<Read value>: [h'0 ~ h'1fff]

OK or Error

The read value indicates GPIO bitmap. If the value is 0x1c0, it means GPIO #6, #7, #8 high.

For example:

To configure GPIOC[8:6] input:

AT+GPIOSTART=2,1c0,0

To read GPIOC[8:6] input level:

AT+GPIORD=2,1c0

Page 43: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 43 of 50 © 2020 Dialog Semiconductor

Command Parameters Description

AT+GPIOWR <port>,

<pin>,

<level>

Configures the output level of GPIO pins.

<port>: GPIO port number.

* 0: GPIOA

* 1: GPIOC

<pin>: GPIO pin number. This is a hexadecimal value and indicates a GPIO bitmap.

<level>: GPIO output level.

* 0: low

* 1: high

Response: OK or Error.

For example:

To configure GPIOC[8:6] output:

AT+GPIOSTART=2,1c0,1

To write GPIOC[8:6] high level:

AT+GPIOWR=2,1c0,1

AT+SAVE_PININFO (none) Save pin mux information.

Response: OK or Error.

AT+RESTORE_PININFO (none) Restore pin mux information.

Response: OK or Error.

10.6 Sleep Commands

Table 25: Sleep Command List

Command Parameters Description

AT+SLEEPMS <period>

Make DA16200 go to sleep mode 3 and wake up after <period> millisecond.

<period>: Wakeup time in millisecond.

Response: OK or Error

For example: AT+SLEEPMS=5000

Page 44: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 44 of 50 © 2020 Dialog Semiconductor

11 Examples

11.1 Data Transfer Test

This section describes how to test the transfer function commands with a data terminal emulator. Some of the terminal applications to use for this purpose are:

● IO Ninja: http:// http://ioninja.com/

– HEXA data & file transmitting function.

● Socket Test: http://sockettest.sourceforge.net

– Text data transmittable only.

● Script Communicator: http://sourceforge.net/projects/scriptcommunicator

– Socket communication, UART Rx/Tx data color-distinguished output function and HEXA data transmission.

The following sections describe test procedures for socket communication between the DA16200 and a PC with IO Ninja. You can run DA16200 AT commands on a serial terminal application on your PC. The terminal must be connected to the UART1 interface of the DA16200.

11.1.1 TCP Server Socket Test

1. DA16200 AT command:

a. AT+TRTS=1234 Open a TCP server socket of which the port is 1234.

2. PC:

a. Select TCP Connection Socket (1, Figure 8).

b. Fill in the IP address and the port number of DA16200 (2, Figure 8).

c. Click to connect the socket (3, Figure 8).

3. DA16200 AT command:

a. +TRCTS:0,192.168.0.5,3713 A TCP client socket connected and IP address is

192.168.0.5 and port is 3713.

4. PC:

a. Send data (4, Figure 8).

5. DA16200 AT command:

a. +TRDTS:0,192.168.0.5,3713,10,DIA_AT_TCP Received 10 bytes of data “DIA_AT_TCP”.

Page 45: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 45 of 50 © 2020 Dialog Semiconductor

Figure 8: IO Ninja - TCP Client Socket Setting

11.1.2 TCP Client Socket Test

1. PC:

a. Select menu TCP Listener Socket (1, Figure 9).

b. Enter the port number to be used (2, Figure 9).

c. Click to start to “Listen” (3, Figure 9).

2. DA16200 AT command:

a. AT+TRTC=192.168.0.5,1234,2300 Open a TCP client socket and set the server IP

(192.168.0.5), port (1234) and the local port (2300).

b. <ESC>S18,12345678 Send 8 bytes of data “12345678”.

3. PC:

a. Received data.

b. Send data (4, Figure 9).

4. DA16200 AT command:

Page 46: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 46 of 50 © 2020 Dialog Semiconductor

a. +TRDTC:1,10,DIA_AT_TCP Received 10 bytes of data “DIA_AT_TCP”.

Figure 9: IO Ninja - TCP Server Socket Setting

11.1.3 UDP Socket Test

1. PC:

a. Select UDP Socket (1, Figure 10).

b. Enter the port number to be used and click to open the socket (2, Figure 10).

c. Enter the IP address and port of the counterpart’s UDP socket, click and get ready for data transmission (3, Figure 10).

d. Enter data and click Send to transmit (4, Figure 10).

2. DA16200 AT command:

a. AT+TRUSE=4567 Open a UDP socket and set the local port (4567).

b. AT+TRUR=192.168.0.5,1234 Set the remote IP (192.168.0.5) and port (1234).

c. <ESC>S210,1234567890 Send 10 bytes of data “1234567890”.

d. +TRDTC:0,10,DIA_AT_UDP Received 10 bytes of data “DIA_AT_UDP”.

Page 47: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 47 of 50 © 2020 Dialog Semiconductor

Figure 10: IO Ninja - UDP Socket Setting

Page 48: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 48 of 50 © 2020 Dialog Semiconductor

Appendix

------------------------------------------------------------------------------------------------------------------- -------------------

Mosquitto1.4.14 License

Eclipse Distribution License 1.0

Copyright (c) 2007, Eclipse Foundation, Inc. and its licensors.

All rights reserved.

Redistribution and use in source and binary forms, with or without modification,

are permitted provided that the following conditions are met:

● Redistributions of source code must retain the above copyright notice, this list of conditions and the follow disclaimer.

● Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

● Neither the name of the Eclipse Foundation, Inc.

Nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"

AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,

THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE

ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE

LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR

CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF

SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS

INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN

CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)

ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE

POSSIBILITY OF SUCH DAMAGE.

--------------------------------------------------------------------------------------------------------------------------------------

UMAC GPL License

Linux kernel 3.9.0 rc3 version (backport 4.2.6-1)

--------------------------------------------------------------------------------------------------------------------------------------

Page 49: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 49 of 50 © 2020 Dialog Semiconductor

Revision History

Revision Date Description

1.7 30-June-2020 Added 2.4 Configuration for MCU Wake-up

Correct typos and wordings

1.6 29-Apr-2020

Added AT+WFDIS and AT+SETDPMSLP2EXT

Updated MQTT commands to operate with one-port

Updated to process the comma in the parameters

1.5 03-Apr-2020

Added AT+BIDX for changing boot index in Chapter 4.

Added example code of MQTT command in Section 7.1.1 ~ 7.1.3

Updated RF Test function commands in Chapter 9.

Updated GPIO commands in Section 10.5

1.4 21-Oct-2019 Updated 2.2 Serial Port configuration steps. Removed draft status

1.3 15-Oct-2019 Error correction

Added explanation to serial program at page 6

1.2 07-Oct-2019 Editorial review and add code: UM-B-111

1.1 25-Jul-2019 Added OTP Memory Address for writing MAC address in page 27

1.0 03-Jul-2019 Preliminary DRAFT Release

Page 50: DA16200 AT Command - Mouser Electronics · Hayes Command has a quite simple command structure of 'AT+Command'. This is convenient as you can just put any desired command right after

UM-WI-003

DA16200 AT Command FINAL

User Manual Revision 1.7 30-June-2020

CFR0012 50 of 50 © 2020 Dialog Semiconductor

Status Definitions

Status Definition

DRAFT The content of this document is under review and subject to formal approval, which may result in modifications or

additions.

APPROVED

or unmarked The content of this document has been approved for publication.

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.

© 2020 Dialog Semiconductor. All rights reserved

Contacting Dialog Semiconductor

United Kingdom (Headquarters)

Dialog Semiconductor (UK) LTD

Phone: +44 1793 757700

Germany

Dialog Semiconductor GmbH

Phone: +49 7021 805-0

The Netherlands

Dialog Semiconductor B.V.

Phone: +31 73 640 8822

North America

Dialog Semiconductor Inc.

Phone: +1 408 845 8500

Japan

Dialog Semiconductor K. K.

Phone: +81 3 5769 5100

Taiwan

Dialog Semiconductor Taiwan

Phone: +886 281 786 222

Hong Kong

Dialog Semiconductor Hong Kong

Phone: +852 2607 4271

Korea

Dialog Semiconductor Korea

Phone: +82 2 3469 8200

China (Shenzhen)

Dialog Semiconductor China

Phone: +86 755 2981 3669

China (Shanghai)

Dialog Semiconductor China

Phone: +86 21 5424 9058

Email:

[email protected]

Web site:

www.dialog-semiconductor.com