Monday, October 31, 2016

MediaTek LinkIt Smart 7688 Duo - First Application

Hardware: MediaTek LinkIt Smart 7688 Duo

Firmware: 0.9.3

Software: Windows 10 / Putty

The documentation from MediaTek is both wonderful and horrible. It is wonderful in that there seems to be a lot of it. It is horrible in that there are glaring holes in it and lots of errors.

To get your first application running you'll need to first follow the instructions I laid out in my other post on setting up your development environment here.

The first application in their documentation shows how to send data to the Arduino side of the unit from the Python side.  It uses a serial connection to pass a 1 or a 0 over from the Python side to tell the Arduino side to turn an LED on/off.  While this is very basic, it is a good outline of how this board is intended to be used.  Do the higher-level decision-making and external communications on the Linux/Python side and then let the low-level manipulations happen on the Arduino/C side.

Arduino Code

To get the first test application working, copy/paste the following into the Arduino sketch app and upload to the board:

void setup() {
Serial.begin(115200); // open serial connection to USB
//port(connected to your computer)

                                //(not actually used here)
Serial1.begin(57600); // open internal serial connection to

pinMode(13, OUTPUT); // in MT7688, this maps to device
void loop() {
int c =; // read from MT7688
if (c != -1) {
switch(c) {
case '0': // turn off D13 when receiving "0"
digitalWrite(13, 0);
case '1': // turn on D13 when receiving "1"
digitalWrite(13, 1);

This is essentially exactly what they indicate in their instructions and works fine. The next area in their instructions is wrong.

Python Code

Go into Putty ( and connect to the board using: root/{yourpassword}

Type vim <Enter>
Press i
Select/copy the following code below then right-click in your Putty window to paste in the following Python code:

import serial
import time
s = None
def setup():
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
# send "0" to the sketch to turn off the LED
if _name_ == '__main__':
while True:

Hit the <Esc> key
Type :wq! <Enter>
Type python ./

The LED near the main chip/shield (right-hand side if looking at the PWR plug) will start slowing blinking on/off every 1 second.

CTRL-C to quit (time it right and you'll wind up w/ the LED stuck on)

One thing worth noting is that the Arduino/MCU code at first glance appears to also listen to your PC's serial port for 0's or 1's (it doesn't, but you can modify it to do so).

No comments:

Post a Comment