AcSiP Technology AI7688H User Manual

AI7688H User Manual
An IOT Solution Company
V.1 160407
-1-
Copyright@2016 AcSiP
AI7688H User Manual
Revision Date Author Description
V.1 160407 Kevin New Create
-2-
Copyright@2016 AcSiP
AI7688H User Manual
Contents:
1. Introduction…………………………………………….……..4
2. Start AI7688H development …………………..……...5
3. Firmware and Bootloader…………...…………….......9
4. File Storage…………………………………………….……..19
5. Wi-Fi LED State…………………………………….…….….22
6. Network…………………………………………….………....24
7. AWS IoT…………………………………………….….…….…40
8. Peripheral………………………………………….…….…...43
9. C/C++ Programming………………………….…………..51
10. Using USB Webcam………………………………………58
11. Audio Playback and Recording…………..…………59
12. Federal Communication Commission Interference
Statement………………………………………………….….61
-3-
Copyright@2016 AcSiP
AI7688H User Manual
1. Introduction
AI7688H integrates a 1T1R 802.11n Wi-Fi radio, a 575/580 MHz MIPSR 24KEc
Ethemet PHY,USB2.0 host,PCIe,SD-XC,I2S/PCM and multiple slow IOs.
AI7688H provides two operation modes – IoT gateway mode and IoT device mode.In IoT gateway
Mode, the PCIe Express interface can connect to 802.11ac chipset for 11ac dual-band concurrent
Gateway. The high performance USB 2.0 allows AI7688H to add 3G/LTE modem support or add a
H.264 ISP for wireless IP camera. For the IoT device mode, AI7688Hsupports eMMC , SD-XC and
USB2.0. AI7688H can support the WiFi high quality audio via 192kbps/24bits I2S interface and
VoIP application through PCM. In IoT device mode, it further supports PWM,SPI slave,3rd UART
and more GPIOs. For IoT gateway, it can connect to touch panel and BLE,Zigbee/Z-Wave and
sub-1G RF for smart home control.
TM
CPU, 1-port fast
-4-
Copyright@2016 AcSiP
AI7688H User Manual
2. Start AI7688H development
2.1 Get S/W
# Download an SSH client (Windows only)
PuTTY
provides Secure Socket Shell (SSH) access to the development board
operating system.

# Install Bonjour Print Service (For Windows 7 only)

The AI7688H development board uses mylinkit.local as its local domain. In Windows7, you’ll need to installBonjour print service
because mDNS is not
support.
This helps your computer discover the LinkIt Smart AI7688H’s IP address with the local domain name. For Windows 8 and later, Mac OS X and Linux, mDNS is supported and you can use mylinkit.local.
2.2 Power up AI7688H board
After bootup and Wi-Fi initialization completes, which takes about 30 seconds, the Wi-Fi
LED goes off. This means the system is ready to accept Wi-Fi connection – now we can connect to it. Following Figure shows how the Wi-Fi LED status matches the system state.
-5-
Copyright@2016 AcSiP
AI7688H User Manual
2.3 Find the AI7688H AP and connect
2.4 Open http://mylinkit.local
If the board already has a password and you don’t have or lost it,
You have to press “Wi-Fi Reset button” for at least 20 seconds then Release.
Then you can configure your password again.
-6-
Copyright@2016 AcSiP
AI7688H User Manual
Enter your Password
2.5 Get system Info and Upgrade F/W
2.6 Go to OpwnWrt for advanced configuration
-7-
Copyright@2016 AcSiP
AI7688H User Manual
2.7 Access system console
For OS X and Linux:
# Open Terminal application
# At the command prompt type
# ssh root@mylinkit.local
# Press return and enter the password you set previously in the Web UI
For Windows:
-8-
Copyright@2016 AcSiP
AI7688H User Manual
USB Drive
3 Firmware and Bootloader
3.1 Flash F/W from USB drive
# Download lates Firmware
# Unzip it and copy the unzipped lks7688.img file to the root directory of a FAT32
# Attach the USB drive to the HOST port of the board with an OTG cable.
# Hold the WiFi button
# Press the MPU reset button once while holding the WiFi button
# Keep holding WiFi button about 5 seconds. Release WiFi button until the WiFi orange
LED becomes OFF.
Do not press the Wi-Fi button for longer than 20s or it will upgrade the bootloader.
Wait while the WiFi LED blinks fast. This takes about 3 minutes.
The device will automatically reboot after firmware update completed.
-9-
Copyright@2016 AcSiP
AI7688H User Manual
3.2 Update bootloader
USB drive must be in FAT file system or the file cannot be recognized by the AI7688H
development platform.
# Save the bootloader file (lks7688.ldr) in the root directory of a USB drive and name it
lks7688.ldr.
# Plug the USB drive to AI7688H.
# Press the WiFi and MPU (Reset) button at the same time, then release the MPU Reset
button but hold the WiFi button for at least 20 seconds.
# After 20 seconds Wi-Fi LED will turn on. Release WiFi button.
The board will start to read the bootloader (WiFi LED blinks fast) and perform the
bootloader upgrade process (Wi-Fi LED blinks slowly). It takes about 2 seconds to finish
the bootloader upgrade process
3.3 Build F/W from Source
The following operations are performed under a Ubuntu LTS 14.04.3 environment. For a
Windows or a Mac OS X host computer, you can install a VM for having the same
environment:
Install prerequisite packages for building the firmware:
$ sudo apt-get install git g++ libncurses5-dev subversion libssl-dev gawk
libxml-parser-perl unzip
Download OpenWrt CC source codes:
$ git clone git://git.openwrt.org/15.05/openwrt.git
Prepare the default configuration file for feeds:
$ cd openwrt
$ cp feeds.conf.default feeds.conf
-10-
Copyright@2016 AcSiP
AI7688H User Manual
ild an firmware for
Add the AI7688H feed:
$ echo src-git linkit https://github.com/MediaTek-Labs/linkit-smart-7688-feed.git >>
feeds.conf
Update the feed information of all available packages for building the firmware:
$ ./scripts/feeds update
Install all packages:
$ ./scripts/feeds install -a
Prepare the kernel configuration to inform OpenWrt that we want to bu
AI7688H:
$ make menuconfig
o Select the options as below:
Target System: Ralink RT288x/RT3xxx Subtarget: AI7688H based boards
o Save and exit (use the deafult config file name without changing it)
Start the compilation process:
$ make V=99
After the build process completes, the resulted firmware file will be under
bin/ramips/openwrt-ramips-7688-LinkIt7688-squashfs-sysupgrade.bin. Depending on the
H/W resources of the host environment, the build process may take more than 2 hours.
You can use this file to do the firmware upgrade through the Web UI. Or rename it to
lks7688.img for upgrading through a USB drive
-11-
Copyright@2016 AcSiP
AI7688H User Manual
3.4 Build Bootloader from Source
The following operations are performed under a Ubuntu LTS 14.04.3 environment. For a
Windows or a Mac OS X host computer, you can install a VM for having the same
environment:
Refer to Build_F/W_Source for installing all prerequisite packages.Download the bootloader source codes:
$ git clone https://github.com/MediaTek-Labs/linkit-smart-uboot.git
Change to the source folder:
$ cd linkit-smart-uboot
Install the toolchain needed for building the bootloader:
$ sudo tar xjf buildroot-gcc342.tar.bz2 -C /opt/
Since the toolchain is provided in 32-bit executables, you need to install additional
packages for execution on a 64-bit machine:
$ sudo dpkg --add-architecture i386
$ sudo apt-get update
$ sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386
Start the compilation process:
$ make
The resulted bootloader file is uboot.bin. You can rename it to lks7688.ldr for upgrading the system bootloader through a USB
drive.
-12-
Copyright@2016 AcSiP
AI7688H User Manual
3.5 Rebuild Existing Kernel Packages
In the config menu, select the Kernel modules.
#
# Go to Filesystems and select the kmod-fs-ext4 as M (modularizes features). Note: other
kernel packages which kmod-fs-ext4 depends on will also be selected automatically.
# Follow the original build flow to continue the setup and save the configuration for the
firmware building process.
-13-
Copyright@2016 AcSiP
AI7688H User Manual
# After the building process is complete, you can find the kernel packages
under bin/ramips/packages/base/ (if the package you built is not there, you can also
use find command to locate where it is)
# After the building process is complete, you can find the kernel packages
under bin/ramips/packages/base/ (if the package you built is not there, you can also
use find command to locate where it is).
# Copy all related kernel module packages to a USB drive.
Plug the USB drive to AI7688H and perform the opkg install command to install all
necessary kernel packages from the USB drive.
root@mylinkit:/tmp/run/mountd/sda1# opkg install kmod*.ipk
Installing kmod-crypto-core (3.18.23-1) to root...
Installing kmod-crypto-hash (3.18.23-1) to root...
Installing kmod-fs-ext4 (3.18.23-1) to root...
Installing kmod-lib-crc16 (3.18.23-1) to root..
Package kmod-lib-crc16 (3.18.23-1) installed in root is up to date.
Configuring kmod-crypto-core.
Configuring kmod-crypto-hash.
Configuring kmod-lib-crc16.
Configuring kmod-fs-ext4.
Note: if you simply install the kmod-fs-ext4, an error will occur like
root@mylinkit:/tmp/run/mountd/sda1# opkg install
kmod-fs-ext4_3.18.23-1_ramips_24kec.ipk
Installing kmod-fs-ext4 (3.18.23-1) to root...
Collected errors:
* satisfy_dependencies_for: Cannot satisfy the following dependencies for kmod-fs-ext4:
* kmod-lib-crc16 * kmod-crypto-hash *
* opkg_install_cmd: Cannot install package kmod-fs-ext4.
From these information, we can know what additional kernel packages are also needed
for kmod-fs-ext4 under bin/ramips/packages/base/ in Step 5
-14-
Copyright@2016 AcSiP
AI7688H User Manual
3.6 Bootloader and Kernel Console
The Bootloader console and Linux kernel console are configured to serial port
UART2(UART_TXD2 and UART_RXD2) at baudrate 57600
[04060C0F][04060C0C]
DDR Calibration DQS reg = 0000898A
U-Boot 1.1.3 (Sep 10 2015 - 05:56:31)
Board: Ralink APSoC DRAM: 128 MB
relocate_code Pointer at: 87f68000
flash manufacture id: c2, device id 20 19
find flash: MX25L25635E
*** Warning - bad CRC, using default environment
============================================
Ralink UBoot Version: 4.3.0.0
--------------------------------------------
ASIC 7628_MP (Port5<->None)
DRAM component: 1024 Mbits DDR, width 16
DRAM bus: 16 bit
Total memory: 128 MBytes
Flash component: SPI Flash
Date:Sep 10 2015 Time:05:56:31
============================================
icache: sets:512, ways:4, linesz:32 ,total:65536
dcache: sets:256, ways:4, linesz:32 ,total:32768
##### The CPU freq = 580 MHZ ####
estimate memory size =128 Mbytes
RESET MT7628 PHY!!!!!!
GPIOMODE --> 50054404
GPIOMODE2 --> 5540551
Please choose the operation:
1: Load system code to SDRAM via TFTP.
2: Load system code then write to Flash via TFTP.
3: Boot system code via Flash (default).
4: Entr boot command line interface.
7: Load Boot Loader code then write to Flash via Serial.
9: Load Boot Loader code then write to Flash via TFTP.
-15-
Copyright@2016 AcSiP
AI7688H User Manual
There is about 1 second for you to choose from the bootloader menu. If there is no user
input, the bootloader continues into Linux kernel bootup:
3: System Boot system code via Flash.
## Booting image at bc050000 ...
Image Name: MIPS OpenWrt Linux-3.18.21
Image Type: MIPS Linux Kernel Image (lzma compressed)
Data Size: 1118412 Bytes = 1.1 MB
Load Address: 80000000
Entry Point: 80000000
Verifying Checksum ... OK
Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80000000) ...
## Giving linux memsize in MB, 128
Starting kernel ...
[ 0.000000] Linux version 3.18.21 (root@builder1) (gcc version 4.8.3 (OpenWrt/Linaro
GCC 4.8-2014.04 r47269) ) #7 Sat Nov 7 14:50:53 CET 2015
[ 0.000000] Board has DDR2
[ 0.000000] Analog PMU set to hw control
[ 0.000000] Digital PMU set to hw control
[ 0.000000] SoC Type:
[ 0.000000] bootconsole [early0] enabled
[ 0.000000] CPU0 revision is: 00019655 (MIPS 24KEc)
[ 0.000000] MIPS:
[ 0.000000] Determined physical RAM map:
[ 0.000000] memory: 08000000 @ 00000000 (usable)
At this point you can press ENTER to gain access to the Linux kernel console
-16-
Copyright@2016 AcSiP
AI7688H User Manual
3.7 Change bootloader Console
If you want to use another UART port as the bootloader console, you need to modify the
bootloader.
# Get bootloader source code
# modify the file board/rt2880/serial.h
/*
* UART registers
*/
#if defined (MT7621_FPGA_BOARD) || defined (MT7621_ASIC_BOARD) || defined
(MT7628_FPGA_BOARD) || defined (MT7628_ASIC_BOARD)
#define RT2880_UART1 0x0C00 /* UART Lite */
#define RT2880_UART2 0x0D00 /* UART Lite */
#define RT2880_UART3 0x0E00 /* UART Lite */
//#define CFG_RT2880_CONSOLE RT2880_UART1
#define CFG_RT2880_CONSOLE RT2880_UART3
#else
#define RT2880_UART1 0x0500
#define RT2880_UART2 0x0C00 /* UART Lite */
#define CFG_RT2880_CONSOLE RT2880_UART2
#endif
and modify the CFG_RT2880_CONSOLE configuration.
Note that in bootloader code, RT2880_UART1 refers to UART0(UART_TXD0/UART_TXR0)
and so on. So modify the following modification:
Change this:
//#define CFG_RT2880_CONSOLE RT2880_UART1
#define CFG_RT2880_CONSOLE RT2880_UART3
to this:
#define CFG_RT2880_CONSOLE RT2880_UART1
//#define CFG_RT2880_CONSOLE RT2880_UART3
This changes the bootloader console from UART2 to UART0.
if you also want to change the baudrate, please modify the file include/configs/rt2880.h
-17-
Copyright@2016 AcSiP
AI7688H User Manual
#define SERIAL_CLOCK_DIVISOR 16
#define CONFIG_BOOTDELAY 1 /* autoboot after 5 seconds */
#define CONFIG_BAUDRATE 57600
#define CONFIG_SERVERIP 10.10.10.3
#define CONFIG_IPADDR 10.10.10.123
Change this:
#define CONFIG_BAUDRATE 57600
to this (change the baudrate from 57600 to 115200 as an example):
#define CONFIG_BAUDRATE 115200
This will then change the bootloader console baudrate from 57600 to 115200
# Now build the bootloader and upload it to the board
3.8 Change Kernel Console
If you want to use another UART port as the kernel console, you can follow the steps below
to adjust the configuration.
# modify the file target/linux/ramips/dts/LINKIT7688.dts and chang
chosen {
bootargs = "console=ttyS2,57600";
};
to this (e.g. change to UART0 and 115200 baudrate):
chosen {
bootargs = "console=ttyS0,115200";
};
This will then change the kernel console from UART2 to UART0 and its baudrate from 57600
to 115200.
Now build the firmware and upload it to the board through the Web UI or the USB drive.
-18-
Copyright@2016 AcSiP
AI7688H User Manual
4 File Storage
4.1 USB Drive and SD Card
When a USB drive or SD card is inserted into AI7688H, they can be accessed under /Media/SD* or
/Media/USB* (The device name displayed varies depending on the number of drives you use and
the number of partitions available on the USB drive or SD card).
You can use the following commands to check the contents of the USB drive and SD card:
In this example, a USB drive named USB-A1 is used:
# ls /Media/USB-A1
In this example, a SD card named SD-P1 is used:
# ls /Media/SD-P1
4.2 How to mount the root FS on a SD card
The on-board flash is a raw flash. It is with limited write cycles (about 100,000 times) and without
wear leveling mechanism and atomic write operation. So it is not recommended to write user
data to the on-board flash frequently. Besides, its storage is also limited to 32MB, the spare space
might not be sufficient for storing lots of user data and software packages. As a result, it is
recommended to mount the root FS on a SD card for getting more and reliable storage.

Steps:

Below are the steps for making this work. For details, please refer to the OpenWrt WiKi for
extroot. Note: the procedure below assumes there is only one partition on the SD card. If there
are multiple partitions on the SD card, you can use fdisk command to manage partition settings.
1. Insert a microSD card into the AI7688H device. Warning: all the data on the SD card will be
erased in the following steps.
2. Make sure the device is under Station mode for accessing internet.
3. Open the system console of the AI7688H.
4. Type the following commands for installing related packages:
-19-
Copyright@2016 AcSiP
Loading...
+ 42 hidden pages