datasheet for Mirabox by PlugComputer

MiraBox User Guide –page1 / 28
MiraBox User Guide
-Sep18, 2012
Table of Contents
A. Package contents .............................................................................................................................................. 2
B. MiraBox appearance and connecting ports ................................................................................................... 4
C. LED indication .................................................................................................................................................... 6
D. System console and debugging ...................................................................................................................... 7
1.
Driver and tool installation..................................................................................................................................... 7
2.
Go into debugging console. ................................................................................................................................ 10
3.
WiFi AP mode testing......................................................................................................................................... 11
4.
WIFI Client mode testing .................................................................................................................................... 13
5.
Bluetooth testing ................................................................................................................................................ 16
6.
Gigabit ethernet ports......................................................................................................................................... 17
7.
USB 3.0 port ..................................................................................................................................................... 18
8.
Multi-IO port ...................................................................................................................................................... 19
9.
Reset................................................................................................................................................................ 27
10.
Download sites .............................................................................................................................................. 28
MiraBox User Guide –page2 / 28
A. Package contents
1
Standard package contents
2
5
1
MiraBoxstandard content List
Remark
1
MiraBox
1 unit
Mirabox main unit
2
AC-DC Power Adapter
1 pc
Input 90-240VAC / output 5V,3A DC
3
Ethernet Cable
1 pc
Cat 5e
4
USB3.0 Cable
1 pc
5
Mini-USB Cable
1 pc
6
Quick reference card
1 pc
7
Warranty card
1 pc
For debug console use
3
4
MiraBox User Guide –page3 / 28
2. Optional package contents
6
7
8
MiraBox Optional Content List
6
Multi I/O Cable
1 pc
Connect from MiraBox to JTAG/GPIO box
7
GPIO Cable
1 pc
For GPIO port connection
8
MiraBox JTAG/GPIO box
1 pc
External JTAG/GPIO box for debugging
MiraBox User Guide –page4 / 28
B. MiraBox appearance and connecting ports
6
5
4
3
2
1
MiraBox User Guide –page5 / 28
9
7
8
Mirabox ports description
Connection port
Description
Remark
1
Power Port
DC 5V/3A port
2
RJ45 #1
Gigabit Ethernet port1
3
RJ45 #2
Gigabit Ethernet port2
4
USB 3.0 port#1
USB 3.0 high speed host
5
USB 3.0 port#2
USB 3.0 high speed host
6
Mini USB console port
Debug console
Connect to PC USB port
7
Multi-I/O port
JTAG and GPIO port
Connect to external JTAG/GPIO box for system
development.
8
Micro SD slot
External Micro-SD slot
9
Reset button hole
System reset button
Reset through GPIO
MiraBox User Guide –page6 / 28
C. LED indication
3
2
1
LED indication table
LED
Color/ Pattern
Description
1
Power on LED
Solid green
Upon power on, this LED lights up
2
WiFi AP
Blinking blue
Indicate WiFi AP mode is activated as default after boot up
Off
WiFi AP mode is not activated
Blinking green
WiFi client mode is activated
Off
WiFi client mode is not activated
3
WiFi client
MiraBox User Guide –page7 / 28
D. System console and debugging
1. Driver and tool installation.
(1) Prepare one Windows PC
(2) Download the serial communication tool “putty.exe”.
(3) Download the driver “2KXPVDock.exe”forProlific-USB-to-Serial-Comm-Portat our Website.
http://www.globalscaletechnologies.com/t-downloads.aspx
(4) Install driver on your PC (only for the first time)
(4-1)
Connect Mirabox to your Windows PC
Connect Mini USB cable here.The other end
connects to computer’s USB port.
(4-2)
The first time when you connect Mirabox to the Windows computer you will be asked to install the
driver
MiraBox User Guide –page8 / 28
(4-3)
Run file “2KXPVDock.exe”and the driver will be installed to the PATH
C:\cabs\2KXPVDock”.
Click さNextざ to complete t
(5) Find out the com port of your debugger on your windows PC.
(5-1)
Right click [My Computer]  [Properties]  [Hardware]  [Device Manager]
MiraBox User Guide –page9 / 28
(5-2)
Find out your com port as below (here is com3 for example)
(6) Run “putty.exe” and configure as below on your Windows PC.
The “Serial line” should be
configured the same as the
COM port in Device Manager
Give it a name and save for
easy execution next time
Click
open
MiraBox User Guide –page10 / 28
2. Debugging console.
(1) Power on the MiraBox and you will see messages on screen as below
(2) You can press any key to stop auto-boot when you see the bootdelay timer is counting down.
After entering the uboot prompt, you can also change the uboot environment variables such as bootdelay
time, Ipaddr, serverip and so on.
(3) If no key was pressed to interrupt the uboot, it will continue running to the login screen where urges you to
input the login name and password, here is the default login information.
Login :root
Password: nosoup4u
MiraBox User Guide –page11 / 28
(4) Now you are the root user and have the full control of the mirabox
3. WiFi AP mode testing
MiraBox Server has a built-in WiFi module which is in compliance with 802.11 b/g/n standard. The WiFi can
work as client or AP mode but only one at a time. The default mode is AP mode every time when it powers on, and
the indication light D6 is blinking blue.
Here are steps for testing:
(1) Enter command and you will see message for uap0 device.
# ifconfig
(2) Prepare one computer installed with a Wi-Fi Lan card, here we use a computer with a Windows XP operating
system for example.
(3) Go to “Network Connections” as shown below..
1. Select “Local Area connection 4”
MiraBox User Guide –page12 / 28
2. Select “View Available Wireless Networks”
3. Choose name with “mira-uAP-6344”, here digits”6344” is the last
four digits of MAC address for the MiraBox WiFi
Then click “Connect”.
4. Successfully connected.
MiraBox User Guide –page13 / 28
4. WIFI Client mode testing
(1) Switch to WiFi client mode by giving command as following.
# wlan.sh
When done successfully, the LED(D7) is blinking green and mlan0 is activated.
(2) To check mlan0 with ifconfig command
# ifconfig
MiraBox User Guide –page14 / 28
(3) Scan for WiFi AP near-by
# iwlist mlan0 scan
MiraBox User Guide –page15 / 28
(4) Connect to WiFi AP
# iwconfig mlan0 essid<AP’s ID>
# dhclient mlan0
# ifconfig mlan0
#ping 192.168.1.1
The below screenshot is an example for how to connect a mlan device. If you can see IP address (for example:
192.168.1.102) means you have already connected and got an IP.
(5) Switch back to WiFi AP mode
There are two useful script files:
Client_ap.sh – switch from wifi client mode to wifi AP mode
Wlan.sh – switch from wifi AP mode to wifi client mode
MiraBox User Guide –page16 / 28
5. Bluetooth testing
There is bluetooth chip built-in Mirabox but disabled as default.
(1) Enable the Bluetooth function.
# turnon_bt.sh
# hcitool -i hci0 dev
If you see the message like this
means your Bluetooth is up and run
(2) Scan near-by Bluetooth devices
a. Please turn on the Bluetooth device such as your mobile phone, BT earphone or laptop computer then
put it into “to be discovered” mode
b. Giving command as following on your Mirabox
# hciconfig
# hcitool-i hci0 scan --flush
Normally, the Bluetooth devices near-by will be searched and shown as below.
This is a mobile phone with
Bluetooth enabled that is
found
# sdptool browse
This command shows the protocol of Bluetooth device found.
MiraBox User Guide –page17 / 28
6. Gigabit Ethernet ports
(1) Connect the two Gigabit Ethernet ports to Gigabit switch by Network cables. Normally it will get an IP
address assigned by DHCP.
Enter command as below to check:
# ifconfig
(2) Testing the speed of Gigabit Ethernet ports
# ethtool eth0
Normally you will see the information as below:
MiraBox User Guide –page18 / 28
7. USB 3.0 port
(1) Plug in the usb3.0 hard disk or flash disk to the USB port then you can see some driver messages as below
of this device
(2) View the usb3.0 hard disk
# fdisk-l
you will see below messages of the usb3.0 device which is usually shown as /dev/sdb* /dev/sdc*.
(3) Testing the access speed of the usb3.0 ports
# hdparm-t /dev/sdc1
MiraBox User Guide –page19 / 28
8. Multi-IO port
Connect the MIRABOX JTAG/GPIO box to the Multi-IO port via Multi-IO cable.
Multi-I/O port
Multi-I/O Cable
MiraBox JTAG/GPIO box
9. Multi-IO port- JTAG interface
Please connect the debugger to the 20-pin JTAG slot as shown in the picture, here we use the
Marvell BlackStone debugger and XDB(Marvell eXtreme Debugger 5.1) software on Windows PC for
example.
MiraBox User Guide –page20 / 28
Debugger connection
MiraBox
Marvell
BlackStone
debugger
MiraBox JTAG
GPIO
Run XDB on Windows PC
MiraBox User Guide –page21 / 28
10. GPIO interface and control
(1) LED demo program
There is a demo program to show the GPIO LEDs by entering command as below:
# ledtest1
This will light up all the LEDs
(2) Write a simple program to control the LED
GPIO port 0
GPIO port 4
GPIO port 3
GPIO port 2
GPIO port 1
In this GPIO box we use NXP PCA9505 I/O port expansion IC to provide 40-bit parallel input/output GPIOs.
Please download the datasheet to get the detailed description for this chip.
MiraBox User Guide –page22 / 28
a. Prepare a pc with linux Fedora 14 installed, and download the cross tool chain
“arm-marvell-linux-gnueabi-vfp.tar.bz2” from our website
http://www.plugcomputer.org/downloads/d2plug/
or
http://www.globalscaletechnologies.com
b. Install and configure the tool chain
Copy “arm-marvell-linux-gnueabi-vfp.tar.bz2” to directory /opt
# cd /opt
# tar –jxf arm-marvell-linux-gnueabi-vfp.tar.bz2
# ls
# vim /root/.bashrc
Add “export PATH=$PATH:/opt/arm-marvell-linux-gnueabi-vfp/bin” to last line as below, then save and
exit.
Enable the PATH
# source /root/.bash_profile
c.
Write a program
Here is the sample program named “i2c_led.c”
MiraBox User Guide –page23 / 28
/*i2c_led.c*GTI--Globalscaletechnologies.,INC**/
#include <stdio.h>
#include <linux/types.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <errno.h>
#define I2C_RETRIES 0x0701
#define I2C_TIMEOUT 0x0702
#define I2C_RDWR 0x0707
#define I2C_M_RD 0x0001
#define I2C_M_NOSTART
0x4000
/* if I2C_FUNC_PROTOCOL_MANGLING */
#define I2C_M_REV_DIR_ADDR 0x2000
/* if I2C_FUNC_PROTOCOL_MANGLING */
#define I2C_M_IGNORE_NAK 0x1000
/* if I2C_FUNC_PROTOCOL_MANGLING */
#define I2C_M_NO_RD_ACK
#define I2C_M_RECV_LEN
0x0800
/* if I2C_FUNC_PROTOCOL_MANGLING */
0x0400
/* length will be first received byte */
/*********define struct i2c_rdwr_ioctl_data and struct i2c_msg
struct i2c_msg
{
unsigned short addr;
unsigned short flags;
#define I2C_M_TEN 0x0010
unsigned short len;
unsigned char *buf;
};
struct i2c_rdwr_ioctl_data
{
struct i2c_msg *msgs;
intnmsgs;/* the nmsgs decide the num of start signal*/
};
/***********the main program***********/
int main()
{
intfd,ret;
they must be consistent to kernel*******/
MiraBox User Guide –page24 / 28
struct i2c_rdwr_ioctl_data e2prom_data;
fd=open("/dev/i2c-0",O_RDWR);/*
/dev/i2c-0 is registered to the system */
if(fd<0)
{
perror("open error");
}
e2prom_data.nmsgs=2;
e2prom_data.msgs=(struct i2c_msg*)malloc(e2prom_data.nmsgs*sizeof(struct i2c_msg));
if(!e2prom_data.msgs)
{
perror("malloc error");
exit(1);
}
ioctl(fd,I2C_TIMEOUT,1);/*timeout */
ioctl(fd,I2C_RETRIES,2);/*retries times*/
/***write data to e2prom**/
e2prom_data.nmsgs=1;
(e2prom_data.msgs[0]).len=2;
(e2prom_data.msgs[0]).addr=0x25;//e2prom device address
(e2prom_data.msgs[0]).flags=0;
//write
(e2prom_data.msgs[0]).buf=(unsigned char*)malloc(2);
/***********
control the GPIO OP-0 **************************************/
(e2prom_data.msgs[0]).buf[0]=0x18;// e2prom write address
(e2prom_data.msgs[0]).buf[1]=0x0;//the data to write
ret=ioctl(fd,I2C_RDWR,(unsigned long)&e2prom_data);
if(ret<0)
{
perror("ioctl error2");
}
/***********
control the GPIO OP-1 **************************************/
(e2prom_data.msgs[0]).buf[0]=0x19;// e2prom write address
(e2prom_data.msgs[0]).buf[1]=0x0;//the data to write
ret=ioctl(fd,I2C_RDWR,(unsigned long)&e2prom_data);
if(ret<0)
{
perror("ioctl error2");
}
MiraBox User Guide –page25 / 28
/***********
control the GPIO OP-2 **************************************/
//turn on LED
(e2prom_data.msgs[0]).buf[0]=0x1a;// e2prom write address
(e2prom_data.msgs[0]).buf[1]=0x0;//the data to write
ret=ioctl(fd,I2C_RDWR,(unsigned long)&e2prom_data);
if(ret<0)
{
perror("ioctl error3");
}
//turn off LED
sleep(1);
//delay 1 second
(e2prom_data.msgs[0]).buf[0]=0x1a;// e2prom write address
(e2prom_data.msgs[0]).buf[1]=0xFF;//the data to write
ret=ioctl(fd,I2C_RDWR,(unsigned long)&e2prom_data);
if(ret<0)
{
perror("ioctl error3");
}
/***********
control the GPIO OP-3 **************************************/
//turn on LED
sleep(1);
(e2prom_data.msgs[0]).buf[0]=0x1b;// e2prom write address
(e2prom_data.msgs[0]).buf[1]=0x0;//the data to write
ret=ioctl(fd,I2C_RDWR,(unsigned long)&e2prom_data);
if(ret<0)
{
perror("ioctl error4");
}
//turn off LED
sleep(1);
(e2prom_data.msgs[0]).buf[0]=0x1b;// e2prom write address
(e2prom_data.msgs[0]).buf[1]=0xFF;//the data to write
ret=ioctl(fd,I2C_RDWR,(unsigned long)&e2prom_data);
if(ret<0)
{
perror("ioctl error4");
}
MiraBox User Guide –page26 / 28
/***********
control the GPIO OP-4 **************************************/
//turn on LED
sleep(1);
(e2prom_data.msgs[0]).buf[0]=0x1c;// e2prom write address
(e2prom_data.msgs[0]).buf[1]=0x0;//the data to write
ret=ioctl(fd,I2C_RDWR,(unsigned long)&e2prom_data);
if(ret<0)
{
perror("ioctl error5");
}
//turn off LED
sleep(1);
(e2prom_data.msgs[0]).buf[0]=0x1c;// e2prom write address
(e2prom_data.msgs[0]).buf[1]=0xFF;// the data to write
ret=ioctl(fd,I2C_RDWR,(unsigned long)&e2prom_data);
if(ret<0)
{
perror("ioctl error5");
}
printf("testing ok\n");
close(fd);
return 0;
}
Give this program the name
“i2c_led.c” and save to “/home”
directory then compile it .
# cd /home
# arm-marvell-linux-gnueabi-gcc -o led i2c_led.c
Then copy the executable file “led” to Mirabox and run it. You can see the LED is controlled by yourself.
MiraBox User Guide –page27 / 28
11. Reset
6 GPIO reset button hole.
(1) GPIO reset button
The reset button is connected to one GPIO which means controlled by software.
When you press down this button by using a sharp pin, it arouses attention of CPU then CPU asserts the master
reset low signal to start the system reset session.
Below is the reboot screen after reset
Note: Since this reset function is controlled by software so it has no effect during boot-up session.
(2) More push button functions
System developer can program this button to have more functions by different press-then-release delay time.
MiraBox User Guide –page28 / 28
12. Download sites
To download the files for MiraBox server, please visit:
http://www.globalscaletechnologies.com/t-downloads.aspx
Other useful resource links are:
http://www.plugcomputer.org/
http://plugcomputer.org/plugwiki/index.php/GuruPlug