Programming With Primitive Uart Connection - MEDIATEK LinkIt Smart 7688 Developer's Manual

Hide thumbs Also See for LinkIt Smart 7688:
Table of Contents

Advertisement

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. Table 17 illustrates the communication between MCU and MPU:
MCU
In Arduino
Corresponding Pins
In the following section an example is provided to demonstrate how to communicate between the
MCU and MPU side by writing to and reading from the primitive UART connection.
6.5.1. Blink Program - Arduino Side
The MCU side is written as an Arduino sketch. In this example, the sketch simply listens to the
command sent from the MPU (Linux) side and switches the on-board LED accordingly.
First, connect the LinkIt Smart 7688 Duo to your PC, then open Arduino IDE and paste the
1)
following sketch code into the IDE:
void setup() {
Serial.begin(115200);
(connected to your computer)
Serial1.begin(57600);
pinMode(13, OUTPUT);
}
void loop() {
int c = Serial1.read();
if (c != -1) {
switch(c) {
case '0':
digitalWrite(13, 0);
break;
case '1':
digitalWrite(13, 1);
break;
}
}
}
Then choose the correct COM port from the IDE (check your device manager) by clicking
2)
Tools > Port.
Upload the sketch to the board as shown in Figure 56. Note the board is not blinking yet –
3)
you'll need to write a program in the Linux side to make it blink, which is the next step.
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
Serial1
D0 and D1
Table 17 MCU and MPU Communication
// open serial connection to USB Serial port
// open internal serial connection to MT7688
// in MT7688, this maps to device
// read from MT7688
// turn off D13 when receiving "0"
// turn off D13 when receiving "1"
© 2015, 2016 MediaTek Inc.
MPU
In Linux
Pin MUX
/dev/ttyS0
UART0 (GPIO12 and
GPIO13)
Page 76

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents