Android Communication with Development Board

Source: Internet
Author: User

Android Communication with Development Board
1, because we use this experiment is the serial port 2, that is, the serial port 2 to the WiFi core board use, change the jumper cap, so that the original serial port 2 is provided to ZigBee use, instead to wifi use.

2. Add ser2net Application
Last time we succeeded in allowing the driver to support the serial port 2, and did a simple test. Next, we will add an application for the serial port 2, thus implementing the Wi-Fi serial

# cd/openwrt/trunk/
# Make Menuconfig
Network--Ser2net Save exit
# Make V=99

3, burn firmware, enter the system configuration WiFi serial port
Since it is a Wi-Fi serial port, then we can understand that it consists of two parts, part of which is the network programmer
TCP server to receive data from the client via Wi-Fi, and the other part is the serial port for TCP
The data received by the server is sent through the serial port. Since it is a TCP server, we need to set its IP
Address and port number. Since it is a serial port, then we need to set its baud rate and other parameters. Well, with these parameters, we
How to set it? By modifying the ser2net.conf configuration file, the/etc directory located on the Development Board
Under The firmware compiled above, re-burned to the Development Board, and then power up to enter/etc directory
# CD/ETC
# VI Ser2net.conf

View information can be configured
# <tcp Port>:<state>:<timeout>:<device>:<options>
<tcp Port>: Used to set the port number to be monitored by the TCP server;
<state>: Used to set the status of the TCP server;
<timeout>: Used to set the timeout time, if set to 0, indicating that the timeout time is not turned on;
<device>: Used to choose which serial device to use;
<options>: Used to set the baud rate, check digit and other parameters.
If I want to allow our Wi-Fi serial port to listen to 8002, and then through the serial 2 output, the baud rate is 115200
8002:raw:0:/dev/ttys0:115200
Save Exit, reboot

Test WiFi serial port
1). Connect the serial port 2 of the Development Board with the serial port of the computer, then open the serial port assistant and set up the corresponding serial port.
2). Start ser2net software, only need to debug the serial port test, enter the following command: # ser2net
3). The phone is connected to the WiFi signal OpenWrt on the Development Board.
4). Start the "network debugging assistant" software, this Android APK we have provided in the "Additional: Android" folder of this experiment.

Boot self-powered WiFi serial port
# vi/etc/rc.local
Then add a ser2net in front of the exit0, as detailed below.
# Put Your custom commands here This should be executed once
# The System Init finished. By default this file does nothing.
Ser2net
Exit 0

Note: Many people find that debugging is not possible, the reason is about the following two questions:
1. The short-circuit cap position is not correct, please carefully read the manual above Figure 1
2. Baud rate is not set, display garbled or no output
3. Mobile phone set up TCP client display connection failure, generally is the wrong port number, please use PS check the correct port number and then connect.
Another is that ser2net does not start, it is best to do this experiment again,

Android Communication with Development Board

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.