Document History Revision Date Author Description V.1.0 160407 New Create V.2.0 190808 Update Image Document Name AI7688H Reference Manual Version V 2.0 Date 2019/08/08...
Page 3
Index Introduction Start AI7688H development Software setup Power up AI7688H board Find the AI7688H AP and connect System Information and Upgrade Firmware OpenWrt for advanced configuration Access system console Firmware and Bootloader Update Firmware with USB drive Update bootloader with USB drive...
Page 4
Basic Concepts of MRAA 10.3 Using MRAA in Python 10.4 Using UPM in Python 10.5 Using MRAA in node.js 10.6 Controlling PWM with MRAA on AI7688H C/C++ Programming 11.1 Building C/C++ Programs with OpenWrt SDK Using webcam and audio 12.1 Supported cameras 12.2...
Page 5
AI7688H integrates a 1T1R 802.11n Wi-Fi radio, a 575/580 MHz MIPSR 24KEc CPU, 1-port Fast Ethernet PHY, USB2.0 host, PCIe, SD-XC, I2S/PCM and 3 UARTs. 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...
Page 6
Document Name AI7688H Reference Manual Version V 2.0 Date 2019/08/08...
Page 7
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 install Bonjour print service for mDNS.
Page 8
2.2 Power up AI7688H board After boot up 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.
Page 9
2.3 Find the AI7688H AP and connect Open browser http://mylinkit.local http://192.168.100.1 If the board already has a password, you can press “Wi-Fi Reset button” for at least 20 seconds then Release. Then you can configure your password again. Document Name...
Page 10
2.4 System Information and Upgrade Firmware Download lks7688.img(version 0.9.4) from here. Document Name AI7688H Reference Manual Version V 2.0 Date 2019/08/08...
Page 11
2.5 OpenWrt for advanced configuration Enter your Password OpenWrt Function Document Name AI7688H Reference Manual Version V 2.0 Date 2019/08/08...
Page 12
Open Terminal application At the command prompt type root@mylinkit.local Press return and enter the password you set previously in the Web UI For Windows: Open PuTTY Document Name AI7688H Reference Manual Version V 2.0 Date 2019/08/08...
Page 13
Do not press the Wi-Fi button for more than 20 seconds or it will upgrade the bootloader. Wait while the Wi-Fi LED blinks fast. This takes about 3 minutes. The device will automatically reboot after firmware update completed. Document Name AI7688H Reference Manual Version V 2.0 Date...
Page 14
3.2 Update bootloader with USB drive USB drive must be in FAT file system or the file system cannot be recognized by the AI7688H development platform. Download bootloader image file, Please refer to ”09_Firmware”. Save the bootloader file (uboot_<version>.bin) in the root directory of a USB drive and rename it “lks7688.ldr”.
Press and hold the Wi-Fi button for at least 20 seconds then release. The Wi-Fi LED will blink fast for 1 second, and then reboot to perform factory reset. -11- Document Name AI7688H Reference Manual Version V 2.0 Date 2019/08/08...
Page 16
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 3.5 Build Bootloader from Source -12- Document Name AI7688H Reference Manual Version V 2.0 Date...
Page 17
For a Windows or a Mac OS X host computer, you can install a VM for having the same environment: Download the bootloader source codes: git clone https://github.com/AcSiP/linkit-smart-7688-uboot.git Change to the source folder: cd linkit-smart-7688-uboot Install the toolchain (install to path /opt) for building the bootloader: sudo tar xjf buildroot-gcc342.tar.bz2 -C /opt/...
Page 18
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. -14- Document Name AI7688H Reference Manual Version V 2.0 Date 2019/08/08...
Page 19
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...
Page 20
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. -16- Document Name AI7688H Reference Manual Version V 2.0 Date 2019/08/08...
Page 21
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 -17- Document Name AI7688H Reference Manual Version V 2.0 Date 2019/08/08...
Page 22
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. -18- Document Name AI7688H Reference Manual Version V 2.0 Date 2019/08/08...
Page 23
(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 -19- Document Name AI7688H Reference Manual Version V 2.0 Date 2019/08/08...
Page 24
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. -20- Document Name AI7688H Reference Manual Version V 2.0 Date 2019/08/08...
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).
Page 26
3. Open the system console of the AI7688H. 4. Type the following commands for installing related packages: 5. Format the SD card. ext4 file system will be used in this example: During the formatting process, it'll prompt a confirmation: Proceed anyway? (y,n).
Page 27
After mounting the root FS on the SD card, we can see the spare space of rootfs increases: In this example, a 8GB SD card is used and the rootfs now becomes 7.2GB in size. Remember you can’t boot up AI7688 from SD card. -23- Document Name AI7688H Reference Manual Version V 2.0 Date 2019/08/08...
Page 28
In Station mode There are 3 Wi-Fi LED states in Station mode: 1. LED is off. AI7688H failed to connect to a wireless router and is timed-out. 2. LED blinks twice per second continuously. It indicates AI7688H is connecting to a wireless router.
Page 29
Wi-Fi LED blinks once after It failed to load Linux system image. You can resolve this by reset, but does not light up kernel upgrading the firmware using a USB drive. -25- Document Name AI7688H Reference Manual Version V 2.0 Date 2019/08/08...
Page 30
Station mode, or when you need to re-configure Wi-Fi settings. Note: If AI7688H is already in AP mode, this operation takes no effect 6.2 Switch to Station mode Step1: Type UCI commands to assign SSID, key, and encryption information for...
Step 2: Restart the Wi-Fi driver wifi After the Wi-Fi driver restarts, the PC should be able to scan the AI7688H AP as shown in the video of the Reset Wi-Fi Configuration section. Also the Wi-Fi status can be checked through the behavior.
Page 32
6.4 Setup Wireless Router -28- Document Name AI7688H Reference Manual Version V 2.0 Date 2019/08/08...
Page 33
-29- Document Name AI7688H Reference Manual Version V 2.0 Date 2019/08/08...
Page 34
So make sure you release the Wi-Fi button shortly after Wi-Fi LED light up. After those 3 steps, the system will then boot up with the SSID and password specified for bringing up the Wi-Fi. -30- Document Name AI7688H Reference Manual Version V 2.0 Date 2019/08/08...
Page 35
./helloworld root@mylinkit.local:/example/helloworld In the above example, a file named helloworld from the current directory is copied to the path /example/helloworld in AI7688H. The SCP tool will instruct you to enter the Password of root account. Using SCP to copy files in Windows You can download tools that support SCP protocol.
Page 36
Web UI: Click Yes when you see a warning window about Continue connecting to an unknown server and add its host key to a cache. -32- Document Name AI7688H Reference Manual Version V 2.0 Date...
Page 37
, as shown below: # After you’ve dragged the file, an Upload window will appear asking you to confirm the upload. Click OK to copy the file. -33- Document Name AI7688H Reference Manual Version V 2.0 Date...
Page 38
7.2 Using Samba Samba is a networking tool that is built-in AI7688H and provides a file sharing service on the device for file transfer. In the example below you’ll learn how to use command to share a directory and set appropriate access permission for this directory.
Page 39
Access Samba in OS X The steps to transfer files using Samba in Mac are as follows: Open Finder and in the menu click Go > Connect to server -35- Document Name AI7688H Reference Manual Version V 2.0 Date 2019/08/08...
Page 40
In the server address field, type smb://mylinkit.local or smb://192.168.100.1 and click Connect Connect as guest: Check Finder and you’ll see MySharedFoloder. You can now transfer files in this folder. -36- Document Name AI7688H Reference Manual Version V 2.0 Date 2019/08/08...
Page 41
Use get_site_survey ra0 to collect scan results Example root@myLinkIt:/# iwpriv ra0 set SiteSurvey=1 root@myLinkIt:/# sleep 5 root@myLinkIt:/# iwpriv ra0 get_site_survey ra0 Example output: #Get Statistic Data root@myLinkIt:/# iwpriv ra0 stat -37- Document Name AI7688H Reference Manual Version V 2.0 Date 2019/08/08...
Page 42
Generates certificates required by the examples by following the instructions AWS IoT Device SDK. Copy the certificates, private key, and root-CA file to AI7688H to ~/certs directory. You can follow the instructions. AWS IoT SDK for JavaScript Simply follow the npm installation steps: Note that there will be two missing optional dependencies utf-8-validate@1.2.1 and...
Page 43
5. Use your AWS IoT Console, choose "Connect a device" to generate certification files. Download and store the certification files to “AWS_SDK/certs” directory. 6. Navigate the “subscribe_publish_sample” application directory: -39- Document Name AI7688H Reference Manual Version V 2.0 Date 2019/08/08...
Page 44
10. Make sure the board is connected to the internet and is in the same network as your computer. Now we copy the certification files and the sample application to the board: -40- Document Name AI7688H Reference Manual Version V 2.0 Date...
Page 45
Now you can build other sample applications as well. You need to modify the makefile and aws_iot_config.h for each sample application as described in step 7 and 8 above. -41- Document Name AI7688H Reference Manual Version V 2.0 Date 2019/08/08...
Page 46
USB device control, SD card access and sensor connection. Related software stacks are provided for developers to access the sensors attached to the AI7688H.UPM is the repository for sensor drivers written in libmraa and it provides API bindings for Python, Node.js and C languages.
Page 47
Synopsis mt7688_pinmux get mt7688_pinmux set <group> <function> Description In the system console of the AI7688H development board, enter mt7688_pinmux get to query the current pinmux status: root@mylinkit:/# mt7688_pinmux get Group i2c - [i2c] gpio Group uart0 - [uart] gpio...
Page 48
Group i2s - i2s [gpio] pcm Group ephy - ephy [gpio] Group wled - [wled] gpio As you can see the Group ephy functionality changed from ephy to gpio. -44- Document Name AI7688H Reference Manual Version V 2.0 Date 2019/08/08...
Page 49
Libmraa is pre-installed in the system image of AI7688H and supports C++, Python and Node.js bindings. Installing MRAA: Libmraa is already installed in the system image of AI7688H, so you don't need to install it again. Basic Concepts: The majority of hardware modules such as GPIO, UART, SPI, and PWM are represented as objects created by mraa's factory function.
Page 50
Then, call pin.write(0) to set the pin state to LOW or call pin.write(1) to set the pin state to HIGH. To make the Wi-Fi LED blink periodically, set pin GPIO#44 (WLED_N) to GPIO mode and execute the following code -46- Document Name AI7688H Reference Manual Version V 2.0 Date...
Page 51
GPIO#2 has changed. Call isr API with the trigger type you want to register and the function to be called. Note that the function runs in a different thread. -47- Document Name AI7688H Reference Manual Version V 2.0 Date...
Page 52
This is useful to control actuator peripherals such as servo motors. To use PWM, initialize it on a certain pin such as GPIO. Note that only GPIO18, GPIO19, GPIO20, GPIO21 supports PWM on AI7688H. To control the PWM pattern, several parameters are required, including: Period This defines the carrier frequency of the modulation.
Page 53
I2Cs are initialized is slightly different from GPIO modules - instead of using pins, I2Cs are initialized according to its device index. Since there is only 1 set of I2C master device on AI7688H, you can simply pass 0 - and it is always on pin GPIO4 and GPIO5.
Page 54
APIs. Among the popular sensor drivers such as I2C accelerometers and many others are available from this repository. AI7688H system image is pre-installed with UPM and you can start programming on existing sensors immediately – but if the default implementation is not available, you can use opkg package manager to update the UPM library.
Page 55
Installing MRAA Libmraa and its Nodejs bindings are already installed in the system image of AI7688H, so you don't need to install it again. Controlling LED with MRAA in Node.js Our first tutorial is controlling the LED with a simple node.js program.
Page 56
Configure PWM pin: To use PWM, initialize it on a certain pin such as GPIO. Note that only GPIO#18, GPIO#19, GPIO#20, GPIO#21 supports PWM on AI7688H. So the first step is to create a Pwm object by assigning the desired GPIO number.
Page 57
You can use PWM signal to control a servo. A pulse width of 1500us means the neutral position, while usually 1000ms and 2000ms being the minimum and maximum position. So the following code resets the servo motor to neutral position: -53- Document Name AI7688H Reference Manual Version V 2.0 Date 2019/08/08...
Page 58
11 C/C++ Programming 11.1 Building C/C++ Programs with OpenWrt SDK Building C/C++ binaries for AI7688H requires cross-compilation. We provide an OpenWrt SDK. Follow these steps to build an example C/C++ ipk file that can be installed with opkg command. Requirement Currently only Ubuntu Linux and OS X are supported.
Page 59
Navigate to SDK/bin/ramips/packages/base There should be a package file named helloworld_1.0.0-1_ramips_24kec.ipk Copy the .ipk file to the AI7688H In the system console of the board, navigate to the location of the .ipk file and type opkg install ...
12 Using webcam and audio By connecting a USB webcam to the USB host port on AI7688H, users can easily setup the video streaming service according to the following steps. 12.1 Supported cameras AI7688H has installed Linux UVC (USB Video Class) drivers to provide USB webcam support.
Page 61
To record an audio file, use arecord as below: -57- Document Name AI7688H Reference Manual Version V 2.0 Date 2019/08/08...