MediaTek LinkIt™ Smart 7688 Developer's Guide Version: 0.92 Beta Release date: November 2015 Specifications are subject to change without notice. © 2015 MediaTek Inc. This document contains information that is proprietary to MediaTek Inc. Unauthorized reproduction of this information in whole or in part is strictly prohibited.
MediaTek LinkIt™ Smart 7688 Developer's Guide Document Revision History Revision Date 0.91 November 2015 0.92 November 23, 2015 Description • LED status diagram, • COM port INF driver for Windows 8 and 10, • Pip/npm installation for Python and Node.js • mDNS on virtual machine • Revised Web UI • File system & opkg test case pass • Basic behavior test © 2015, 2016 MediaTek Inc. Page 2 o This document contains information that is proprietary to MediaTek Inc.
MediaTek LinkIt™ Smart 7688 Developer's Guide Table of contents 1. Introduction ..................................................................................................................................................... 7 1.1. 1.2. 1.3. 1.4. 1.5. 1.6. 1.7. 1.8. 2. Hardware Development Kit ..................................................................................................................... 10 2.1. 2.2. 2.3. 2.4. 3. How to Access LinkIt Smart 7688 Peripheral using MRAA ........
MediaTek LinkIt™ Smart 7688 Developer's Guide 7.5. 7.6. There are multiple LinkIt Smart 7688 APs nearby and I’m not sure which one is mine, how do I find out?............................................................................................................................................. 94 My board seems to have stopped working, what do I do? ............................................................ 94 Appendix A .............................................................................
MediaTek LinkIt™ Smart 7688 Developer's Guide Lists of tables and figures Table 1 MT7688AN SOC Specification ............................................................................................................................. 10 Table 2 LinkIt Smart 7688 Development board buttons ....................................................................................... 12 Table 3 Wi-Fi LED blink pattern in LinkIt Smart 7688 HDK .........................................................................
MediaTek LinkIt™ Smart 7688 Developer's Guide Figure 21 System Console ..................................................................................................................................................... 41 Figure 22 LinkIt Smart 7688 COM port using Serial to USB cable .................................................................... 43 Figure 23 Using UART to USB cable to access system console in Windows terminal ............................ 44 Figure 24 Firmware upgrade button .......
MediaTek LinkIt™ Smart 7688 Developer's Guide 1. Introduction This section provide an overview of the MediaTek LinkIt™ development platforms and introduction to the MediaTek LinkIt Smart 7688 development platform, which also acts as a guide to the content of this document. 1.1. What is MediaTek LinkIt? MediaTek LinkIt™ is a collection of development platforms designed for the prototyping of Wearables and Internet of Things (IoT) devices.
MediaTek LinkIt™ Smart 7688 Developer's Guide For more details on the tools and utilities provided, please see Chapter 4, “Software Development Kit and related tools”. 1.6. Get Started You can find the LinkIt Smart 7688 Get Started guide on MediaTek Lab’s website and learn how to run a blink example. The step by step guide for the LinkIt Smart 7688 and LinkIt Smart 7688 Duo board covers: • Setting up development environment. • Connecting to a LinkIt Smart 7688 development board.
MediaTek LinkIt™ Smart 7688 Developer's Guide • Arduino 1.8. Join the MediaTek Labs Ecosystem Wearable and Internet of Things are the next wave in the consumer gadget revolution. MediaTek is a key player in this field, combining the best of two worlds —the existing MediaTek ecosystem of phone manufacturers, electronic device manufacturers, and telecom operators with open, vibrant developer and maker communities.
MediaTek LinkIt™ Smart 7688 Developer's Guide 2. Hardware Development Kit The LinkIt Smart 7688 hardware development kit (HDK) delivers two development boards: LinkIt Smart 7688 (offering an MPU alone) and LinkIt Smart 7688 Duo (offering an MPU and MCU). The MPU is powered by MediaTek’s MT7688AN SOC and the MCU is powered by an ATmega32U4. The MPU supports the OpenWrt Linux distribution; it processes an application’s intensive logic tasks and provides Wi-Fi connectivity. It supports Python, Node.
MediaTek LinkIt™ Smart 7688 Developer's Guide 2.2. LinkIt Smart 7688 LinkIt Smart 7688 is one of the most highly integrated and compact hardware development boards available for IoT prototyping. 2.2.1. Key Features LinkIt Smart 7688’s key features include the following: • 1T1R Wi-Fi 802.11 b/g/n. • Pin-out for GPIO, I2C, I2S, SPI, UART, PWM and Ethernet Port. • 580 MHz MIPS CPU. • 32MB flash and 128MB DDR2 RAM. • USB host. • Micro SD slot. LinkIt Smart 7688 is shown in Figure 1.
MediaTek LinkIt™ Smart 7688 Developer's Guide 2.2.2. Buttons Description of how to use the buttons on the LinkIt Smart 7688 development board is provided in Table 2.
MediaTek LinkIt™ Smart 7688 Developer's Guide device Station Mode Disconnected Off Connecting 2 blinks per second Connected Blinking based on the transmitted data package Table 3 Wi-Fi LED blink pattern in LinkIt Smart 7688 HDK For more information on Wi-Fi Access Point and Station modes, please see section 3.5, “Network Environment”. 2.2.4. Antenna There are two types of antenna supported on the LinkIt Smart 7688 development board: 1) Built in Wi-Fi chip antenna, this is the default antenna.
MediaTek LinkIt™ Smart 7688 Developer's Guide Approximate Power Consumption Scenario To establish Wi-Fi connection Device boot up Downloading a file to an SD Card over Wi-Fi Downloading a file to a USB Drive over Wi-Fi Downloading a file to flash over Wi-Fi Peak 475.3 mA Average 255.6 mA Peak 605.4 mA Average 195.1 mA Peak 540.4 mA Average 275.8 mA Peak 569.5 mA Average 304.9 mA Peak 522.4 mA Average 271.
MediaTek LinkIt™ Smart 7688 Developer's Guide 2.2.8. JTAG You can use the JTAG interface to debug MT7688AN. To access the JTAG interface, you‘ll need to unsolder resistor R95 and solder it to resistor R3 on the development board. After you’ve moved the resistor and reboot the device you can activate the JTAG function. The hardware configuration steps are: Find the group of resistors on the bottom of LinkIt Smart 7688 in the upper-right, as circled in Figure 4.
MediaTek LinkIt™ Smart 7688 Developer's Guide Category PCB Size Memory Power Source GPIO Feature Specification Working voltage 3.3V Dimensions 55.7 x 26 mm Flash 32MB RAM 128MB DDR2 USB Power 5V (USB micro-B) VCC 3.3V (Pin Breakout) Pin Count 22 (MT7688AN) Voltage 3.3v Pin Count 4 (MT7688AN) Voltage 3.3v Max. Resolution 7 bits (customizable) PWM Maximum Frequency@Resolution External Interrupts SPI SPI Slave I2S I2C Pin Count 100kHz@1-bit 50kHz@2-bit 25kHz@3-bit 12.
MediaTek LinkIt™ Smart 7688 Developer's Guide Category UART Lite USB Host Communication User Storage Feature Specification Set Count 3 (MT7688AN) Pin numbers P8, P9, P16, P17, P18, P19 Max. Speed 0.5Mbps Set Count 1 (MT7688AN) Pin numbers P6, P7 Connector type Micro-AB Wi-Fi 1T1R 802.11 b/g/n (2.4G) Ethernet 1-port 10/100 FE PHY Pin numbers P2, P3, P4, P5 SD Card Micro SD SDXC Table 5 LinkIt Smart 7688 development boards specifications 2.2.10.
MediaTek LinkIt™ Smart 7688 Developer's Guide Figure 6 LinkIt Smart 7688 Pin-out Diagram © 2015, 2016 MediaTek Inc. Page 18 This document contains information that is proprietary to MediaTek Inc. Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
MediaTek LinkIt™ Smart 7688 Developer's Guide 2.3. LinkIt Smart 7688 Duo The LinkIt Smart 7688 Duo development board is powered by the same MT7688AN SOC as the LinkIt Smart 7688, but includes an ATmega32U4 MCU. This supports additional features including Analog I/O support and Arduino IDE support.
MediaTek LinkIt™ Smart 7688 Developer's Guide Figure 7 LinkIt Smart 7688 Duo development board (MPU + MCU) 2.3.2. Buttons The buttons description on LinkIt Smart 7688 Duo and how to use them are described in Table 6.
MediaTek LinkIt™ Smart 7688 Developer's Guide Scenario grades firmware from a USB drive Upgrades boot loader from a USB drive WARNING: Restore to default setting and all user data will be removed from the device Button Action Wi-Fi Reset Button While the board is powering up, press the button for at least 5 seconds and release Wi-Fi Reset Button While the board is powering up, press the button for at least 20 seconds and release Table 6 LinkIt Smart 7688 Duo Development board buttons 2.3.3.
MediaTek LinkIt™ Smart 7688 Developer's Guide Approximate Power Consumption Scenario Average 248.9 mA Downloading file to a SD Card via Wi-Fi Peak 605.4 mA Average 300.4 mA Downloading a file to a USB Drive via Wi-Fi Peak 616.6 mA Average 347.5 mA Downloading a file to flash via Wi-Fi Peak 578.5 mA Average 336.3 mA Table 7 Peripherals Power Consumption 2.3.7.
MediaTek LinkIt™ Smart 7688 Developer's Guide 2) Next, you will move a resistor by unsoldering and soldering it to a lower position as shown in Figure 9, after you’re finished moving the resistor, restart the device and you should be able to access JTAG mode. Figure 9 Moving a resistor to access JTAG mode 2.3.10. Specifications The key specifications of the LinkIt Smart 7688 Duo development board are shown in Table 8.
MediaTek LinkIt™ Smart 7688 Developer's Guide Category Feature LinkIt Smart 7688 Duo Timer 1 & 3 (4 sets) 187.5kHz@8-bit 46.875kHz@10-bit Timer 4 (6 sets) ADC External Interrupts SPI/SPIS I2C Pin Count 12 (ATmega32U4) Voltage 3.3v Pin Count 8 (ATmega32U4) Set count 1 (ATmega32U4) Pin numbers S0, S1, S2, S3 Max. Speed 4 MHz Set Count 1 Pin numbers D2, D3 Speed 400K Set Count UART Lite Pin numbers Max.
MediaTek LinkIt™ Smart 7688 Developer's Guide Figure 10 LinkIt Smart 7688 Duo Pin-out Diagram © 2015, 2016 MediaTek Inc. Page 25 This document contains information that is proprietary to MediaTek Inc. Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
MediaTek LinkIt™ Smart 7688 Developer's Guide 2.4. FCC, CE and NCC Certifications LinkIt Smart 7688 and LinkIt Smart 7688 Duo development boards are FCC, CE and NCC certified. For FCC compliance statement, please see Appendix A. © 2015, 2016 MediaTek Inc. Page 26 This document contains information that is proprietary to MediaTek Inc. Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
MediaTek LinkIt™ Smart 7688 Developer's Guide 3. Programming Environment Guide This chapter introduces the: • Operating system used on the platform • Programming environment offered on the LinkIt Smart 7688 development platform • Different programming models and how they are applied to the development boards • Network environment available for Wi-Fi communication with the boards • Methodologies for creating applications in C/C++, Python and Node.js. 3.1.
MediaTek LinkIt™ Smart 7688 Developer's Guide Programming language Tools and libraries Applications Host platforms LinkIt Smart 7688 • • • Network Linux Windows Table 9 LinkIt Smart 7688 Programming Environment Overview 3.3. Programming Model for Different Boards The LinkIt Smart 7688 and LinkIt Smart 7688 Duo development boards share the same core programming environment.
MediaTek LinkIt™ Smart 7688 Developer's Guide 3.4. Choosing the right programming model (To be completed) 3.5. Network Environment Wi-Fi communications on the LinkIt Smart 7688 development platform offers two operating modes: Access Point and Station. This section describes those two modes. 3.5.1. Access Point Mode In AP mode a LinkIt Smart 7688 development board forms a LAN and acts as an access point, as shown in Figure 12. AP mode is used mainly to configure the board settings.
MediaTek LinkIt™ Smart 7688 Developer's Guide Figure 13 LinkIt Smart 7688 in Station Mode In addition to being used by the device application to access remote systems or cloud services over the Internet, this mode is used to install software from OpenWrt to the board using opkg package manager. In this scenario, your computer joins the same Wi-Fi network as the board and connects to the board through SSH. 3.6.
MediaTek LinkIt™ Smart 7688 Developer's Guide #include int main(int argc, char** argv) { printf("Hello, World!\n"); } 3) Enter the following command to cross-compile it. CC_TOOLS/bin/mipsel-openwrt-linux-g++ helloworld.c -o helloworld 4) Assuming the host environment is connected to Wi-Fi of the LinkIt Smart 7688; transfer the output binary named helloworld to LinkIt Smart 7688 using SCP. For example: scp ./helloworld root@mylinkit.
MediaTek LinkIt™ Smart 7688 Developer's Guide 3.7.3. Installing additional modules in Python Python comes with a default package manager utility called pip. You can use this utility to install additional Python modules. To use it, first make sure your board is connected to the Internet as described in 4.6.5, “Connecting LinkIt Smart 7688 to a Wi-Fi Access Point To Access Internet” or Get Started guide, and check here for a list of available packages.
MediaTek LinkIt™ Smart 7688 Developer's Guide 3) In the vi editor, type letter i to insert code. Type the codes below. console.log(’Hello World’); 4) Save the file and exit the vi editor: a) Press the esc key b) Press :wq! 5) Execute the example code by typing the command: node app.js You should see Hello World as the output string. 3.8.2. Installing additional packages in Node.js Node.js comes with a default package manager utility called npm. You can use this utility to install additional Node.
MediaTek LinkIt™ Smart 7688 Developer's Guide 4. Software Development Kit and related tools This section describes the SDK and related tools available to create, test, deploy and run applications for the LinkIt Smart 7688 development boards. 4.1. Software Development Kit The LinkIt Smart 7688 software development kit deliver: • The latest boot loader for the development boards. • The latest firmware for the development boards.
MediaTek LinkIt™ Smart 7688 Developer's Guide Package Description UVC USB camera support Kernel drivers for USB camera support Python Python language support pySerial Library for providing serial port access function in Python Node.
MediaTek LinkIt™ Smart 7688 Developer's Guide $ opkg install nano $ opkg install http://mirror2.openwrt.org/mt76 88/packages/nano 2.4.1-1 ramips 24kec.ipk • Remove This removes a previously installed package(s). For example: $ opkg remove • Upgrade This upgrades an installed package to a newer version.
MediaTek LinkIt™ Smart 7688 Developer's Guide 4.5.2. Local Domain The board uses a local domain called mylinkit.local and your computer needs to support mDNS to use this local domain. For Windows 8 and later, Mac OS X and Linux, the mDNS is supported. However, if you’re using Windows 7, you’ll need to install Bonjour print service to enable your computer to discover LinkIt Smart 7688‘s IP address within a local domain name.
MediaTek LinkIt™ Smart 7688 Developer's Guide Wi-Fi LED Status and System State AP Mode, w/o Client System Boot loader Power On Initializing 4-5 secs 1 sec Blink Once Linux Boot Strapping ~30 secs Light Up Wi-Fi Ready AP Mode, w/ Client 3 blinks per sec, pauses 0.
MediaTek LinkIt™ Smart 7688 Developer's Guide the Internet in later steps. But first, you need to configure LinkIt Smart 7688 and the steps are described next. Figure 17 LinkIt Smart 7688 in AP mode 3) In your web browser open http://mylinkit.local, as shown in Figure 18. Figure 18 LinkIt Smart 7688 Web UI Sign In © 2015, 2016 MediaTek Inc. Page 39 This document contains information that is proprietary to MediaTek Inc.
MediaTek LinkIt™ Smart 7688 Developer's Guide If the board already has a password and you don’t have access or lost it, use a USB drive to upgrade firmware or press and hold the Wi-Fi button for at least 20 seconds and release. Keep in mind if you do either of these methods, it will restore to board’s default settings and all user data will be removed from the device. For more information on how to upgrade firmware using a USB drive or use the buttons please refer to section 4.6.
MediaTek LinkIt™ Smart 7688 Developer's Guide 3) A Security Alert window will pop up as shown in Figure 20 below, this happens when you use PuTTY for the first time, or after upgrading firmware or boot loader, or use a different board. Click Yes. Figure 20 PuTTY Security Warning 4) In the PuTTY terminal window that opens, log in with username root and enter the password you set previously in the Web UI, after log in you should see a screen similar to Figure 21.
MediaTek LinkIt™ Smart 7688 Developer's Guide • For Linux: Open Terminal. In the Terminal, type ssh root@mylinkit.local at the command line, hit return and log in using the password you set previously. If you see an error indicating problems with host ID, please refer to FAQ on MediaTek Labs website. For more information on using SSH, please reference here. 4.5.4.2. Using Serial to USB Cable You can connect to the system console of LinkIt Smart 7688 by using a Serial (or UART) to USB cable.
MediaTek LinkIt™ Smart 7688 Developer's Guide Figure 22 LinkIt Smart 7688 COM port using Serial to USB cable 4) Open the PuTTY terminal and enter the COM port number of the USB device found in the device manager, click on the Serial radio button, type 57600 in Speed box and click Open, as shown in Figure 23. © 2015, 2016 MediaTek Inc. Page 43 This document contains information that is proprietary to MediaTek Inc.
MediaTek LinkIt™ Smart 7688 Developer's Guide Figure 23 Using UART to USB cable to access system console in Windows terminal 5) To exit the system console, click the X on top right of the PuTTY windows. • For Mac: 1) Install the driver if needed. Check the cable manufacturer’s website for driver requirements on Mac and installation instructions. 2) Plug-in the cable and connect the cable to LinkIt Smart 7688. 3) Open a Terminal session. You can open it at Applications/Utilities/Terminal.
MediaTek LinkIt™ Smart 7688 Developer's Guide 6) Now you should be connected to the system console. Press ENTER in the Terminal to bring up the prompt. You'll notice that the prompt has become different from your OS X Terminal application, it is the LinkIt Smart 7688 prompt and it looks like the following: root@myLinkIt:/# 7) You’re ready to make changes to the LinkIt Smart 7688 system through this console. 8) To exit the system console, type a + k, and y.
MediaTek LinkIt™ Smart 7688 Developer's Guide Note: All user data will be removed from the device after firmware upgrade. The firmware is the same for both LinkIt Smart 7688 and Duo boards. • Using Web UI: 1) Sign in the LinkIt Smart 7688 Web UI. Please see section 4.5.3, “Connecting to the Web UI” if you haven’t signed in before. 2) After you’ve signed in, click on the Upgrade firmware as shown in Figure 24. Figure 24 Firmware upgrade button 3) Click Choose the file and select lks7688.img file.
MediaTek LinkIt™ Smart 7688 Developer's Guide Figure 26 Firmware version You now have the latest firmware on your LinkIt Smart 7688 development board. • Using a USB drive : 1) Save the firmware file (lks7688.img) in the root directory of a USB drive. You can download the latest firmware from MediaTek Labs website. 2) Plug the USB drive to LinkIt Smart 7688.
MediaTek LinkIt™ Smart 7688 Developer's Guide 4.6.2. Upgrading boot loader Warning: Do not disconnect the power source or unplug the USB drive during boot loader upgrading process, or else the data in flash will be damaged and the device will fail to boot up again. This section describes how to upgrade the boot loader. Please follow these steps: 1) Save the boot loader file (lks7688.ldr) in the root directory of a USB drive and name it lks7688.
MediaTek LinkIt™ Smart 7688 Developer's Guide 4.6.5. Connecting LinkIt Smart 7688 to a Wi-Fi Access Point To Access Internet This section describes how LinkIt Smart 7688 development board connects to an AP in a Wi-Fi network to access the Internet. To connect to an access point, LinkIt Smart 7688 needs to be in Station mode. For more information please see section3.5, “Network Environment”. 4.6.5.1. Using the Web UI Open a browser with URL mylinkit.local. Please see section 4.5.
MediaTek LinkIt™ Smart 7688 Developer's Guide Figure 30 Changing to Station mode in Web UI 3) A message window will pop up letting you know the device is connecting to the AP you’ve selected and reload the Web UI page to sign in. 4) After you’ve signed in, check the Wi-Fi LED; it should blink once per second, this indicates LinkIt Smart 7688 is in Station mode. 5) To change LinkIt Smart 7688 back to AP mode, press the Wi-Fi Reset button for at least 5 seconds and release. Please see 4.5.
MediaTek LinkIt™ Smart 7688 Developer's Guide Encryption UCI Command string Open network none WPA-PSK psk WPA2-PSK psk2 WEP wep Table 14 Wi-Fi AP Encryption Type For more information on encryption types please check here. Password Open a system console and enter the following commands to change LinkIt Smart 7688 to station mode: 3) In this example, the following AP is used: # # # # # # AP SSID: MyAP Encryption type: WPA2-PSK ( psk2) Password: 12345678 uci set wireless.sta.
MediaTek LinkIt™ Smart 7688 Developer's Guide and sign in, click the Configure button under System information and the following information will display, as shown in Figure 32: • Device name • Current IP address • Account • Password Figure 32 System Information in LinkIt Smart 7688 Web UI 4.6.7.
MediaTek LinkIt™ Smart 7688 Developer's Guide 4.7. File Editor and Transfer As a developer, you want freedom to use any text editor of your choice for coding. You can launch the built-in vim editor in system console to edit source code files directly in LinkIt Smart 7688 or you can use other editor from a remote computer, but during development, including tasks such as program execution, it’s common to transfer files between LinkIt Smart 7688 and the remote programming computer to finish the job.
MediaTek LinkIt™ Smart 7688 Developer's Guide Figure 34 WinSCP login window c) Locate the file you want to transfer on the left pane (your computer) and drag it to the right (LinkIt Smart 7688), as shown in Figure 35. Figure 35 File transfer using WinSCP d) After you’ve dragged the file, an Upload window will appear as shown in Figure 36 asking you to confirm the upload. Click OK. © 2015, 2016 MediaTek Inc. Page 54 This document contains information that is proprietary to MediaTek Inc.
MediaTek LinkIt™ Smart 7688 Developer's Guide Figure 36 File transfer confirmation Check the LinkIt Smart 7688 system console, the helloworld.py file should be there. Alternatively you can use command line interface, by typing the following command in the Windows command line console: winscp.com –hostkey=”*” scp://root@myLinkt.local helloworld.
MediaTek LinkIt™ Smart 7688 Developer's Guide 4.7.4. Setup Samba service in LinkIt Smart 7688 Samba is a file transfer tool that is built-in LinkIt Smart 7688 and provides a shared folder /Media on the device for file transfer. In the example below you’ll learn how to use UCI command to change the shared folder to /IoT and set appropriate access permission for this folder. Change the shared folder path to /IoT. In LinkIt Smart 7688 console, type the following command: 1) # uci set samba.media.
MediaTek LinkIt™ Smart 7688 Developer's Guide Figure 37 File transfer using Samba in Windows 4.7.6. Use Samba to copy files in OS X The steps to transfer files using Samba in Mac are as follows: Open Finder and in the top menu click Go > Connect to server as shown in Figure 38. 1) Figure 38 Connecting to LinkIt Smart 7688 from Finder 2) In the server address field, type smb://mylinkit.local and click Connect, as shown in Figure 39. © 2015, 2016 MediaTek Inc.
MediaTek LinkIt™ Smart 7688 Developer's Guide Figure 39 Connecting to mylinkit.local server in Mac 3) Connect as guest, as shown in Figure 40. Figure 40 Connecting as guest to mylinkit.local on Mac 4) Check Finder and you’ll see MySharedFoloder as shown in Figure 41. You can now transfer files in this folder. Figure 41 MyShareFolder in Mac Finder © 2015, 2016 MediaTek Inc. Page 58 This document contains information that is proprietary to MediaTek Inc.
MediaTek LinkIt™ Smart 7688 Developer's Guide 5. Peripheral Programming on LinkIt Smart 7688 This chapter describes how to program the peripheral sensors on the LinkIt Smart 7688 board. From the hardware aspect, MediaTek MT7688 SOC on the LinkIt Smart 7688 board handles all the Wi-Fi communication, USB device control, SD card access and sensor connection. As shown in Figure 42. Related software stacks are provided for developers to access the sensors attached to the MT7688.
MediaTek LinkIt™ Smart 7688 Developer's Guide 5.1.1. Installing MRAA Libmraa is already installed in the system image of LinkIt Smart 7688, so you don't need to install it again. However if you want to update the library, or want to port or upgrade the library, please refer to libmraa for more information. To use libmraa in Python, you need to import it. In the below example, libmraa is imported and the output is the build version of the mraa: import mraa print (mraa.
MediaTek LinkIt™ Smart 7688 Developer's Guide 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 44 (WLED_N) to GPIO mode and execute the following code: import mraa import time # Refer to the pinout digram for the GPIO number to silk print mapping # in this example the number 44 maps to Wi-Fi LED. pin = mraa.Gpio(44) pin.dir(mraa.DIR_OUT) while True: pin.write(1) time.sleep(1) pin.write(0) time.
MediaTek LinkIt™ Smart 7688 Developer's Guide while(True): time.sleep(1) # simply wait for interrupt • PWM Use PWM module to generate a pulse width modulated signal pattern. 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 18, 19, 20, 21 supports PWM on LinkIt Smart 7688. To control the PWM pattern, several parameters are required, including: o Period This defines the carrier frequency of the modulation.
MediaTek LinkIt™ Smart 7688 Developer's Guide import mraa i2c = mraa.I2c(0) # Grove - 3-Axis Digital Accelerometer(+-16g) # is a ADXL345 configured to I2C address 0x53. i2c.address(0x53) # The device ID should be if 0xE5 == i2c.readReg(0x00): print "Grove - 3-Axis Digital Accelerometer found on I2C Bus" else: print "Grove - 3-Axis Digital Accelerometer not found" For more details on I2C API, please see here. To drive an I2C device, you need to operate multiple I2C sequences.
MediaTek LinkIt™ Smart 7688 Developer's Guide 2) In the root@myLinkIt:~/app# prompt, create a file named blink.py by entering the following command. vim blink.py 3) Press i to insert the below codes in the editor. For example: import mraa import time # Refer to the pinout digram for the GPIO number to silk print mapping # in this example the number 44 maps to Wi-Fi LED led = mraa.Gpio(44) led.dir(mraa.DIR_OUT) # set direction to output while True: led.write(1) time.sleep(1) led.write(0) time.
MediaTek LinkIt™ Smart 7688 Developer's Guide npm init After about 10 seconds, you’ll be prompted to enter several inputs such as a name for app, version and description etc. as shown in Figure 43. This is a set up process for the node application. For this tutorial, press enter for all questions. Figure 43 Set up the Node.js application prompt 8) In the root@myLinkIt:~/app# prompt, create a file named app.js by entering the following command. vim app.
MediaTek LinkIt™ Smart 7688 Developer's Guide 11) Now you’re ready to run this Node.js application. In the app directory, type following command to run app.js: node app The W-Fi LED on LinkIt Smart 7688 should blink every second. Press C to terminate the program.. 5.2. How to use UPM to access sensors and peripherals UPM is an open source sensor and peripheral driver repository based on libmraa APIs.
MediaTek LinkIt™ Smart 7688 Developer's Guide You should see the acceleration value printed repeatedly. Try moving the sensor around to see changes in the values – now you can use the sensor to detect accelerations. For a list of other available Python modules in UPM repository, check here. The UPM repository also comes with a handful of examples for your reference. © 2015, 2016 MediaTek Inc. Page 67 This document contains information that is proprietary to MediaTek Inc.
MediaTek LinkIt™ Smart 7688 Developer's Guide 6. Peripheral Programming on LinkIt Smart 7688 Duo This chapter describes how to program the peripheral sensors connected to the ATmega32U4 microcontroller and how to communicate between the microcontroller and the MT7688, as shown in Figure 44.
MediaTek LinkIt™ Smart 7688 Developer's Guide Figure 45 LinkIt Smart 7688 package URL for a custom board installation in Arduino IDE 2) Make sure your computer is connected to the internet. 3) In the Arduino Tools menu point to Board then click Boards Manager as shown in Figure 46. Figure 46 Arduino IDE Board Manager Menu 4) LinkIt Smart 7688 board support package starts downloading automatically and it may take several seconds for the Boards Manager to download the repository.
MediaTek LinkIt™ Smart 7688 Developer's Guide If there is a downloading error (see below), remove the cached .json file. The location of the cached .json file is the same as the location of the preferences.txt file. It can be found in the Arduino IDE under the File menu by clicking Preferences. Error downloading the LinkIt ONE SDK package 5) There should now be a LinkIt Smart 7688 item appearing in the boards list on the Boards Manager as shown in Figure 47.
MediaTek LinkIt™ Smart 7688 Developer's Guide Figure 48 LinkIt Smart 7688 board package installed on Arduino IDE If there is a problem with the LinkIt Smart 7688 board package installation, try installing Arduino SAM board package first, as shown below. Then retry LinkIt Smart 7688 installation. Problem downloading the SDK after the cached .json file is removed 7) You now have the LinkIt Smart 7688 installed on Arduino IDE as show in Figure 49. © 2015, 2016 MediaTek Inc.
MediaTek LinkIt™ Smart 7688 Developer's Guide Figure 49 LinkIt Smart 7688 Duo installed on Arduino IDE 6.3.
MediaTek LinkIt™ Smart 7688 Developer's Guide Figure 50 Arduino Preference Location • Right click on the linkit_smart_7688.inf and select install, a security windows appears and click Install this driver software anyway. As shown in Figure 51. This completes the driver installation. Figure 51 Driver installation • For Ubuntu Linux, it should work without installing a driver. LinkIt Smart 7688 should be in /dev folder and mounted as ttyUSB0. The number 0 may be different on each Ubuntu machine.
MediaTek LinkIt™ Smart 7688 Developer's Guide Arduino programming through Arduino IDE, as shown in Figure 52. Depending on different applications and approaches in programming, three scenarios are listed for your reference for building your software system. Figure 52 LinkIt Smart 7688 Duo Hardware Architecture Scenario #1: Through primitive UART connection Since MT7688 and ATmega32U4 are connected through a UART port, you can issue commands from the application written in Python, Node.
MediaTek LinkIt™ Smart 7688 Developer's Guide programming in Python, Node.js and C can choose a language they prefer to use Firmata to run the MPU and the MCU communication without having to deal with details of the UART command implementation and MCU side programming, as shown in Figure 54. For example, Cylon.js is a popular Node.js framework for Robotics application. It uses Firmata to implement the communication between MPU and MCU and thus alleviates Node.
MediaTek LinkIt™ Smart 7688 Developer's Guide 6.5. Programming with Primitive UART Connection In all the scenarios described in previous section, the MPU and MCU on LinkIt Smart 7688 Duo communicates using Serial port. The MCU communicates with OpenWrt Linux over UART hardware.
MediaTek LinkIt™ Smart 7688 Developer's Guide Figure 56 Upload Sketch in Arduino IDE 6.5.2. Blink Program – Linux Side As describe in chapter 4, “General Programming Guide”, you can program the Linux side using many languages, including C/C++, Python or Node.js. In this example, Python is used to illustrate a program that sends command to the MCU (Arduino) side to make the LED blink. 1) Use a text editor of your choice and create a new file, then copy the following code and save it.
MediaTek LinkIt™ Smart 7688 Developer's Guide global s # open serial COM port to /dev/ttyS0, which maps to UART0(D0/D1) # the baudrate is set to 57600 and should be the same as the one # specified in the Arduino sketch uploaded to ATmega32U4. s = serial.Serial("/dev/ttyS0", 57600) def loop(): # send "1" to the Arduino sketch on ATmega32U4. # the sketch will turn on the LED attached to D13 on the board s.write("1") time.sleep(1) # send "0" to the sketch to turn off the LED s.write("0") time.
MediaTek LinkIt™ Smart 7688 Developer's Guide 6.6.2. Prototype The diagram, as shown in Figure 57, illustrates how the MPU and MCU in LinkIt Smart 7688 Duo communicate with each other using Firmata protocol and Python. Figure 57 MPU MCU Communication Diagram 6.6.3. Setup Your Development Environment LinkIt Smart 7688 Duo supports Arduino 1.6.5 and Python 2.7. Firmata protocol requires implementation on the MPU and the MCU. To begin, you’ll need to install software to program the MCU.
MediaTek LinkIt™ Smart 7688 Developer's Guide This is a Python interface for the Firmata protocol used on the MPU. You can install it by typing pip install PyMata in the console. At the time of writing, LinkIt Smart 7688 Duo supports version pymata-2.1. Note: The LinkIt Smart 7688 Duo needs to be in Station mode in order to use pip to install the pyFirmata and PyMata interface, please see section 4.3.2, “Station Mode” for details on how to set station mode. 6.6.4.
MediaTek LinkIt™ Smart 7688 Developer's Guide board.digital[13].write(0) sleep(0.5) 3) Now execute this Python script and you should see following message: $python ./blink_with_firmata.py Start blinking D13 If you see the LED on D13 of the LinkIt Smart 7688 Duo blink accordingly, congratulations. You’ve successfully ran the blink example. To terminate the Python program, press Ctrl-C. 6.6.5.
MediaTek LinkIt™ Smart 7688 Developer's Guide 4) Upload the sketch. After uploading the sketch, Arduino is ready to receive commands from the Linux side. • Running Blink Example Using PyMata After you’ve installed PyMata libraries and changed the serial port in Arduino, you’re ready to run the blink example using PyMata. Download blink example to LinkIt Smart 7688 Duo. 1) You’ll also need to change the serial port used in this example to work on LinkIt Smart 7688 Duo.
MediaTek LinkIt™ Smart 7688 Developer's Guide If you see the LED on D13 of the LinkIt Smart 7688 Duo blink 10 times before the Python program terminates, congratulations. You’ve successfully ran the blink example. Please continue to explore more examples in the PyMata/examples you’ve downloaded earlier. Just remember to change the serial port to/dev/ttyS0, and keep in mind the hardware differences between LinkIt Smart 7688 Duo and Arduino Uno: o LinkIt Smart 7688 Duo operates in 3.
MediaTek LinkIt™ Smart 7688 Developer's Guide Figure 59 Uploading example sketch in Arduino IDE 4) Set up the MPU, for this you’ll need to install Firmata on your computer. While you can install Firmata using NPM on LinkIt Smart 7688 Duo, the process is a bit long, that’s why you should install NPM on your computer instead and do the Firmata installation from there. In your host computer, create a folder called testfirmata and switch to the directory.
MediaTek LinkIt™ Smart 7688 Developer's Guide 7) Remove node-serial port by typing the following command. $ rm –rf ./node_modules/firmata/node_modules/serialport Firmata has a built in node-serial port and when you installed Firmata, it creates a compile file on your computer. However, this compile file needs to be removed because it’s already built in LinkIt Smart 7688. 8) Compress the Firmata folder $ tar –cvf ./firmata.tar .
MediaTek LinkIt™ Smart 7688 Developer's Guide console.log('board.firmware: ', board.firmware); board.pinMode(ledPin, board.MODES.OUTPUT); var url = require('url'); var http = require('http'); http.createServer(function(request, response) { var params = url.parse(request.url, true).query; if (params.value.toLowerCase() == 'high') { board.digitalWrite(ledPin, board.HIGH); } else { board.digitalWrite(ledPin, board.LOW); } response.writeHead(200); response.write("The value written was: " + params.
MediaTek LinkIt™ Smart 7688 Developer's Guide needed to communicate with the hardware attached to Arduino. While you can install Firmata and Cylon using NPM on LinkIt Smart 7688 Duo, the process is a bit long, that’s why you should install NPM on your computer instead and install Firmata and the Cylon modules from there. The steps to install Firmata are already described in section 6.6.6, “Node.js example” and it’s the same for Cylon. Therefore, only Cylon example is used below.
MediaTek LinkIt™ Smart 7688 Developer's Guide 9) Set up the MPU, start by opening the SSH console and create a folder app, # is the console prompt and is not part of the command. # mkdir app && cd app 10) Create a file app.js and open text editor by typing: # vim app.js 11) Press i and copy the following example in the text editor: var Cylon = require('cylon'); Cylon.
MediaTek LinkIt™ Smart 7688 Developer's Guide 6.6.9. Using LinkIt Smart 7688 Duo to program boot loader on another LinkIt Smart 7688 Duo In the following example, there are two LinkIt Smart 7688 Duo boards called A and B. The first board A will act as the programmer to program the second board B.
MediaTek LinkIt™ Smart 7688 Developer's Guide Figure 60 Programming boot loader using AVRDUDE Please refer to AVRDUDE package for detailed information. 6.7. Programming with Yun Bridge Library LinkIt Smart 7688 Duo can also facilitate the Yun Bridge library to a certain degree. To make the Bridge library work, you’ll need to configure the system to allow various Bridge related services to run.
MediaTek LinkIt™ Smart 7688 Developer's Guide 03:42:06 The output time stamp should be the same as the Linux system time stamp. You can also try other examples of the Bridge library. Note that some scripts and services may act differently on the default system image, so you may need to modify the sketch files accordingly.
MediaTek LinkIt™ Smart 7688 Developer's Guide 7. Troubleshooting Guide 7.1. My firmware upgrade won’t start or failed. Why? If you’re using a USB drive to upgrade firmware, please make sure you’ve checked the following: • The USB host cable that connects to the USB drive is firmly attached • The USB power/host cable is securely attached to the Power connector and not the Host connector of the board.
MediaTek LinkIt™ Smart 7688 Developer's Guide 7.4. I’m not able to SSH access with an error showing “Host Identification Has Changed”, what can I do? If you see an error message similar to below as shown in Figure 58: Figure 62 Host ID change warning It indicates you’ve used a different LinkIt Smart 7688 board or upgraded a new firmware and tried to access system console using SSH.
MediaTek LinkIt™ Smart 7688 Developer's Guide 7.5. There are multiple LinkIt Smart 7688 APs nearby and I’m not sure which one is mine, how do I find out? To find the hardware address of the board, type ifconfig in the system console. The hardware address should show in the first sentence under ra0, as shown in Figure 64. The last three set of numbers should match your board’s AP name. Figure 64 Finding LinkIt Smart 7688 hardware address 7.6.
MediaTek LinkIt™ Smart 7688 Developer's Guide 1) Attempt to reboot the board using the MPU reset button. 2) Attempt to reboot the board using the boot loader. 3) Contact Seed Studio. Remember also to check the Labs forum for posts on possible causes and cures. © 2015, 2016 MediaTek Inc. Page 95 This document contains information that is proprietary to MediaTek Inc. Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
MediaTek LinkIt™ Smart 7688 Developer's Guide Appendix A Federal Communication Commission Interference Statement This device complies with Part 15 of the FCC Rules. Operation is subject to the following two conditions: (1) This device may not cause harmful interference, and (2) this device must accept any interference received, including interference that may cause undesired operation.
MediaTek LinkIt™ Smart 7688 Developer's Guide IMPORTANT NOTE: In the event that these conditions can not be met (for example certain laptop configurations or co-location with another transmitter), then the FCC authorization is no longer considered valid and the FCC ID can not be used on the final product. In these circumstances, the OEM integrator will be responsible for re-evaluating the end product (including the transmitter) and obtaining a separate FCC authorization.