From LinkSprite Playgound
Jump to: navigation, search




WRTnode, which is based on Wi-Fi AP-Soc, is an open source development board hardware. There is a mediatek MT7620n chip in it.

It is mini, cheap and has pretty low power consumption and reasonable capability of computing. Besides, It is born to high speed of Wi-Fi network exchange.

What does WRTnode aim for? Maybe different people have different opinions. Our team considers it as a high speed and digital version of "Arduino". Since it could connect and interact with USB devices like camera and sound card, we can collect images and voices at the same time and stream out multimedia stream in real time. After a layer of A / D converter, It could directly interact with physical world like all kinds of sensors and motors.

OpenWrt, which is a distribution of embedded Linux, is the system of WRTnode. When multimedia information and various of input and output control focus on a Linux system which has small volume, low power consumption and enough computing capacity, after porting and optimizing the existing pattern recognition, artificial intelligence and other applications, we may setup a series of interesting "smart" devices. And they are supplemented by powerful network capabilities. we may get a structure of MATRIX and NODE. This is where the node in WRTnode comes from.

We pronounce WRTnode as what-node.

As an OpenWrt supported device, WRTnode applies everything on wiki.openwrt.org. We highly recommended take wiki.OpenWrt.org as the trusted reference.


  • WRTnode is based on Wi-Fi AP-Soc and it is an open source development board hardware.
  • Opensource hardware for OpenWrt
  • mini Linux + Wi-Fi board
  • easy and completed IDE
  • smart machines' heart
  • low power consuming
  • complete I/Os, high performance
  • 300MBit/s Wi-Fi and low price


Hardware parameters


  • 45mm*50mm
  • MTK MT7620N 580MHz MIPS CPU (MIPS24KEc)
  • 512Mbit DDR2 ram
  • 128Mbit SPI Flash rom
  • 300Mbit Wi-Fi 2T2R 802.11n 2.4 GHz
  • 23GPIOs
  • JTAG
  • SPI
  • UART Lite
  • USB2.0 host

Software Environment

  • Based on OpenWrt BARRIER BREAKER (Bleeding Edge, r41508)
  • rt2860v2 Wi-Fi driver hacked by lintel
  • Customized uboot hacked by manfeel
  • WRTnode aplci up-link Wi-Fi configuration (aps/vw/nr/ia)
  • Luci Wi-Fi wpa patch for rt2860v2
  • Local dns add i.wrtno.de & wrtnode.lan besides openwrt.lan to WRTnode which the default ip is
  • WRTnode additional feature (all source opened github.com/WRTnode):
  • Opencv 2.4.8
  • Native gcc-mipsel on mt7620 and bin-utils
  • Porting linino (Arduino yun) source to WRTnode
  • Shine: fast fixed-point mp3 encoding
  • And some WRTnode demo apps:
  • opencv application demo
  • mechanical control demo
  • RESTful front-end demo and some other thing

WRTnode firmware, SDK and cross-compiler toolchain using OpenWrt trunk version, designed for WRTnode maintenance and support by OpenWrt.org official. Meanwhile, WRTnode can use the market all the programs using the MT7620 router firmware and associated SDK and cross-compiler toolchain.

Pin map

Click the pic to see full resolution version. Perspective A pin map



Starting guide

What you will get?


You get the WRTnode in a very nice transparent plastic box, inside the box you get WRTnode stickers too. The box is useful to store various small items useful for WRTnode (USB memory stick, I2C port expander module, jumpers and so on).

6.jpg 7.jpg


Besides these, you get:

The 'special' USB cable customized for WRTnode



The micro USB standard plug will be connected to the WRTnode board and to power the board itself. The USB standard type A plug will be connected to any USB wall adapter, any PC USB port, any USB 5Vdc power supply (at least 500mA (0,5A) current). The USB standard type A receptacle can connect any USB device to the WRTnode board, for example can connect a USB memory stick:


Or a USB webcam like this:


Or you can connect many more USB devices at once through a USB hub like this:


Caution: use USB hub with external 5Vdc power supply if the USB hub connects more than one USB device.

The WRTnode

The golden board is WRTnode and can be seen on the above images.

Power-up the WRTnode board

Connect the micro USB plug to the WRTnode board (if you don't need to connect USB devices to WRTnode, a normal USB data cable with micro USB can work). Connect the USB A plug of the special USB cable to a 5Vdc USB power supply (at least 500mA current - any USB port on a PC can provide this current).


WRTnode connected to a USB port using a standard micro USB data cable

After ~5 seconds, the blue LED on WRTnode will be on, that means that OpenWrt operating system is initializing on the WRTnode board. 20 seconds later, the WRTnode WiFi SSID should be visible on the WiFi networks on the PC: 'WRTnodeXXXX' (XXXX from the SSID refers to the last 4 bytes of WRTnode’s MAC address). Connect your PC or smartphone to WRTnode WiFi SSID using WPA2-PSK encryption and password '12345678'.

Let's play with WRTnode

Login to WRTnode using telnet and ssh

Use any PC with Windows, Linux or MacOS operating system, install PuTTY on Windows PC, use any Linux / MacOS terminal software on Linux / MacOS.

First ping the WRTnode to see if connection is available. The default IP of WRTnode is set to, but WRTnode is able to resolve as well i.wrtno.de, wrtnode.lan and openwrt.lan to

  ping i.wrtno.de


  ping wrtnode.lan


  ping openwrt.lan

Connect to WRTnode using telnet or SSH If you connect first time to WRTnode or you didn't set password for root user of OpenWrt, use telnet to connect:

  telnet i.wrtno.de

If you a password for root user was set, use SSH to connect:

  ssh root@i.wrtno.de

Input your root password and a similar screen should appear:


No internet no happiness

Because WRTnode may need new applications or needs to update installed applications, an Internet connection is necessary. The WRTnode will be connected to Internet through a WiFi router - you home router connected to Internet.

  root@OpenWrt:~# aps

'aps' is a WRTnode customized command which scans the WiFi SSIDs available in your area. You should see as well your home router SSID - let's name it 'OUR_WIFI'. The result should look like this:

  WRTnode AP scaner.
  Begin scaning APs, pls wait...
  APs available are...
  ra0       get_site_survey:
  Ch  SSID                             BSSID               Security               Signal(%)W-Mode  ExtCH  NT WPS DPID
  1   Tenda                            xx:xx:xx:xx:xx:xx   NONE                   70       11b/g/n ABOVE  In YES
  1   OUR_WIFI                         xx:xx:xx:xx:xx:xx   WPA2PSK/AES            96       11b/g/n NONE   In YES
  6   TP-LINK                          xx:xx:xx:xx:xx:xx   NONE                   55       11b/g   NONE   In  NO
  6   BY01                             xx:xx:xx:xx:xx:xx   NONE                   100      11b/g/n NONE   In YES
  6   Tenda_xxxxxx                     xx:xx:xx:xx:xx:xx   WPAPSK/AES             50       11b/g/n ABOVE  In  NO
  11  CU_wpFS                          xx:xx:xx:xx:xx:xx   WPAPSK/TKIPAES         70       11b/g/n NONE   In YES

Then we have to change the settings of aplci on WRTnode, aplci is configuring the up-link part of the router inside of WRTnode (that's it: WRTnode has an internal router)

  root@OpenWrt:~# vw

'vw' is a WRTnode customized command which changes /etc/config/wireless. It is used the file editor named 'vi', a standard editor for Linux, but not very comfortable to use it, therefore here are the tips:

  • delete a character: use arrow keys to move cursor under the character you want to delete, press 'x' to delete the character
  • insert a character: press 'i' (to enter on insert mode), use arrow keys to move cursor under the character, press whatever character(s) you want to insert, the character(s) will be inserted after the character where the cursor is. Finish by pressing ESC key (to quit insert mode)
  • save changes: press ':', then press 'w'
  • save changes and quit vi editor: press ':', then press 'x'
  • quit vi editor without saving changes: press ':', then press 'q'
 config wifi-device 'ra0'
       option type 'ralink'
       option mode '9'
       option channel '1'        #This is change number 1
       option txpower '100'
       option ht '20+40'
       option country 'US'
       option disabled '0'
 config wifi-iface
       option device 'ra0'
       option network 'lan'
       option mode 'ap'
       option encryption 'psk2'
       option key '12345678'
       option ApCliEnable '1'
       option ApCliSsid 'aAP'              #This is change number 2
       option ApCliAuthMode 'WPA2PSK'      #This is change number 3
       option ApCliEncrypType 'AES'        #This is change number 4
       option ApCliPassWord '87654321'     #This is change number 5
       option ssid 'WRTnodeXXXX'
  • Change number 1: set the WiFi channel to match the one from our router 'OUR_WIFI' (specified on column 'Ch' from aps output)
  • Change number 2: set the WiFi SSID to match the one from our router 'OUR_WIFI'
  • Change number 3: set the ApCliAuthMode to match the one from our router 'OUR_WIFI'

Here are the accepted parameters for ApCliAuthMode / ApCliEncrypType, from vw according to aps' security:

 aps:Security           vw:ApCliAuthMode/ApCliEncrypType
  • Change number 4: set the ApCliEncrypType to match the one from our router 'OUR_WIFI'
  • Change number 5: set the Password to match the one from our router 'OUR_WIFI' (this must be known by the router owner)

Additionally, if 'OUR_ROUTER' router uses ASCII WEP password, you will need to perform the following commands into HEX code

 root@OpenWrt:~# echo -n 'abcde' | hexdump -e '13/1 "%02x" "\n"'   #To convert abcde to 6162636465

Also uci (specific to OpenWRT operating system) can be used to change the above settings, but this is beyond the scope of this Wiki section.

  • Network reset command:
 root@OpenWrt:~# nr

'nr' is a WRTnode customized command which will reset the network side. After 5 seconds it is possible to connect again to WRTnode's SSID. Let's verify if WRTnode got an IP from router 'OUR_WIFI':

 root@OpenWrt:~# ia
 apcli0    Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx
           inet addr:  Bcast:  Mask:
           inet6 addr: xxxx::xxxx:xxxx:xxxx:xxxx/xx Scope:Link
           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:1000
           RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

Sometimes, router 'OUR_WIFI' may lease the IP after tens of seconds. Let's verify if WRTnode is connected to Internet.

 root@OpenWrt:~# ping baidu.com
 PING baidu.com ( 56 data bytes
 64 bytes from seq=0 ttl=54 time=6.071 ms

In this moment the WRTnode board is connected to the Internet through our home router, we can connect our PC to Internet through the WRTnode and start configure our WRTnode board.

WRTnode software repository

 root@OpenWrt:~# opkg update
 Downloading http://d.wrtnode.com/packages/Packages.gz.
 Updated list of available packages in /var/opkg-lists/barrier_breaker.
 root@OpenWrt:~# opkg install <here put the name of the package>

Restore Factory Settings

 root@OpenWrt:~# firstboot
 This will erase all settings and remove any installed packages. Are you sure? [N/y]
 /dev/mtdblock5 is mounted as /overlay, only erasing files
 root@OpenWrt:~# reboot

WRTnode special network cable

WRTnode uses a special network cable - one end has a RJ45 network connector, the second end has a 2x2 female header connector / Dupont connector (see Figure 1):


Figure 1 Cable pinout First of all, this is a T568B cable. T568B cable is the cable used to connect a computer to a router at home. So get a T568B cable, cut one RJ45 end connector and prepare all the 8 wires from the cable following the pinout from Table 1:


Use only the green, green and white, orange, orange and white wires from the T568B cable. The rest of 4 wires can be cut, they are not useful for our application. The 4 wires selected above have to be solder to a 2x2 female header connector (Dupont connector) according to pinout from Table 2:


After the cable is completed, it can be connected to WRTnode board like in Figure 2:


Figure 2 If a factory cable is used, on the female header connector it is visible a small black arrow which corresponds to Pin 1. This cable can be connected to any of the 4 LAN ports from the WRTnode board taking into consideration that the arrow (Pin 1 on the connector's cable) corresponds to WRTnode pins number 2, 4, 6, 8. Pin 2 from the cable corresponds to WRTnode pins 1, 3, 5, 7. Following figure shows the cable Pin 1 connected to pin 4 on WRTnode (Figure 3). As shown in Figure 2, pins for LAN and WAN ports are defined on the right side of the WRTnode board, Figure 3 below shows the network cable connected to WRTnode.


Figure 3

Let's move on!


Release UART

Since mt7620n only one UART lite interface, native OpenWrt used as the core print and tty console .

And in many cases, require t0 use the serial communication with an external chip on the line, then you need to release the port from OpenWrt.

In fact, this task is only two steps :( we assume that $(TOPDIR) was the compiler directory of OpenWrt )

  • Close serial console

The one comment out $(TOPDIR)/target/linux/ramips/base-files/etc/inittab file below:

 ::askconsole:/bin/ash --login
 $vi $(TOPDIR)/target/linux/ramips/base-files/etc/inittab
 ::sysinit:/etc/init.d/rcS S boot
 ::shutdown:/etc/init.d/rcS K shutdown
 #::askconsole:/bin/ash --login
  • Close kernel Print

In the $(TOPDIR)/package/base-files/files/etc/config/system file, add the following two:

  option 'conloglevel' '1'
  option 'kconloglevel' '1'
  $vi $(TOPDIR)/package/base-files/files/etc/config/system
  config system
        option 'conloglevel' '1'
        option 'kconloglevel' '1'
        option hostname OpenWrt
        option timezone UTC
  config timeserver ntp
        list server     0.openwrt.pool.ntp.org
        list server     1.openwrt.pool.ntp.org
        list server     2.openwrt.pool.ntp.org
        list server     3.openwrt.pool.ntp.org
        option enable_server 0

Through the above two steps, you can turn off all systems of OpenWrt serial interaction, except for the first ten seconds of uboot printing information and Kernel early printing information (residual print information about this part, the proposed development of the next-bit machine when the system has just started made redundant).

The above methods are OpenWrt source inside modify, compile the new firmware, the new firmware release can be burned into WRTnode serial.

Because of OpenWrt writable file system, which also can modify WRTnode existing firmware in the /etc/inittab and /etc/config/system files directly, you can release the port after the restart.


LAN/WAN config

In many cases, we need to customize a particular network port for LAN or WAN side on the WRTnode board.

There are many ways to accomplish this task: uboot compile-time setting in OpenWrt compile-time setting in OpenWrt of set in the configuration file.

Here we explain one of the most simple way: in: | set Wikipedia OpenWrt OpenWrt of the configuration file, and then explain how to compile OpenWrt Firmware stage default this setting.

In the OpenWrt after the start, we can find the /etc/config/nework file, edit the file using vi, you can find the following:

 config switch_vlan
       option device 'switch0'
       option vlan '1'
       option ports '1 2 3 4 6t'
 config switch_vlan
       option device 'switch0'
       option vlan '2'
       option ports '0 6t'

The above setup defines 2 vlan, 6t defines the mt7620 built-in switch, 1,2,3,4 defines 4 LAN, 0 defines an Ethernet WAN.

So, we can change the vlan 0, 1,2,3,4 according to our needs in order to define a LAN or WAN port (or even all network ports can be set to LAN or WAN, P-) However, the consequences ~ ~).

When done, simply restart the network interface

  /etc/init.d/network restart 

We can define the network ports and setup on OpenWRT start, we want that firmware compilation phase to complete this by default.

We assume that $(TOPDIR) for OpenWrt of compiler directory.

  vi $(TOPDIR)/target/linux/ramips/base-files/etc/uci-defaults/02_network 

Find the following parameters:

               ucidef_set_interfaces_lan_wan "eth0.1" "apcli0"
               ucidef_add_switch "switch0" "1" "1"
               ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
               ucidef_add_switch_vlan "switch0" "2" "0 6t"

Now you should know how to change the network ports according to your needs :)

Keep on rock!


Device Tree Source

一:device tree source birth

In the past linux kernel, such as: ARM Linux in, arch/arm/plat-xxx and arch/arm/mach-xxx filled with a lot of garbage code, a considerable majority of the code just in describing the board level detail.

These board-level details for the kernel is concerned, but is garbage, such as platform device board, resource, i2c_board_info, spi_board_info and various hardware platform_data.

Device Tree is a data structure describing the hardware, which originated in OpenFirmware (OF).

  In Linux 2.6 in, ARM architecture plate too much hardware details are hard-coded in the arch /arm/plat-xxx and arch/arm/mach-xxx, after using the Device Tree, many details of the hardware can be passed directly through it to Linux,       without the need for a lot of redundancy in the coding in kernel.
  Device Tree named by a series of nodes (node) and attribute (property) composed of the node itself may contain sub nodes. The so-called property, in fact, occur in pairs name and value. In the Device Tree, the information can be described, including (former mostly hard code this information to the kernel in):

The number and type of CPU

Memory base address and size

Bus and bridge

Peripheral connections

Interrupt controller and interrupt usage

GPIO controller and GPIO usage

Clock controller and Clock Usage

It is basically draw a circuit board CPU, bus, equipment consisting of trees, Bootloader will be passed to the kernel tree, then the kernel can identify this tree, And according to it launched a Linux kernel platform_device, i2c_client, spi_device and other equipment, and these devices use memory, IRQ and other resources, has also been passed to the kernel, the kernel will bind these resources to expand the appropriate device.

二: Device Tree composition and structure

Device Tree involve the whole broad face, that adds new text format used to describe the device hardware information, but also increases the tool to compile the text, but also needs the support Bootloader Device compiled Tree will be passed to the Linux kernel.

DTS (device tree source)

.dts file is an ASCII text description Device Tree format, the text format is very user-friendly, suitable for human reading habits.

Basically, mips Linux, a .dts file corresponds to a mips the machine, usually placed in /target/linux/ramips/dts directory.

Due to an SoC may correspond to multiple machine (an SoC can correspond to multiple products and circuit boards), bound to these .dts file should contain many common parts, Linux kernel in order to simplify,

The common part of the common parts of SoC or more machine usually refined for .dtsi, similar to the C language header files. Other machine corresponding .dts to include this .dtsi. For example, for MT762n terms, mt7620n.dtsi was called WRTNODE.dts, WRTNODE.dts the following line:

/include/ "mt7620n.dtsi"

Of course, and is similar to the C language header files, .dtsi can also include other .dtsi, for example, almost all ARM SoC's .dtsi all references skeleton.dtsi. .dts (or which include a .dtsi) basic elements and attributes of the nodes is described hereinbefore

For example:m25p80的spi flash

 m25p80@0 { 
              #address-cells = <1>; 
              #size-cells = <1>; 
              #compatible = "mx25l6405d"; 
              compatible = "w25q128"; 
              reg = <0 0>; 
              linux,modalias = "m25p80", "w25q128"; 
              spi-max-frequency = <10000000>; 
              partition@0 { 
                  label = "u-boot"; 
                  reg = <0x0 0x30000>; 
              partition@30000 { 
                  label = "u-boot-env"; 
                  reg = <0x30000 0x10000>; 
              factory: partition@40000 { 
                  label = "factory"; 
                  reg = <0x40000 0x10000>; 
              partition@50000 { 
                  label = "firmware"; 
                  reg = <0x50000 0xfb0000>; 

m25p80 @ 0 is the junction point, partition @ 0, factory: partition @ 40000 is his child nodes.

Organizational form compatible attribute is <manufacturer>, <model>, in fact, remove the manufacturer alias prefix compatible property before the comma. On this point, you can see drivers /spi/spi.c source code, function spi_match_device () exposes more detail, if an alias appears in the device spi_driver of id_table inside, or alias name field spi_driver same, SPI devices and drive can be matched.

Specific dts presentation can refer [1]

Release the reuse of gpio

-: According mt7620 datasheet in GPIO pin share schemes and WRTnode gpio pins feature can be used to customize the gpio pin marked as shown below:



Note: The red box is a combination of WRTnode interface parameters obtained can be released gpio multiplexed pins.

二: mt7620n.dtsi in the registration of gpio

We assume that $(TOPDIR) for OpenWrt of compiler directory.

In the $(TOPDIR)/target/linux/ramips/dts/mt7620n.dtsi registered to gpio

Note: The combination of mt7620 datasheet in GPIO pin share schemes and in mt7620n.dtsi where we see the GPIO#0 to GPIO#72 (middle just do GPO or GPI's) are divided into four groups GPIO0-GPIO3;

GPIO0 is starting from the GPIO#0 to GPIO#23, a total of 24;

GPIO1 is starting from the GPIO#24 to GPIO#39, a total of 16;

GPIO2 is starting from the GPIO#40 to GPIO#71, a total of 32;

GPIO3 corresponds corresponding GPIO#72, only one.






三: Sign in WRTNODE.dts inside of led, keys, etc.

In the $(TOPDIR)/target/linux/ramips/dts/WRTNODE.dts where you can register through gpio interface control devices, such as led, keys, etc.

If you want to use the GPIO interface, you need to enable the GPIO and release the GPIO pin standby function:

Enable GPIO:


Release gpio pin alternate function:


Definition pin multiplexing in $(TOPDIR)/build_dir/target-mipsel_24kec+dsp_uClibc-

Note: The path is not necessarily for this, according to your own kernel version, linux-3.10.xx

For example, i2c_grp, from gpio#1 start, including gpio#1 and gpio#2, a total of two gpio;

spi refclk, from gpio#37 start, including gpio#37, gpio#38 and gpio#39, a total of three gpio.


Similarly, other reuse the same pin definitions.


Note: dts registered in the device is very simple, such as registration gpio-leds is, compatible with Led to drive leds-gpio.c in compatible correspondence, label is the name of the device, the device registration is successful, the file system will be under WRTnode there are /sys/class/leds/wrtnode:blue:wan, we can look commands to control the light off

 $echo 1 > /sys/class/leds/wrtnode\:blue\:wan/brightness
 $echo 0 > /sys/class/leds/wrtnode\:blue\:wan/brightness

gpios = <& gpio2 0 1>, which is designated corresponding gpio pins (GPIO#40)


The user space gpio calls

User space access gpio, namely through sysfs access gpio interface

control the gpio directory in: / sys/class/gpio

  • /sys/class/gpio/export

export is used to notify system need to export control GPIO pin number

  • /sys/class/gpio/unexport

unexport is used to cancel the export notification to system

  • /sys/class/gpio/gpiochipX

gpiochipX said is a gpio_chip, used to manage and control a group of gpio port controller Directory information stored system GPIO registers,

Base: starting each register control pin number,

label: register a name or logo

ngpio: the total number of pins

  • /sys/class/gpioN

gpioN: specific gpio pin

direction: the direction of the gpio port, read the result is in or out.

value: level of gpio pin, 0 (low level) 1 (high level), if the gpio is configured as output, the value is writable, remember any nonzero value will output a high level

edge: the interrupt is triggered

Export the gpio pins

1 Calculate the pin number

pin number = base of control pin register + offset of control pin register

2 /sys/class/gpio/export write the number

for example gpio0 ,after the success of the command to generate/sys/class/gpio/gpio0 directory, if there are no corresponding directory, illustrate the pin cannot be derived

 echo 0 > /sys/class/gpio/export

3 The direction file in /sys/class/gpio/gpio0

direction: define input and output

defined as the output:

  echo out > direction

defined as the input:

  echo in > direction

4 The value file in /sys/class/gpio/gpio0

Value: level of gpio pin, 0 (low level) 1 (high level), if the gpio is configured as output, the value is writable, remember any nonzero value will output a high level

 echo 1 > value

export gpio0 pin:



But when we execute unexport will prompt error

  echo 0 > /sys/class/gpio/unexport
  echo 0 > /sys/class/gpio/export
  ash: write error: Invalid argument

The solution:

The ticket for gpio unexport The patch for gpio-ralink.c

How to register a GPIO as Led or Button

"make menuconfig" to enter the configuration interface,select: Led driver:

  LED modules    --->   <*> kmod-leds-gpio 
                     <*> kmod-ledtrig-usbdev

Button driver:

 Other modules  --->   <*> kmod-gpio-button-hotplug.

Open the WRTNODE.dts add Led:

  gpio-leds {
      compatible = "gpio-leds";
      indicator {
          label = "wrtnode:blue:indicator";
          gpios = <&gpio1 14 1>;

"compatible" match "compatible" in leds-gpio.c, "label" is the name of the device,<&gpio1 14 1> is equivalent to GPIO#40



add Button:

  gpio-keys-polled {
      compatible = "gpio-keys-polled";
      #address-cells = <1>;
      #size-cells = <0>;
      poll-interval = <20>;
      reset {
          label = "reset";
          gpios = <&gpio0 1 1>;
          linux,code = <0x198>;


WRTnode add spi slave

一:Modify spi controller driver to achieve the support of the spi cs1

We assume that $(TOPDIR) for OpenWrt of compiler directory. open spi-rt2880.c vim $(TOPDIR)/build_dir/target-mipsel_24kec+dsp_uClibc- find struct rt2880_spi_ops then set spi_ops[0].num_cs = 2 static struct rt2880_spi_ops spi_ops[] = {

       .init_hw = rt2880_spi_reset,
       .set_cs = rt2880_spi_set_cs,
       .baudrate_set = rt2880_spi_baudrate_set,
       .write_read = rt2880_spi_write_read,
       .num_cs = 1,  // .num_cs = 2
   }, {
       .init_hw = rt5350_spi_reset,
       .set_cs = rt2880_spi_set_cs,
       .baudrate_set = rt2880_spi_baudrate_set,
       .write_read = rt2880_spi_write_read,
       .num_cs = 2,
   }, {
       .init_hw = mt7621_spi_reset,
       .set_cs = mt7621_spi_set_cs,
       .baudrate_set = mt7621_spi_baudrate_set,
       .write_read = mt7621_spi_write_read,
       .num_cs = 1,

}; 二:Complete the registration of spi slave device where the dts cd $(TOPDIR)/ wget --no-check-certificate https://raw.githubusercontent.com/WRTnode/openwrt-patches/master/R39786/wrtnode_spidev_dts.patch patch -p1 < wrtnode_spidev_dts.patch


三:spi configuration

make menuconfig Kernel modules ---> SPI Support ---> <*> kmod-spi-dev 四:Compile make 五:flash Firmware The new firmware re-programmed into the WRTnode, perform the following operations on WRTnode:

ls /dev


Provide a demo for spidev

WRTnode add spi cs1

Select the drive and test program

  make menuconfig
  -*- kmod-spi-dev................................. User mode SPI device driver 
  <*> spidev-test.......................................... SPI testing utility 

Modify the driver code patch:

  wget https://raw.githubusercontent.com/WRTnode/openwrt-patches/master/R45620/0402-WRTndoe-spi-add-cs1.patch
  cd ./build_dir/target-mipsel_24kec+dsp_uClibc-
  patch -p1 < 0402-WRTndoe-spi-add-cs1.patch


  --- a/drivers/spi/spi-rt2880.c	2015-01-26 14:49:36.269930576 +0000
  +++ b/drivers/spi/spi-rt2880.c	2015-07-30 10:33:42.193259659 +0000
  @@ -34,6 +34,8 @@

  #define RAMIPS_SPI_DEV_OFFSET		0x40

  +#define RAMIPS_SPI_GPIO     0x60
   #define RAMIPS_SPI_STAT(cs)		(0x00 + (cs * RAMIPS_SPI_DEV_OFFSET))
   #define RAMIPS_SPI_CFG(cs)		(0x10 + (cs * RAMIPS_SPI_DEV_OFFSET))
   #define RAMIPS_SPI_CTL(cs)		(0x14 + (cs * RAMIPS_SPI_DEV_OFFSET))
  @@ -553,6 +555,8 @@
   static void rt5350_spi_reset(struct rt2880_spi *rs)
   	int cs;
   +	void __iomem *base_gpio;
   +	u32 val_gpio;

	rt2880_spi_write(rs, RAMIPS_SPI_ARBITER,
   @@ -563,6 +567,12 @@
		rt2880_spi_write(rs, RAMIPS_SPI_CTL(cs), SPICTL_HIZSDO | SPICTL_SPIENA);
  +	base_gpio = rs->base - 0xb00;
  +	val_gpio = ioread32(base_gpio + RAMIPS_SPI_GPIO);
  +	val_gpio &= ~(3 << 11);
  +	iowrite32(val_gpio,base_gpio + RAMIPS_SPI_GPIO);

   static void mt7621_spi_reset(struct rt2880_spi *rs)

Register spi equipment

  wget https://raw.githubusercontent.com/WRTnode/openwrt-patches/master/R45620/wrtnode_spidev_dts.patch
  patch -p1 < wrtnode_spidev_dts.patch


  --- a/target/linux/ramips/dts/WRTNODE.dts	2015-07-23 14:48:30.402882723 +0000
  +++ b/target/linux/ramips/dts/WRTNODE.dts	2015-07-29 12:06:40.000000000 +0000
  @@ -53,6 +53,17 @@
					reg = <0x50000 0xfb0000>;
  +			spidev@40 {
  +						#address-cells = <1>;
  +						#size-cells = <1>;
  +						compatible = "spidev";
  +						reg = <1 0>;
  +						linux,modalias = "spidev", "spidev";
  +						spi-max-frequency = <10000000>;
  +			};

  @@ -79,14 +90,10 @@
				ralink,group = "ephy", "wled", "pa", "i2c", "wdt", "uartf";
				ralink,function = "gpio";
  -		};
  -	};
  -	gpio-leds {
  -		compatible = "gpio-leds";
  -		indicator {
  -			label = "wrtnode:blue:indicator";
  -			gpios = <&gpio1 14 0>;
  +			spi_cs {
  +				ralink,group = "spi refclk";
  +				ralink,funtion = "spi refclk";
  +			};


  make V=s

Flash firmware

  ls /dev


WRTnode add i2c support

Because the i2c driver is not stable, so we recommend use gpio simulation i2c 1:Edit file WRTNODE.dts (located in target/linux/ramips/dts/) and add following code:

 $vim WRTNODE.dts 
   palmbus@10000000 {
    ... ... 
   i2c@900 {
           compatible = "ralink,mt7620n-i2c", "ralink,rt2880-i2c";
           reg = <0x900 0x100>;
           resets = <&rstctrl 16>;
           reset-names = "i2c";
           #address-cells = <1>;
           #size-cells = <0>;
           pinctrl-names = "default";
           pinctrl-0 = <&i2c_pins>;
           status = "okay";
     ... ...

2:Edit WRTNODE.dts by removing "i2c" ralink.group: Original code:

 pinctrl {
    state_default: pinctrl0 {
                  default {
                      ralink,group = "ephy", "wled", "pa", "i2c", "wdt", "uartf" ,"spi refclk";
                      ralink,function = "gpio";

After modifying the code:

    pinctrl {
    state_default: pinctrl0 {
                  default {
                      ralink,group = "ephy", "wled", "pa", "wdt", "uartf" ,"spi refclk";
                      ralink,function = "gpio";
    i2c_pins: i2c {
                   i2c {
                       ralink,group = "i2c";
                      ralink,function = "i2c";

3: I2C configuration

  $make menuconfig




4: Compile


5: Refresh Firmware Load the new firmware in WRTnode and perform the following operations on WRTnode:

 $cd /lib/modules/$(kernel-version)
 $insmod i2c-dev.ko
 $cd /dev


Now you should see the i2c-0

  $ls -all i2c-0


Now I2C was added succesfully to the WRTnode board. 6: Install i2c-tools(i2cdetect,i2cdump,i2cget,i2cset)

  $opkg update
  $opkg install i2c-tools

Assuming connect the slave device mpu6050. For example: Read the value of the register

  $i2cget -y 0 0x68 0x6b

For example: Write the value of the register

  $i2cset -y 0 0x68 0x6b 0x80

0:/dev/i2c-0 0x68: slave device address 0x6b: register 0x80: the value written to the register 0x6b dev is the abbreviation of device. /dev directory is very important for all users because this directory contains the external devices used in all Linux systems. It is actually the link to the port of the external devices. Therefore accessing these devices it is a very simple task similar to accessing a file or a directory.

WRTnode add i2c-gpio support

Mt7620n i2c driver stability is poor, we recommend using gpio to simulate i2c I2C gpio configuration

  make menuconfig 
  Kernel modules  --->   I2C support  --->  <*> kmod-i2c-gpio-custom.


patch There is a warning when rmmod i2c-gpio-custom

  wget https://raw.githubusercontent.com/WRTnode/openwrt-patches/master/R45620/WRTndoe-i2c-gpio-custom.patch
  patch -p1 < WRTndoe-i2c-gpio-custom.patch 
  --- a/package/kernel/i2c-gpio-custom/src/i2c-gpio-custom.c	2014-07-01 11:30:31.149861607 +0000
  +++ b/package/kernel/i2c-gpio-custom/src/i2c-gpio-custom.c	2015-07-28 08:15:20.000000000 +0000
  @@ -96,7 +96,7 @@

	  for (i = 0; i < nr_devices; i++)
		  if (devices[i])
  -			platform_device_put(devices[i]);
  +			platform_device_unregister(devices[i]);
   static int __init i2c_gpio_custom_add_one(unsigned int id, unsigned int *params)

WRTNODE.dts default WRTNODE.dts: gpio#1 as a reset button , gpio#38 as a led For example,if you want use gpio#1

  gpio-keys-polled {
       compatible = "gpio-keys-polled";
       #address-cells = <1>;
       #size-cells = <0>;
       poll-interval = <20>;
       reset {
           label = "reset";
           gpios = <&gpio0 1 1>;
           linux,code = <0x198>;


  make V=s

Flash firmware then insmod module

  insmod i2c-dev
  insmod i2c-gpio-custom bus0=0,1,2

parameter:<id> <sda> <scl> <id> ID to used as device_id for the corresponding bus (required) <sda> GPIO pin ID to used for SDA (required) <scl> GPIO pin ID to used for SCL (required)

  ls /dev



Add USB mobile hard disk

Add USB support: old usb1.0, usb2.0, install usb storage device

  Kernel modules  --->   USB Support  --->       kmod-usb-ohci 

Adding support for mobile hard disk EXT4 format and FAT16 / FAT32 format

  Kernel modules  --->  Filesystems  --->        kmod-fs-ext4

Add CP437 encoding, UTF8 encoding, ISO8859-1 encoding

  Kernel modules  ---> Native Language Support --->kmod-nls-cp437 

Add loading, unloading tools

  Utilities    --->   Filesystem  ---> ntfs-3g  
  Base system  --->   block-mount 
  Utilities    --->   mount-utils





Usb camera

hardware: WRTnode The 'special' USB cable customized for WRTnode or WRTnode standard shield Usb camera software: WRTnode sdk or openwrt trunk configure:

  make menoconfig
  Multimedia      --->   <*> mjpg-streamer -- >     [*]   Install input uvc plugin
                                                 [*]   Install output http plugin
  Kernel modules  --->   Video Support  --->        <*> kmod-video-core......
                                                 <*>   kmod-video-uvc....
                                                 -*-   kmod-video-videobuf2.


  make V=s

flash firmware then do the following: The first step: is there a video equipment

  ls /dev

The second step: to view the parameters of the mjpg_streamer

  mjpg_streamer --help


The third step: open the usb camera

  mjpg_streamer -i "input_uvc.so -f 30 -r 1280*720" -o "output_http.so -p 8080"


The default device is video0, if your device is not video0, you need to use the -d specify your device:

  mjpg_streamer -i "input_uvc.so -d /dev/video1 -f 30 -r 1280*720" -o "output_http.so -p 8080"

-f frames per second -r The resolution of the video equipment -p network port number The fourth step: open the VLC player,Ctrl+n to open the window "open media" The default IP address is



USB Serial

How to usb Qualcomm gobi 2000 3g module on WRTnode


  • WRTnode board
  • WRTnode standard shield ( or the 'special' USB cable )
  • Qualcomm gobi 2000 3g module
  • SIM card


 #make menuconfig
 LuCI            --->  Protocols     --->  <*> luci-proto-3g
 Kernel modules  --->  USB Support   --->  <*>kmod-usb-serial 
                                         <*> kmod-usb-serial-option

-*- kmod-usb-serial-wwan


Flash firmware

Insert SIM card in Qualcomm gobi 2000 3 g module’s SIM card slots. Point your browser tohttp://

  Luci - > Network - > interfaces

Edit wan:




Save&Apply Gps function:

 #wget http://d.wrtnode.com/WikiDownload/Qualcomm-gobi-2000-3g/gobi_loader_0.7_ramips_24kec.ipk
 #opkg install /tmp/gobi_loader_0.7_ramips_24kec.ipk
 #mkdir /tmp/gobi
 #cd /tmp/gobi
 #wget http://d.wrtnode.com/WikiDownload/Qualcomm-gobi-2000-3g/apps.mbn
 #wget http://d.wrtnode.com/WikiDownload/Qualcomm-gobi-2000-3g/amss.mbn
 #wget http://d.wrtnode.com/WikiDownload/Qualcomm-gobi-2000-3g/UQCN.mbn
 #gobi_loader -2000 /dev/ttyUSB0 /tmp/gobi
 #echo -n "\$GPS_START" >/dev/ttyUSB2
 #cat /dev/ttyUSB2


GPS - NMEA sentence information $GPGGA Global Positioning System Fix Data eg3. $GPGGA,hhmmss.ss,llll.ll,a,yyyyy.yy,a,x,xx,x.x,x.x,M,x.x,M,x.x,xxxx*hh 1 = UTC of Position 2 = Latitude 3 = N or S 4 = Longitude 5 = E or W 6 = GPS quality indicator (0=invalid; 1=GPS fix; 2=Diff. GPS fix) 7 = Number of satellites in use [not those in view] 8 = Horizontal dilution of position 9 = Antenna altitude above/below mean sea level (geoid) 10 = Meters (Antenna height unit) 11 = Geoidal separation (Diff. between WGS-84 earth ellipsoid and mean sea level. -=geoid is below WGS-84 ellipsoid) 12 = Meters (Units of geoidal separation) 13 = Age in seconds since last update from diff. reference station 14 = Diff. reference station ID# 15 = Checksum $GPGSA

GPS DOP and active satellites eg1. $GPGSA,A,3,,,,,,16,18,,22,24,,,3.6,2.1,2.2*3C eg2. $GPGSA,A,3,19,28,14,18,27,22,31,39,,,,,1.7,1.0,1.3*35 1 = Mode:

     M=Manual, forced to operate in 2D or 3D 
     A=Automatic, 3D/2D 

2 = Mode:

     1=Fix not available 

3-14 = IDs of SVs used in position fix (null for unused fields) 15 = PDOP 16 = HDOP 17 = VDOP $GPGSV

GPS Satellites in view eg. $GPGSV,3,1,11,03,03,111,00,04,15,270,00,06,01,010,00,13,06,292,00*74



1 = Total number of messages of this type in this cycle 2 = Message number 3 = Total number of SVs in view 4 = SV PRN number 5 = Elevation in degrees, 90 maximum 6 = Azimuth, degrees from true north, 000 to 359 7 = SNR, 00-99 dB (null when not tracking) 8-11 = Information about second SV, same as field 4-7 12-15= Information about third SV, same as field 4-7 16-19= Information about fourth SV, same as field 4-7 and so on . Specific GPS - NMEA sentence information can refer [2]

Download & Compile WRTnode static SDK

Compiling WRTnode static SDK


  • Based on OpenWrt BARRIER BREAKER (Bleeding Edge, r41508)
  • OpenWrt trunk on Linux Kernel 3.10.44
  • rt2860v2 Wi-Fi driver hacked by lintel
  • Customized uboot hacked by manfeel
  • WRTnode aplci up-link Wi-Fi configuration (aps/vw/nr/ia)
  • Luci Wi-Fi wpa patch for rt2860v2
  • Local dns add i.wrtno.de & wrtnode.lan besides openwrt.lan to WRTnode which the default ip is
  • WRTnode additional feature (all source opened github.com/WRTnode):
  • Opencv 2.4.8
  • Native gcc-mipsel on mt7620 and bin-utils
  • Porting linino (Arduino yun) source to WRTnode
  • Shine: fast fixed-point mp3 encoding
  • And some WRTnode demo apps:
  • opencv application demo
  • mechanical control demo
  • RESTful front-end demo and some other thing

Configure Linux compiled environment: Debian 5 Lenny:

  apt-get install gawk ncurses-dev unzip zlib1g-dev

Debian 6 Squeeze:

  apt-get install libncurses5-dev zlib1g-dev gawk flex libssl-dev sdcc-nf

Debian 7 Wheezy:

  apt-get install libncurses5-dev zlib1g-dev gawk

Ubuntu 13.10:

  sudo apt-get install build-essential subversion git-core libncurses5-dev zlib1g-dev gawk flex quilt xsltproc

Ubuntu 12.04LTS:

  sudo apt-get install build-essential subversion git-core libncurses5-dev zlib1g-dev gawk flex quilt libssl-dev xsltproc libxml-parser-perl mercurial bzr ecj cvs unzip

Ubuntu 64bit:

   sudo apt-get install build-essential subversion libncurses5-dev zlib1g-dev gawk gcc-multilib flex git-core gettext

Fedora 17:

   yum install -y subversion binutils bzip2 gcc gcc-c++ gawk gettext flex libz-dev flex ncurses-devel zlib-devel make patch unzip perl-ExtUtils-MakeMaker

Fedora 18 – 64Bit (Maybe also for lower versions, some packages seem to be missing above):

  yum install -y subversion binutils bzip2 gcc gcc-c++ gawk gettext flex ncurses-devel zlib-devel make patch unzip perl-ExtUtils-MakeMaker 
  glibc glibc-devel glibc-static quilt ncurses-lib sed sdcc intltool sharutils bison 

Maybe you need glibc.i686 glibc-static.i686 glibc-devel.i686 libgcc.i686 too Fedora 19 – 64Bit (Maybe also for lower versions, some packages seem to be missing above):

  yum install -y subversion binutils bzip2 gcc gcc-c++ gawk gettext flex ncurses-devel zlib-devel make patch unzip perl-ExtUtils-MakeMaker 
  glibc glibc-devel glibc-static quilt ncurses-lib sed sdcc intltool sharutils bison wget

openSuSE 11.1

  zypper install binutils bzip2 gawk gcc gcc-c++ gettext make ncurses-devel patch unzip wget zlib-devel flex git-core

In openSuSE some packages require additional repositories. Search on http://packages.opensuse-community.org and add repositories like that: zypper ar "http://download.opensuse.org/repositories/devel:/languages:/perl/openSUSE_11.1/devel:languages:perl.repo"

Arch Linux

  pacman -S --needed subversion asciidoc bash bc binutils bzip2 fastjar flex git gcc util-linux gawk intltool zlib make cdrkit ncurses openssl 
  patch perl-extutils-makemaker rsync sdcc unzip wget gettext libxslt zlib boost libusb bin86 sharutils b43-fwcutter findutils

Compile the firmware Build working directory:

  $ mkdir OpenWrt
  $ cd OpenWrt

Download WRTnode SDK and turn it into the OpenWrt directory.

  $ wget http://d.wrtnode.com/sdk/sdk.tar.bz2

unzip WRTnode SDK:

  $ tar -jxvf sdk.tar.bz2
  $ cd wrtnode

Enter compiled selection interface:

  $ make menuconfig

Enter compiled selection interface, the current is WRTnode default configuration. If you need to add or remove certain parts can this configuration. After configured to save and exit. note:Do not update feeds and conduct svn update upgrades, we are ready to change.

Then began to compile

  $ make V=s

The firmware is openwrt-ramips-mt7620n-wrtnode-squashfs-sysupgrade.bin(./bin/ramips/openwrt-ramips-mt7620n-wrtnode-squashfs-sysupgrade.bin). The factory firmware: http://d.wrtnode.com/old-firmware/openwrt-ramips-mt7620n-wrtnode-squashfs-sysupgrade.bin The corresponding toolchain:download

Flash Firmware

Flash firmware

Flash pleasure in it, but the fun and risk coexist. 1:Prepare the firmware You can refer to the document compile WRTnode firmware to compile the firmware. you can also directly download the WRTnode official firmware(linux kernel 3.10.44) or updated version of the firmware(linux kernel 3.14.18). 2: To refresh the firmware, we provide two kinds of commonly used flash method Method 1:PC even WRTnode wifi or PC via Ethernet cable connected with WRTnode,After the connection is successful, open the browser,Input i.wrtno.de or in the address bar,Enter the openwrt luci interface, input your password to log in (If did not change the password, the password is empty). In the System->Backup/Flash Firmware , to refresh the Firmware,Select the firmware is located,Click to refresh the firmware.


Patience wait a few minutes, don't power off or manually disconnect wifi in the process. Will appear after the completion of WRTnodexxxx and connected again. Method 2: PC even WRTnode wifi or a PC through the Ethernet cable connected with WRTnode, use winscp software to PC firmware, upload wrtnode board. Put the firmware in wrtnode /tmp directory. If you are a Linux system, you can directly use the scp command to copy the firmware to the development board.If you are a windows system, you can use the winscp to copy the firmware to the development board. Selected in the putty "SSH" landing WRTnode. At the command line to perform the following command:

   root@OpenWrt:~#mtd write -r openwrt-ramips-mt7620n-wrtnode-squashfs-sysupgrade.bin firmware

Write flash:




Patience wait a few minutes, don't power off or manually disconnect wifi in the process. Will appear after the completion of WRTnodexxxx and connected again. If these two methods can not, you can see /saving your wrtnode. 3 :apcli configuration the firmware after brush, about apcli configuration WRTnode

Saving your WRTnode

Saving your WRTnode

Download the WRTnode firmware

Two commonly used methods of refreshing firmware are provided in Refresh the firmware section, these 2 methods are using the WiFi connection to transfer the firmware to WRTnode. If for some reasons the WRTnode is not working anymore - cannot connect/control it over the WiFi connection (it was bricked), we have to restore it to a functional state (to debrick it). Below it will be presented other two different connection methods to the WRTnode for the situations when the kernel is not starting (OpenWrt is not able to boot) and/or for the situation when WiFi connection is not available. For both methods a cable is used to connect to WRTnode development board. The cable used to connect to the WRTnode is basically an Ethernet cable (T568B pinout) at one end (it has an RJ45 connector) and at the other end has a 2x2 female header 2.54mm (Dupont headers) - we will call this cable "special cable". The special cable can be 50cm long (see Figure 1):


Figure 1 Special cable pinout: As mentioned, a T568B cable pinout is needed. Table 1 contains the T568B pinout:


At the other end of the cable it is used a 2x2 female header 2.54mm which connects to the green, green and white, orange, orange and white wires from the cable. The other 4 remaining wires can be cut (brown, brown and white, blue, blue and white). Table 2 explains how to connect the 4 wires to the 2x2 female heade


After that step, the special cable can be connected to the WRTnode. The WRTnode pin map (Figure 2):


Figure 2 The special cable from the above images has a small black arrow on the 2x2 female header which is the mark for Pin1. WRTnode has male headers on the board and has 4 LAN ports connections on these headers, so the cable can be connected to any of these 4 LAN ports, the black arrow corresponds to pins 2,4,6,8 on the WRTnode (the Pin2 on the cable corresponds to pins 1,3,5,7 on the WRTnode). Example on Figure 3 is for pin 4 on the WRTnode. Figure 2 shows as well the WAN port pinout on the WRTnode board.


Figure 3 1: When Uboot starts, enter the refresh firmware mode You can refer to WRTnode U-Boot instructions 2: Serial connection (TTL levels - not RS232 levels!) WRTnode board offers as well the classic serial port, see Figure 2 for Tx and Rx pinout. To access the serial ports, a serial-to-USB cable it is needed.


Connection between serial-to-USB wires and WRTnode pins


Serial-to-USB cable connected to WRTnode Through the serial connection, the WRTnode can be debricked, basically flash memory modifications, debugging and other operations can be performed. In order to use the serial connection, we need to know the port number of the serial-to-USB cable, we need to install as well a TFTP server and a serial software like PuTTY. Here is an example for a Windows system: serial-to-USB cable is using port COM3, The Uboot baud rate to 115200, the OpenWrt kernel baud rate also 115200 (see Figure 4).


PuTTY configuration for serial connection


Figure 4 After connecting via serial-to-USB cable to WRTnode board and powering up the board, we can see the boot messages and a choice menu will appear, from that menu we have to choose option 2 ("Load system code then write to Flash via TFTP"), that means to use TFTP protocol in order to download the firmware into the WRTnode while the special cable is still connected, then press "y" key (yes). Also following parameters must be provided: Input device IP = (fill in the IP of WRTnode board) Input server IP = (fill in the IP of the TFTP server, this IP and device IP must be part of the same network) Input Linux Kernel filename = (The name of the firmware we want to upload via TFTP server) Press enter key and wait for the firmware to load into the WRTnode and for the kernel to restart. Note: if you cannot see the boot messages correctly or if the code is loading with errors into the WRTnode board, verify the baud rate to be consistent, also the cable must be checked for good electrical functionality. WRTnode original firmware baud rate is 115200 bps, OpenWRT baud rate is 57600 bps. 3: apcli configuration About apcli configuration Click here


How to find a package in the configuration interface

First,"make menuconfig" to enter the configuration interface,then enter "/" on the keyboard

Then,enter the name of the package you want to search

For example, we need to search for python

First, enter "/",Then, in the input box "python",Press the Enter key,

Then we get into this menu, you can see the package python



WRTnode U-Boot instructions

  • Due to the special definition of gpio1 and gpio2 in uboot,so do not touch the two pins when using WRTnode.

Download uboot.bin

  • Features:support flashing firmware and uboot via web; support booting kernel from USB USB flash drives(or SD Card);The baud rate is 115200.
  • Tools: WRTnode, a power cord, a network cable connect to WRTnode, a short wire (such as DuPont line) (refresh firmware or uboot); USB flash drive(boot the kernel from USB flash drive).
  • If we boot from USB flash drive, we use three USB cable. So you can provide a port for USB flash drive.
  • Operation process:

1:Booting kernel from flash If USB flash disk with uimage is not plugged and neither gpio1 nor gpio2 pin is grounding, WRTnode will boot the kernel from flash 2:booting kernel from USB flash drive. The priority of WRTnode U-Boot U disk boot is higher than booting from flash. WRTnode U-Boot detects whether there is any USB flash drive(or SD card). Then it detects whether there is any uimage in the USB flash drive. If yes, it will boot from the USB flash drive. Otherwise it will boot from flash.




3: WRTnode U-Boot supports using web page refresh the firmware and the uboot, the language of the web page depends on the browser. Before giving WRTnode power, use a network cable to connect LAN port and PC network port. Open the network connection and manually set an ip address 192.168.1.x. gpio#1 (or gpio#2) pin is grounding with a Dupont Line ([gpio referring http://wiki.wrtnode.com/images/a/af/PIN_map_B.jpg/ Pin-map]). After to WRTnode power. Then open the cmd window in the PC side and input: ping -t.


receiving response. View the print information through the serial port,until shown below, disconnect the gpio#1(or gpio#2) pin and GND pin connection.


In PC client browser, input to enter the WEB update mode. Select the new firmware that you want to brush, click upload. The only LED on WRTNode can indicate the current operating state. High frequency flash flash: Firmware checks error. About to enter the WEB update mode. Slow frequency flash: Refreshing firmware (if you look carefully enough, you will find slow frequency flash is divided into two stages. The frequency is slower in the first stage. It means that you are erasing flash. The second stage is faster, which means that data is being written to the flash). Click Uboot to enter the interface of refreshing Uboot.



Thank [Manfeel] gives us the magical uboot

OpenWrt toolchain

How to compile with the openwrt toolchain

openwrt compile tool chain Cross compiler tool chain is to compile, link, handling and debugging cross-platform architecture code.For cross-development tool chain, in the file name with a prefix to distinguish native tool chains.For example, mipsel-openwrt-linux representation is mipsel-openwrt cross compiler tool chain; mipsel-openwrt-linux-gcc representations are using gcc compiler. In addition to the architecture specific compiler options , its usage is the same with the linux , so Linux programming helpful for embedded linux. So what is the difference between gcc and mipsel-openwrt-linux-gcc is it? Difference is gcc C language compiler under linux, compiled in the local implementation of the program, while openwrt-linux-gcc cross-platform C language compiler under linux, translation of the program on the target machine (eg openwrt platform) execution, embedded developers should use embedded cross compiler tool chain. Download ready-compiler tool chain from openwrt official website。 Click here to download Linux using wget:

  wget https://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620n/OpenWrt-Toolchain-ramips-for-mipsel_24kec%2bdsp-gcc-4.8-linaro_uClibc-

Then extract it to your working directory:

 tar -xjf OpenWrt-Toolchain-ramips-for-mipsel_24kec+dsp-gcc-4.8-linaro_uClibc-

Cross compiler tools we need in this directory `OpenWrt-Toolchain-ramips-for-mipsel_24kec + dsp-gcc-4.8-linaro_uClibc- / toolchain-mipsel_24kec + dsp_gcc-4.8-linaro_uClibc- / bin ` Common tools: mipsel-openwrt-linux-gcc gcc compiler mipsel-openwrt-linux-gdb debugger mipsel-openwrt-linux-ld linker mipsel-openwrt-linux-as Assembler Use and the corresponding tool under linux same. Here is an mipsel-openwrt-linux-gcc compiler small example helloworld

vi helloworld.c

Enter the following:

  #include <stdio.h>
  int main(void){
     printf("hello world!\n");
     return 0;

Then use mipsel-openwrt-linux-gcc to compile

  mipsel-openwrt-linux-gcc helloworld.c -o helloworld

Then copy the file to your WRTnode development board, here we put to the /tmp directory



 hello world!

HelloWorld ipk

HelloWorld ipk

1,Setting up the OpenWrt build environment is described in detail in Compiling WRTnode Firmware .Next, it is described how to build a development environment based on OpenWrt. 2、In the source /trunk directory, execute command:

   $make menuconfig


Select option [*] Build the OpenWrt SDK, save, exit and make:

  $make V=s

3、After compilation completed, in directory /trunk/bin/ramips we should find file OpenWrt-SDK-ramips-for-linux-x86_64-gcc-4.8-linaro_uClibc- . This is the OpenWrt SDK we just compiled. This will be used to develop packages for OpenWrt. Let's parse the file name and understand the meaning of the SDK: target system is ramips, host system is Linux-x86_64, tools and libraries are compiled with gcc-4.8-linaro_uClibc- 4、Unzip and navigate SDK

  $tar -jxvf OpenWrt-SDK-ramips-for-linux-x86_64-gcc-4.8-linaro_uClibc-
  $ cd OpenWrt-SDK-ramips-for-linux-x86_64-gcc-4.8-linaro_uClibc-
  $ ls


Next step is to work on packages inside of this directory. 5、Developing a package named helloworld (1)Into the package directory:

  $cd package

(2)Creating /helloworld directory in the package directory and enter /helloworld directory:

 $mkdir helloworld
 $cd helloworld


(3)In /helloworld directory, create a new directory named /src. Then, in directory /src, create Makefile which will be used to compile our hellowrold.c in the /src directory.

  $mkdir src
  $cd src
  $touch helloworld.c
  $touch Makefile


(4)Edit helloworld.c code (file is in /src directory): $vim helloworld.c

  #include <stdio.h>
  #include <unistd.h>
  int main(void){   
    printf("a hellowrold ipk for openwrt !!! \n"); 
   return 0;

(5)Edit Makefile

  $vim Makefile
  # build a Makefile for helloworld.c
  helloworld: helloworld.o   
      $(CC) $(LDFLAGS) helloworld.o -o helloworld
  helloworld.o: helloworld.c        
      $(CC) $(CFLAGS) -c helloworld.c
     rm *.o helloworld

(6)Now we have to edit another Makefile in the parent directory, /helloworld directory, this Mkefile is used by OpenWRT to generate the package (in the previous step we edited Makefile in /src directory in order to compile helloworld.c)

  $ cd ../
  $ touch Makefile

Note: ../ represents the parent directory


  $ vim Makefile

  #OpenWrt Makefile for helloworld program
  include $(TOPDIR)/rules.mk
  # Name and release number of this package
  # This specifies the directory where we're going to build the program.
  # The root build directory, $(BUILD_DIR), is by default the build_mipsel
  # directory in your OpenWrt SDK directory
  include $(INCLUDE_DIR)/package.mk
  # Specify package information for this program.
  # The variables defined here should be self explanatory.
  # If you are running Kamikaze, delete the DESCRIPTION
  # variable below and uncomment the Kamikaze define
  # directive for the description below
  define Package/helloworld
   TITLE:=Helloworld -- prints a snarky message
  # Uncomment portion below for Kamikaze and delete DESCRIPTION variable above
  define Package/helloworld/description
   If you can't figure out what this program does, you're probably
   brain-dead and need immediate medical attention.
  # Specify what needs to be done to prepare for building the package.
  # In our case, we need to copy the source files to the build directory.
  # This is NOT the default.  The default uses the PKG_SOURCE_URL and the
  # PKG_SOURCE which is not defined here to download the source from the web.
  # In order to just build a simple program that we have just written, it is
  # much easier to do it this way.
  define Build/Prepare
      mkdir -p $(PKG_BUILD_DIR)
      $(CP) ./src/* $(PKG_BUILD_DIR)/
  # We do not need to define Build/Configure or Build/Compile directives
  # The defaults are appropriate for compiling a simple program such as this one
  # Specify where and how to install the program. Since we only have one file,
  # the helloworld executable, install it by copying it to the /bin directory on
  # the router. The $(1) variable represents the root directory on the router running
  # OpenWrt. The $(INSTALL_DIR) variable contains a command to prepare the install
  # directory if it does not already exist.  Likewise $(INSTALL_BIN) contains the
  # command to copy the binary file from its current location (in our case the build
  # directory) to the install directory.
  define Package/helloworld/install
     $(INSTALL_DIR) $(1)/bin
     $(INSTALL_BIN) $(PKG_BUILD_DIR)/helloworld $(1)/bin/
  # This line executes the necessary commands to compile our program.
  # The above define directives specify all the information needed, but this
  # line calls BuildPackage which in turn actually uses this information to build a package.
  $(eval $(call BuildPackage,helloworld))

(5)Here is the translation of a return to the top of the SDK, which is the following directories:


  $make V=s

Compilation process will be completed in the /build_dir catalog generating an ipk package, helloworld_1_ramips_24kec.ipk, check the current directory /bin/ramips/packages. (7) The helloworld_1_ramips_24kec.ipk has to be uploaded into WRTnode - for Linux systems use scp command:

  $Scp xxx / helloworld_1_ramips_24kec.ipk root@ / usr / bin 

xxx/ fill in the directory where your helloworld_1_ramips_24kec.ipk and is WRTnode's IP. For Windows systems, use Winscp software to upload ipk package to WRTnode. (8) Install newly created package on WRTnode development board

  $cd /usr/bin$ opkg install helloworld_1_ramips_24kec.ipk

View helloworld program execution results.


The Print Information:

  a helloworld ipk for openwrt  !!! 

There is an available OpenWrt SDK There is an available helloworld package Create a package using Makefile - consult details at openwrt wiki References

Porting OpenCV to WRTnode

Common method

Host Platform :ubuntu Target Platform :OpenWrt system (mips) Cross-compiler is mipsel-openwrt-linux-gcc(gcc version 4.6.4 ) get gcc version Information:

  $./mipsel-openwrt-linux-gcc -v 

Since future versions opencv 2.0 outset use cmake configuration management. So we need to install the relevant tools, install cmake and cmake-gui (included in cmake-qt-gui). Executed in the terminal:

  $sudo apt-get install cmake cmake-qt-gui 

Automatically installed in ubuntu. Download opencv-2.4.4.tar.gz,Unzip ,Establish compile directory:

 $tar -jxvf opencv-2.4.4.tar.gz
 $cd opencv-2.4.4
 $mkdir build
 $cd build


Set the source path (OpenCV-2.4.4) and build path (OpenCV-2.4.4 / build), click configure.


Select the cross-compiler. Click Next to enter the selection screen.


Operating System Select mipsel-linux, cmake can not identify, view the README found cmake identification Linux, rather than mipsel-linux, after the change over will be a lot more options, including V4L and so on. After selecting the Operating System as well as cross-compiler, click Finish.


The library does not need to be removed, the best modify the installation path (CMAKE_INSTALL_PREFIX), defaults to /usr/local, we can modify according to their own, I was /usr/local/openwrt. Some configuration information last seen after clicking config. In the print information will Configuring done last sign, indicating config has been completed. Finally, click generate, generate makefile, then do is compiled.


There will certainly be some errors during compilationv Error:

  mipsel-openwrt-linux-g++: warning: environment variable 'STAGING_DIR' not defined 
  /home/lijp/openwrt/trunk/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.6-linaro_uClibc- cannot find - lgtk-x11-2.0 
  /home/lijp/openwrt/trunk/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.6-linaro_uClibc- cannot find -lgdk-x11-2.0 
  /home/lijp/openwrt/trunk/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.6-linaro_uClibc- cannot find -latk-1.0 
  /home/lijp/openwrt/trunk/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.6-linaro_uClibc- cannot find -lgio-2.0 
  /home/lijp/openwrt/trunk/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.6-linaro_uClibc- cannot find -lpangoft2-1.0 

Review: The WITH_GTK removed, does not compile Error:

  /home/lijp/openwrt/trunk/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.6-linaro_uClibc- cannot find -lavcodec 
  /home/lijp/openwrt/trunk/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.6-linaro_uClibc- cannot find -lavformat 
  /home/lijp/openwrt/trunk/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.6-linaro_uClibc- cannot find -lavutil 
  /home/lijp/openwrt/trunk/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.6-linaro_uClibc- cannot find -lswscale 

Review: The WITH_FFMPEG removed, does not compile. Compile success! Install:

  $sudo make install


Test opencv-2.4.4

   $ vim test.c
 #include <opencv/cv.h>
 #include <opencv/highgui.h>
 #include <stdio.h>
 #pragma warning(disable : 4996)
 #pragma comment(lib, "cv.lib")
 #pragma comment( lib, "cxcore.lib" )
 #pragma comment( lib, "highgui.lib" )
 int main( int argc, char** argv )
     char c;
     IplImage* pFrame = NULL;
     CvCapture* pCapture = NULL;
     char ImagesName[1024];
     int ImgNum=0;
     pCapture = cvCreateCameraCapture(-1);
     printf("pCapture = %d\n",pCapture);
     while(pFrame = cvQueryFrame( pCapture ))
         sprintf(ImagesName, "Image%.3d.jpg", ImgNum);
         cvSaveImage(ImagesName, pFrame,0);
         if(ImgNum > 5)
     return 0;

Here we will compile out of the library and header files put under our toolchain

 $sudo cp /usr/local/openwrt/lib/*  xxx/toolchain-mipsel_24kec+dsp_gcc-4.6-linaro_uClibc-0. 9.33.2/lib -d -r 
 $sudo cp /usr/local/openwrt/include/*  xxx/toolchain-mipsel_24kec+dsp_gcc-4.6-linaro_uClibc-0. 9.33.2/include -r 
 $vim Makefile
 CC = xxx/toolchain-mipsel_24kec+dsp_gcc-4.6-linaro_uClibc-0. 9.33.2/bin/mipsel-openwrt-linux-gcc
 LFLAGS += -lpthread -lrt -lopencv_core -lopencv_highgui -lopencv_imgproc
  $(all): $(OBJECTS) 
  $(CC) $(CFLAGS) $(LFLAGS) $(OBJECTS) -o $(all) 
     @echo "Cleaning up directory." 
     rm -f *.a *.o $(all) 

Compile the test program, after which the executable program and libopencv * moved to run on WRTnode ubuntu install opencv-2.4.4 1 First, run the following command in the terminal to make the necessary compiler environment installed.

  $sudo apt-get install build-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg62-dev libtiff4-dev cmake libswscale-dev libjasper-dev

2.Download the appropriate version to the PC, where we download OpenCV-2.4.4 Example.

 $tar -jxvf OpenCV-2.4.4.tar.bz2
 $cd OpenCV-2.4.4
 $mkdir build
 $cd build
 $cmake ..
 $sudo make install(Installed by default in /usr/local directory)

Here we can use to replace cmake cmake-gui. 3 Now you need to configure opencv library

 $sudo vim /etc/ld.so.conf.d/opencv.conf

Add the /usr/local/lib to opencv.conf

 $sudo ldconfig

ldconfig is a dynamic link library management command, in order to make the system dynamic link library shared by the need to run a dynamic link library management commands --ldconfig By use ldconfig command, mainly in the default search directories (/lib and /usr/lib) and listed within the directory /etc/ld.so.conf dynamic library configuration files, search the dynamic link library that can be shared (format as previously described, lib * .so *), and then create a dynamic loader (ld.so) required connections and cache files. cache files by default /etc/ld.so.cache, save this file has lined up dynamic Link Library list of names. Open the bash.bashrc and add the following two code

 $sudo vim /etc/bash.bashrc

1PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig 2export PKG_CONFIG_PATH 8 Run the test program

 $cd OpenCV-2.4.4
 $cd sample/c

In facedetect executable program as an example:

 $./facedetect --cascade="/usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_alt.xml" --scale=1.5 lena.jpg 


  $./facedetect  --scale=1.5 lena.jpg

OpenWrt package method

To make a ipk package opencv opencv ipk源码 Use openwrt package compilation mechanism requires only a Makefile to compile opencv Why is it so simple magic, the following Detailed on Makefile (personal opinion, please correct me):

  $vim Makefile
 include $(TOPDIR)/rules.mk 
 # PKG_NAME - package name in menuconfig and ipkg displayPKG_VERSION:=2.4.8
 # PKG_VERSION - version of the package, version trunk branch is exactly what we want to download
 # PKG_RELEASE - This version of the makefilePKG_USE_MIPS16:=0 
 # PKG_SOURCE - to download the package name, is generally composed by PKG_NAME and PKG_VERSION
 # PKG_SOURCE_URL - link to download this package, obtained from the Internet
 MD5 value, check the value of the package, get the value of the MD5 method
 #$ ./scripts/update-package-md5sum ....../opencv/
 #PKG_CAT:= unzip#PKG_CAT - Unzip the package method (zcat, bzcat, unzip)
 include $(INCLUDE_DIR)/package.mk 
 include $(INCLUDE_DIR)/cmake.mk 
 define Package/opencv/Default/description 
     the Open Source Computer Vision Library for linux 
 define Package/opencv 
     TITLE:= opencv-2.4.8 
     DEPENDS:=+libpthread +librt +libstdcpp +zlib +libjpeg 
 #SECTION -- Package Type 
 #CATEGORY -- menuconfig in the package belongs to a directory, such as Libraries 
 # SUBMENU -- secondary directory menuconfig in the package belongs (not used) 
 #TITLE -- software title 
 #DESCRIPTION -- Packages details 
 #URL -- software original location, usually the software author's homepage 
 #MAINTAINER -- (optional) package maintainers
 #DEPENDS -- other packages (optional) dependencies, run the software dependencies
 #For example do not want to compile libv4l library, ts, etc., choose OFF.
 define Build/InstallDev 
     $(INSTALL_DIR) $(1)/usr/include 
     $(CP) $(PKG_INSTALL_DIR)/usr/include/opencv $(1)/usr/include/ 
     $(CP) $(PKG_INSTALL_DIR)/usr/include/opencv2 $(1)/usr/include/ 
     $(INSTALL_DIR) $(1)/usr/lib 
     $(CP) $(PKG_INSTALL_DIR)/usr/lib/libopencv* $(1)/usr/lib/ 
 # define Build/InstallDev 
 #The generated header files and libraries into   ./staging_dir/target- mipsel_24kec+dsp_uClibc- and ./staging_dir/target-mipsel_24kec+dsp_uClibc- 
 #PKG_INSTALL_DIR  ./trunk/build_dir/target-mipsel_24kec+dsp_uClibc- 
 define Package/opencv/install 
     $(INSTALL_DIR) $(1)/usr/include 
     $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/ 
     $(INSTALL_DIR) $(1)/usr/lib 
     $(CP) $(PKG_INSTALL_DIR)/usr/lib/libopencv* $(1)/usr/lib/ 
 $(eval $(call BuildPackage,opencv))
 #This is the most critical BuildPackage macros. It is in the  $(INCLUDE_DIR)/package.mk defined in the file. BuildPackage macro requires only  one parameter, namely to compile the package name, in this case, the “opencv”. All other         information from macro to obtain, which provides an inherent simplicity. Such as BuildPackage need to pack a bunch of DESCRIPTION, we don't want to pass the parameters of the long, because we have agreed to describe information defined   in the DESCRIPTION of macros, BuildPackage reads from the inside.
 # the Build/Compile (optional)
 #Compile the source code.
 #Software installation command, mainly is the related documents copy to the  specified directory, such as the configuration file.

The compilation of opencv test program File:Https://github.com/WRTnode/openwrt-packages/tree/master/wrtnode/opencv-test/ opencv-test ipk源码 Here we also established a opencv-test ipk to test opencv libs, this process is similar to the helloworld ipk. Test procedures to achieve function is to read images from a camera, stored in the current directory. Since storage space is limited, save six pictures here. Here is generated Makefile opencv-test ipk package needed, its methods and compile method to compile any other ipk package exactly the same.

 $vim Makefile
 include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/kernel.mk
 include $(INCLUDE_DIR)/package.mk
 define Package/opencv-test
   SUBMENU :=demos
   TITLE:=opencv demo app
   DEPENDS := +opencv
 #DEPENDS := +opencv --depend on opencv lib
 define Package/opencv-test/description
     WRTnode test program for opencv lib
 define Build/Prepare
     mkdir -p $(PKG_BUILD_DIR)
     $(CP) ./src/* $(PKG_BUILD_DIR)/
 define Build/Compile
     $(MAKE) -C $(PKG_BUILD_DIR) \
 #$ (TARGET_CONFIGURE_OPTS), $ (TARGET_CFLAGS), $ (TARGET_LDFLAGS) and other defined rules.mk 
 define Package/opencv-test/install
     $(INSTALL_DIR) $(1)/usr/bin
     $(INSTALL_BIN) $(PKG_BUILD_DIR)/cv_test $(1)/usr/bin/
 #cv_test --Compiled executable file
 $(eval $(call BuildPackage,opencv-test))

opencv-test source code and Makefile in the src directory, interested students can further study. Note: opencv application can be considered almost a cross-platform, we can develop the following in windows or Mac x86, and will work with the graphics window display and keyboard input, etc. after OpenWrt not support code removed, to ensure the smooth compiled on WRTnode adoption and implementation.

WRTnode Projects

WRTnode Web Portal

At this point we start to define the interaction way of WRTnode’s web.Traditional OpenWrt luci as advanced Settings. Download and install ipk Download the http://d.wrtnode.com/packages/webwifi_1_ramips_24kec.ipk and Upload your WRTnode. Then ,log in to your WRTnode and perform:

 $ opkg install webwifi_1_ramips_24kec.ipk


Ipk packages installed will execute the following script later:

   $ set_default_page_to_wrtnode_portal.sh

(If you want to nitpick script name is too long, Teach you a trick, Under Linux the Tab key to magical function of completion, So you only need to input a few characters, and then use the Tab key to completion)


Open your browser(If ever visit luci interface before, please clear the browser cache),input:,clicke the Enter batten , the following interface will appear, congratulations! Your WRTnode web portal set up successfully.


Select your wireless access point and fill in the wireless password, Click to save. Because of the process to restart the network, some minutes is wanted, you will be prompted has been connected to the IP address of the router and distribution after refresh the page. Click set password management, you can change your wifi password. Click WRTnode Control Panel back to openwrt luci interface.


If you want to remove webwifi software package, perform:

  $ opkg remove webwifi 


After unloading webwifi packages to execute the following script, Also use the Tab key to match.Remember! after unloading webwifi this script must be executed:

  $ switch_to_default_luci.sh


How will these packages compiled together with the firmware

OpenWRT of feeds for updates and installation (refer to the specific process http://wiki.wrtnode.com/index.php?title=Compiling_WRTnode_Firmware ):

 $ cd trunk
 $ cp feeds.conf.default feeds.conf
 $ echo "src-git wrtnode https://github.com/WRTnode/openwrt-packages.git" >> ./feeds.conf
 $ ./scripts/feeds update -a
 $ ./scripts/feeds install -a


 $ make menuconfig



WRTnode flash MAC via web

1:compile and install ipk Download the WRTnode FlashMAC package ,compile and install. If you do not want to compile it you can directly download it as ipk, and install directly. Url:http://pan.baidu.com/s/1mg9hGKg 2:After install, download WRTnodemacjsonp.html [3] 3:How to use the WRTnodemacjsonp.html page The first step: Power on the ??television??, with a network cable to connect the PC The second step: Open the WRTnodemacjsonp.html file using google browser (Chrome) The third step: Write the MAC address in the input box to WRTnode


The MAC address is changed when you click the following button:


If the MAC address is successfully flashed the MAC address is automatically changed in the input box. Such as: 18:DD:BB:FF:EE:CC, successfully flashed MAC address input box automatically displays the next write MAC address 18:DD:BB:FF:EE:CE

WRTnode add support for RoboPeak Mini USB Display

RoboPeak Mini USB Display as an output device 一:Download RoboPeak Mini USB Display driver code 1:Click here to view the source code Create a new directory robopeak in the directory drivers/video Download driver source code and put it in the directory drivers/video/robopeak But there will be some small problems.for example, the location of the header file incorrect or missing some header files, and so on. 2:here provide modified driver code Download driver source code and put it in the directory drivers/video then decompressed.

 $ tar -jxvf robopeak.tar.bz2

二:How to add robopeak driver to the kernel configuration

 $(PATH) is the path where the driver

1: Edit the drivers/video/Kconfig and add source "drivers/video/robopeak/Kconfig"

  $vi $(PATH)/driver/video/Kconfig
  comment "Frame buffer hardware drivers"
     source "drivers/video/robopeak/Kconfig"
     depends on FB

2:在driver/video/Makefile添加 obj-$(CONFIG_FB_RPUSBDISP) += robopeak/

  vi $(PATH)/driver/video/Makefile
  obj-$(CONFIG_FB)               += fb.o
  obj-$(CONFIG_FB_RPUSBDISP)     += robopeak/


̩ $make kernel_menuconfig

 Device Drivers:
  USB Support:
    <*> Support for Host-side USB
  Graphics support:
   <*> Support for frame buffer devices:
   <*> Enable firmware EDID
   <*> Framebuffer foreign endianness support
   <*> Enable Video Mode Handling Helpers
   <*> Enable Tile Blitting Support
   <*> Robopeak USB Display  
   <*> Displaylink USB Framebuffer support
   [*]Bootup logo:
     <*> Standard 224-color Linux logo
 Character devices:
   <*> Virtual terminal
   <*> Enable character translations in console
   <*> Support for console on virtual terminal
   <*> Support for binding and unbinding console drivers
Graphics support:    
  Console display driver support:
    <*> Framebuffer Console support
    <*> Map the console to the primary display device
    <*> Framebuffer Console Rotation
    <*> Select compiled-in fonts
    <*> VGA 8x16 font


 $ make V=s -j

五:Refresh firmware and do the following: 1:Once the driver recognizes the display, a framebuffer device will be created. (e.g. /dev/fb0)

  #cat /proc/fb  

In the above example, /dev/fb0 is the related framebuffer device. To test whether the framebuffer device works, you may using the following command:

  #cat /dev/urandom > /dev/fb0

You should see the display screen is filled with random color dots. Show a picture on the screen. Download picture.bmp and put it in the directory /tmp

  #cat /tmp/picture.bmp > /dev/fb0

picture.bmp requirement is bmp format with a resolution of 320 * 240,16 bitmap.


Clear the screen:

  #dd if=/dev/zero of=/dev/fb0

Save the contents of the fb0

 #dd if=/dev/fb0 of=fbfile

Write back in the screen

 #dd if=fbfile of=/dev/fb0

Input string to display on screen Let’s check if the virtual console of the frame buffer has been created:

  # ls /sys/class/vtconsole/vtcon*
  bind       name       subsystem  uevent
  bind       name       subsystem  uevent

The console has been created. Let’s check that it belongs to the frame buffer:

  # cat /sys/class/vtconsole/vtcon1/name

(M) frame buffer device

   # cat /sys/class/vtconsole/vtcon1/bind
   #echo hellowrtnode > /dev/vcs1

RoboPeak Mini USB Display as an input device 一:Therefore on the stage of configuration OpenWrt the following modules are to be selected:

 $ make menuconfig
    Base system:
         <*> busybox:
    Linux System Utilities:
          <*> lsusb
    Kernel modules:
    USB Support:
          <*> kmod-usb-hid


 $make V=s -j

三:Refresh firmware and do the following: A new device has to be created in the directory /dev:

 #ls /dev/input/ -l
 crw-r--r--    1 root     root       13,  64 Sep 17 18:44 event0
 #cat /proc/bus/input/devices
 I: Bus=0003 Vendor=0000 Product=0000 Version=0000
 N: Name="RoboPeakUSBDisplayTS"
 P: Phys=
 S: Sysfs=/devices/virtual/input/input0
 U: Uniq=
 H: Handlers=event0
 B: PROP=0
 B: EV=b
 B: KEY=400 0 0 0 0 0 0 0 0 0 0
 B: ABS=1000003
 #cat /dev/input/event0 |hexdump

Touch RoboPeak Mini USB Display, printed on the wrtnode


WRTnode Settings

WRTnode connect to the network through the wan port

一: Modify the WAN mode 1: On the luci interface implementation: 1.1 Web address bar enter login WRTnode . 1.2 In Network-> interfaces to edit WAN.


1.3 modify the configuration


Override MAC address is set to null


1.4 Save & Apply 2: The above operations can also change the configuration file /etc/config/network to achieve. Modify ago:


The revised:


二: with a network cable connected to WRTnode router WAN port and LAN port. 1: No WRTnode standard backplane 1.1 to go to the root of the network cable


This is the root of the production and use of the network cable can Click here to view details 1.2 network cable connected to the WAN port WRTnode


Here's WAN port, LAN port is defined by software, which can be modified through the configuration file. Click here for details 2: Use WRTnode standard backplane 2.1 backplane access ports connected physically port3 port, the software is the default setting for port3 LAN port, so we have to modify the network port configuration to achieve port3 as Wan mouth. 2.2 modify the configuration file /etc/config/network to achieve. Modify ago:


After modified:


(Ie: for the 0 position and 3, the original definition of the WAN port port0 to port3)

  $ /etc/init.d/network Restart

2.3 After modification: See if there is a network cable to connect the display

107.png Check whether there wan port ip address assigned to


If you see these, you have successfully set The next is pleasant to the Internet