EARDATEK EWN-8720CMN1AA User manual

EWN-8720CMN1AA Getting Started Guide
EWN-8720CMN1AA Getting Started Guide
Version: A0

EWN-8720CMN1AA Getting Started Guide
Catalog
1EWN-8720CMN1AA Module ..................................................................................................................................... 4
1.1 General Specifications.................................................................................................................................... 4
1.2 Features......................................................................................................................................................... 4
1.3 PCB Layout Overview ..................................................................................................................................... 6
1.4 Pin-Out Reference.......................................................................................................................................... 7
2Configure AWS IoT Core.......................................................................................................................................... 10
2.1 Create a New Device.................................................................................................................................... 10
2.2 Create a policy ............................................................................................................................................. 13
2.3 Attach Policy................................................................................................................................................ 14
3Configure AmebaZ2 Amazon FreeRTOS................................................................................................................... 17
3.1 Download Source Code from github............................................................................................................. 17
3.1.1
Cloning a repository by Download ZIP ............................................................................................... 17
3.2 Get Broker Endpoint by AWS IoT Core.......................................................................................................... 18
3.3 Get Thing Name........................................................................................................................................... 18
3.4 Setup IoT Core Information with AmebaZ2 Amazon FreeRTOS...................................................................... 19
3.4.1
Setup Thing’s Private Key and Certificate........................................................................................... 19
3.4.2
Enable FreeRTOS demo on AmebaZ2................................................................................................. 21
4Compile AmebaZ2 Amazon FreeRTOS ..................................................................................................................... 22
4.1 Pre-Requisite ............................................................................................................................................... 22
4.2 IAR Build Environment Setup........................................................................................................................ 22
4.3 Install IAR IDE............................................................................................................................................... 22
4.4 Compilation ................................................................................................................................................. 22
4.5 Generate Image Binary ................................................................................................................................ 23
5ImageTool............................................................................................................................................................... 24
5.1 Introduction................................................................................................................................................. 24
5.2 Environment Setup ...................................................................................................................................... 24
5.2.1
Hardware Setup................................................................................................................................ 24
5.2.2
Software Setup ................................................................................................................................. 26
5.3 Image Download.......................................................................................................................................... 26
6MQTT Demo ........................................................................................................................................................... 28
6.1 Get Device Log............................................................................................................................................. 28
6.2 Run MQTT Demo ......................................................................................................................................... 28
6.3 Monitoring MQTT messages on the cloud .................................................................................................... 30
7Troubleshooting...................................................................................................................................................... 32
7.1 Image Tool Download Fail............................................................................................................................ 32
7.2 ERROR: Invalid Key....................................................................................................................................... 32

EWN-8720CMN1AA Getting Started Guide
7.3 Failed to establish new MQTT connection .................................................................................................... 33
7.4 TLS_Connect fail........................................................................................................................................... 33

EWN-8720CMN1AA Getting Started Guide
1EWN-8720CMN1AA Module
1.1 General Specifications
EWN-8720CMN1AA Module home page: https://eardatek.com/about/contact.html
EWN-8720CMN1AA is a highly integrated module with a low power 802.11n Wireless LAN compatible network
controller, the IC it uses is RTL8720CM. It combine a Real-M300(KM4) CPU that is based on ARMv8-M architecture, and
carry WLAN MAC, a 1T1R capable WLAN baseband, an RF circuit, and Bluetooth Low Energy(BLE) in a single chip.
Figure 1-1 EWN-8720CMN1AA Module
Appearance View
1.2 Features
MCU Features
Real-M300(KM4) clock frequency up to 100MHz
I-Cache 32KB/D-Cache 16KB
Supports DMA
EXecute In Place (XIP) on flash
Internal Memory
Supports 384KB ROM
Supports 256KB RAM
Supports external flash interface
Supports MCM embedded 4MB Psram
Supports 2Mbit~32Mbit Flash

EWN-8720CMN1AA Getting Started Guide
Wi-Fi Features
2.4GHz 802.11 b/g/n
Support low power Tx/Rx for short-range application
Support WPA/WPA2/ WMM/WPS
Frame aggregation for increased MAC efficiency
Low latency immediate High-Throughput Block Acknowledgement
Long NAV for media reservation with CF-End for NAV release
Bluetooth Low Energy
Bluetooth Low Energy(BLE) 4.2
Supports LE secure connections/LE scatternet
Supports 1 Master/1 Slave
Secure
Supports secure boot
Wi-Fi WEP, WPA, WPA2, WPS
MD5/SHA-1/SHA2-224/SHA2-256/HMAC/AES Crypto engine
Interface
SPI/SDIO/UART interface
SPI/I2C master for sensor
I2S, PWM and GPIO
1 GDMA with 2 channels

EWN-8720CMN1AA Getting Started Guide
1.3 PCB Layout Overview
Module Size (Unit: mm): 18.0(±0.2) *25.50(±0.3)*2.9(±0.2)
Figure 1-2EWN-8720CMN1AA Module Size

EWN-8720CMN1AA Getting Started Guide
1.4 Pin-Out Reference
Figure 1-3EWN-8720CMN1AA Module Pin
Definition

EWN-8720CMN1AA Getting Started Guide
PIN
Definition
Description
1
GND
Ground
2
VCC
Supply power 3.3V;
3
CHIP_EN
1:Enable chip
2:Shutdown chip
4
GPIOA_0
(TEST_MODE_SEL)
JTAG_CLK/UART1_IN/PWM[0]
1:Enter into test/debug mode
0:Normal operation mode
5
GPIOA_1
(Autoload_Fail)
JTAG_TMS/UART1_OUT/PWM[1]
1:eFUSE settings are not loaded
2:eFUSE settings are loaded
6
GPIOA_2
JTAG_TDO/UART1_IN/PWM[2]/SPI_CSn/I2C_SCL
7
GPIOA_3
JTAG_TDI/UART1_OUT/PWM[3]/SPI_SCL/I2C_SDA
8
GPIOA_4
JTAG_TRST/UART1_CTS/PWM[4]/SPI_MOSI
9
GPIOA_7
Flash_SPI_CS/SPI_M_CS/SPI_CSn
10
GPIOA_8
Flash _SPI_CLK/SPI_M_CLK/SPI_SCL
11
GPIOA_9
Flash _SPI_WP/SPI_M_DATA[2]/SPI_MOSI/UART0_RTS
12
GPIOA_10
Flash _SPI_SO/SPI_M_DATA[1]/SPI_MISO/UART0_CTS
13
GPIOA_11
Flash _SPI_SI/SPI_M_DATA[0]/I2C_SCL/UART0_OUT/PWM[0]
14
GPIOA_12
Flash _SPI_HOLD/SPI_M_DATA[3]/I2C_SDA/UART0_IN/PWM[1]
15
GND
Ground
16
GPIOA_13
UART0_IN/PWM[7]
17
GPIOA_14
SDIO_INT/UART0_OUT/PWM[2]
18
GPIOA_15
SDIO_D[2]/UART2_IN/PWM[3]/SPI_CSn/I2C_SCL
19
GPIOA_16
SDIO_D[3]/UART2_OUT/PWM[4]/SPI_SCL/I2C_SDA
20
GPIOA_17
SDIO_CMD/ PWM[5]
21
GPIOA_18
SDIO_CLK/ PWM[6]
22
GPIOA_19
SDIO_D[0]/UART2_CTS/PWM[7]/SPI_MOSI/I2C_SCL
23
GPIOA_20
SDIO_D[1]/UART2_RTS/PWM[0]/SPI_MISO/I2C_SDA

EWN-8720CMN1AA Getting Started Guide
PIN
Definition
Description
27
GPIOA_23
LED_0/PWM[7]
38
GND
Ground
Table 1- EWN-8720CMN1AA Module Pin
Definition Description
Notes:
1、UART download:Using A15&A16, and before power on.
2、Default states of all pins are High-impedance; Unused pins should be kept floating.
3、Some IO are used to connect to the flash of the module. It is recommended not to use these IO. As shown in the
table.
PIN
Definition
Description
9
GPIOA_7
Flash_SPI_CS
10
GPIOA_8
Flash _SPI_CLK
11
GPIOA_9
Flash _SPI_WP
12
GPIOA_10
Flash _SPI_SO
13
GPIOA_11
Flash _SPI_SI
14
GPIOA_12
Flash _SPI_HOLD
Table 2- EWN-8720CMN1AA Module Flash
definition

EWN-8720CMN1AA Getting Started Guide
2Configure AWS IoT Core
2.1 Create a New Device
To create a new device, navigate to Manage -> Things in the left-hand navigation menu. Then click “Register a thing”.

EWN-8720CMN1AA Getting Started Guide
Then, name the new device. This example uses the name TestDevice.

EWN-8720CMN1AA Getting Started Guide
Download the certificate, public key, and private key for the device by clicking Download. Next, download the root CA for AWS IoT by clicking
to the Download link. Once all the certificate and keys have been downloaded, click Activate. Finally, click Done
1
2
3
4

EWN-8720CMN1AA Getting Started Guide
2.2 Create a policy
A policy defines a device’s access permissions to IoT Core. To create a policy, navigate to Secure -> Policies. Then click “Create a policy”
NOTE –this policy grants unrestricted access for all iot operations, and is to be used only in a development environment. For non-dev
environments, all devices in your fleet must have credentials with privileges that authorize intended actions only, which include (but not
limited to) AWS IoT MQTT actions such as publishing messages or subscribing to topics with specific scope and context. The specific permission
policies can vary for your use cases. Identify the permission policies that best meet your business and security requirements.
For sample policies, refer to https://docs.aws.amazon.com/iot/latest/developerguide/example-iot-policies.html.
Also refer to https://docs.aws.amazon.com/iot/latest/developerguide/security-best-practices.html

EWN-8720CMN1AA Getting Started Guide
2.3 Attach Policy
The last step to configuring the device is attaching a policy. To attach a policy to new device, navigate to Manage -> Things. Then click
on the device which was created.
Click Security, then click the certificate create in previous step.

EWN-8720CMN1AA Getting Started Guide

EWN-8720CMN1AA Getting Started Guide

EWN-8720CMN1AA Getting Started Guide
3Configure AmebaZ2 Amazon FreeRTOS
3.1 Download Source Code from github
Open source link: https://github.com/ambiot/amazon-freertos and select master for get newest source code. The stable version could be
found in “Releases” page.
3.1.1
Cloning a repository by Download ZIP
1. On GitHub, navigate to the main page of the repository.
2. Above the list of files, click Code.
3. Click Donwload ZIP to get source code.
For more information, please refer "Cloning a repository from GitHub to GitHub Desktop."

EWN-8720CMN1AA Getting Started Guide
Broker Endpoint
Thing Name
3.2 Get Broker Endpoint by AWS IoT Core
3.3 Get Thing Name

EWN-8720CMN1AA Getting Started Guide
3.4 Setup IoT Core Information with AmebaZ2 Amazon FreeRTOS
Setup BROKER_ENDPOINT, THING_NAME, WIFI_SSID, PASSWORD in “amazon-
freertos/blob/master/demos/include/aws_clientcredential.h”
3.4.1
Setup Thing’s Private Key and Certificate
Filled keyCLIENT_CERTIFICATE_PEM and keyCLIENT_PRIVATE_KEY_PEM in “amazon-
freertos/blob/master/demos/include/aws_clientcredential_keys.h” by xxxxxxxx-certifiacte.pem and xxxxxxxx-private.pem.key.
It can done by amazon-freertos/tools/certificate_configuration/CertificateConfigurator.html

EWN-8720CMN1AA Getting Started Guide
Final aws_clientcredential_keys.h overview.
Table of contents